所以我有一个脚本,它同时使用@bot.event
和@bot.command()
。问题是当我有一个@bot.event
在等待时@bot.command()
将不会运行
这是我的密码:
@bot.event
async def on_ready():
print("Bot Is Ready And Online!")
async def react(message):
if message.content == "Meeting":
await message.add_reaction("👍")
@bot.command()
async def info(ctx):
await ctx.send("Hello, thanks for testing out our bot. ~ techNOlogics")
@bot.command(pass_context=True)
async def meet(ctx,time):
if ctx.message.author.name == "techNOlogics":
await ctx.channel.purge(limit=1)
await ctx.send("**Meeting at " + time + " today!** React if you read.")
@bot.event ##THIS ONE HOLDS UP THE WHOLE SCRIPT
async def on_message(message):
await react(message)
将
on_message
事件与命令混合使用时,您需要添加await bot.process_commands(message)
,如下所示:如文件所述:
参考文献:
相关问题 更多 >
编程相关推荐