因此,如果我實現(xiàn)了 bot.event,bot.command 就不起作用,但如果我評論或刪除 bot.event,bot.command 就可以正常工作。在這里,bot.command 不起作用,但 bot.event 起作用:# bot.pyimport osfrom discord.ext import commandsfrom dotenv import load_dotenvload_dotenv()TOKEN = os.getenv('DISCORD_TOKEN')bot = commands.Bot(command_prefix='dedmu ')@bot.eventasync def on_ready(): print(f'{bot.user.name} has connected to Discord!')@bot.eventasync def on_message(message): if message.author == bot.user: return if message.content.lower() == 'testt': await message.channel.send('it works')@bot.command(name='test')async def test(ctx, arg): await ctx.send(arg)bot.run(TOKEN)如果我用 bot.event 注釋這兩個函數(shù),則 bot.command 可以完美工作。它出什么問題了?:<
Discord.py、bot.event 有效,但 bot.command 無效
ibeautiful
2023-12-12 10:00:08