简体   繁体   English

如何让 discord.py 重写机器人在自己的消息中添加表情符号

[英]How to make a discord.py rewrite bot add emojis t its own message

Im trying to make a discord.py rewrite bot add a emoji to its own message but keeps adding emoji to the users message.我试图让 discord.py 重写机器人在自己的消息中添加表情符号,但不断在用户消息中添加表情符号。

here is my code.这是我的代码。

@client.event
async def on_message(message):
  if message.author.bot: 
    return
  if message.content.lower() == "hi":
    em=discord.Embed(description=f"Hello, {message.author.name}",color=discord.Colour.red())
    await message.channel.send(embed = em)
    for emoji in ('👋'):
        await message.add_reaction(emoji)

Because message is the message that the user sent, not the bot.因为message是用户发送的消息,而不是机器人。

msg = await message.channel.send(embed=em)
await msg.add_reaction('👋')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM