@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!")
^这是不适用于拥抱事件的代码之一。
答案 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