如何解决Discord.py没有取消固定自己的机器人消息
我的测试代码是
@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()
机器人将消息固定,但是不会取消固定。
解决方法
我测试了代码,对我来说很好用。
注意-不和谐仅显示一条消息,表明某人已将该消息固定,但不和谐不显示某人是否已将其固定,您需要在已锁定的消息中进行检查。
,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')
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。