有没有办法在消息被删除后发送消息?

时间:2021-04-30 12:45:18

标签: python discord discord.py

因此,当用户发送消息时,我希望我的机器人向该频道发送带有表情符号的消息

到目前为止,我已经能够将其发送到特定频道,但之后我无法向任何删除了消息的频道发送消息。

也许我只是不知道这些属性。

提前感谢所有帮助!

@bot.event
async def on_message_delete(ctx):
    if ctx.author.id != 835676293625282601:
        author = ctx.message.author
        del_msg = await channel.send(":eyes:")
        await author.send(del_msg)
        await asynciaito.sleep(10)
        await del_msg.delete()

1 个答案:

答案 0 :(得分:4)

事件从不将 ctx 作为参数,如果您查看 docs,您会发现 on_message_deletemessage 作为唯一参数

@bot.event
async def on_message_delete(message):
    if message.author.id != 835676293625282601:
        author = message.author
        del_msg = await message.channel.send(":eyes:")
        await author.send(del_msg)
        await asynciaito.sleep(10)
        await del_msg.delete()

此外,您不必了解所有不和谐对象的所有属性,只需阅读文档

相关问题