我已经尝试了多种不同的方法,使用带有discord.py的bot/selfbot来锁定(我也想尝试取消锁定)某条消息(它已经被发送),下面是几个示例:
@pinner.event
async def on_message():
if message.content == 'message im trying to pin':
message.pin
@tasks.loop(seconds=1)
async def pin_message():
message = ('message id ')
await message.pin(message id)
我正在使用Python3.8和discord.pyAPI的最新版本
为了锁定消息,您必须首先拥有该消息,一旦拥有该消息,您就可以
await message.pin()
要取消固定,可以使用
await message.unpin()
为了锁定或取消锁定消息,bot还必须具有
manage_messages
权限这将锁定用户触发命令的消息
如果要锁定特定消息,则必须使用
ctx.fetch_message(message_id)
或文本通道textchannel.fetch_message(message_id)
获取该消息这将锁定用户想要的消息:
可选:还可以使用
await message.pin(reason="your reason here")
指定原因文档:
相关问题 更多 >
编程相关推荐