我需要帮助修复这个@bot.event 循环

时间:2021-05-14 16:48:17

标签: python discord.py

@bot.event
async def on_message(message):
  if message.author ==bot.user or message.author.bot:
    return
  mention=message.author.mention
  if message.content == "$hug":  
    await message.channel.send(f"Hugs {mention} back")
    return

这是我用来运行循环的代码,它工作但关闭了我的其余代码。我想知道这段代码中是什么导致了其余部分的关闭。

Im using replit and am using one of the discord.py templates.
@bot.command()
async def dink(ctx):
    await ctx.send("Donk!")

^这是不适用于拥抱事件的代码之一。

1 个答案:

答案 0 :(得分:0)


    @bot.event
    async def on_message(message):
      if message.author ==bot.user or message.author.bot:
        return
      mention=message.author.mention
      if message.content == "$hug":  
        await message.channel.send(f"Hugs {mention} back")
        return
      elif message.content == "dink":
        await message.channel.send("Donk!")
        return

相关问题