Discord.py not unpinning own bot's messages

Viewed 224

My test code is

@bot.command(name='test')
async def test(ctx):
    message = await ctx.send('test')
    channel = ctx.channel
    message = await channel.fetch_message(message.id)
    await message.pin()
    await message.unpin()

The bot pins the message but it won't unpin it.

2 Answers

I tested the code, it works fine for me.

NOTE- Discord only shows a message that someone has pinned the message, but discord does not show if someone has unpinned it, you need to check it in the pinned messages.

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix = '!')

@bot.event
async def on_ready():
    print('Logged successfully!')

@bot.command()
async def test(ctx):
    message = await ctx.send('test')
    await message.pin()
    await message.unpin()

bot.run('BOT_TOKEN_HERE')
Related