1. <small id='U1Vbd'></small><noframes id='U1Vbd'>

  2. <legend id='U1Vbd'><style id='U1Vbd'><dir id='U1Vbd'><q id='U1Vbd'></q></dir></style></legend>

      • <bdo id='U1Vbd'></bdo><ul id='U1Vbd'></ul>
      <i id='U1Vbd'><tr id='U1Vbd'><dt id='U1Vbd'><q id='U1Vbd'><span id='U1Vbd'><b id='U1Vbd'><form id='U1Vbd'><ins id='U1Vbd'></ins><ul id='U1Vbd'></ul><sub id='U1Vbd'></sub></form><legend id='U1Vbd'></legend><bdo id='U1Vbd'><pre id='U1Vbd'><center id='U1Vbd'></center></pre></bdo></b><th id='U1Vbd'></th></span></q></dt></tr></i><div id='U1Vbd'><tfoot id='U1Vbd'></tfoot><dl id='U1Vbd'><fieldset id='U1Vbd'></fieldset></dl></div>

      <tfoot id='U1Vbd'></tfoot>

      discord.py @bot.command() 没有运行

      时间:2023-09-10
        • <bdo id='rHQ4E'></bdo><ul id='rHQ4E'></ul>

            <tfoot id='rHQ4E'></tfoot>

            <small id='rHQ4E'></small><noframes id='rHQ4E'>

          • <legend id='rHQ4E'><style id='rHQ4E'><dir id='rHQ4E'><q id='rHQ4E'></q></dir></style></legend>

                  <tbody id='rHQ4E'></tbody>
                <i id='rHQ4E'><tr id='rHQ4E'><dt id='rHQ4E'><q id='rHQ4E'><span id='rHQ4E'><b id='rHQ4E'><form id='rHQ4E'><ins id='rHQ4E'></ins><ul id='rHQ4E'></ul><sub id='rHQ4E'></sub></form><legend id='rHQ4E'></legend><bdo id='rHQ4E'><pre id='rHQ4E'><center id='rHQ4E'></center></pre></bdo></b><th id='rHQ4E'></th></span></q></dt></tr></i><div id='rHQ4E'><tfoot id='rHQ4E'></tfoot><dl id='rHQ4E'><fieldset id='rHQ4E'></fieldset></dl></div>
              1. 本文介绍了discord.py @bot.command() 没有运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有类似的东西.

                from flask import Flask
                from threading import Thread
                import discord
                from discord.ext import commands, tasks
                from discord.utils import get
                import requests
                from Moderator.badwords import words
                import time
                import datetime
                from Stats.uptime import data
                
                help_command = commands.DefaultHelpCommand(
                    no_category = 'Commands'
                )
                
                intents = discord.Intents().all()
                bot = commands.Bot(command_prefix='!', description="Hey there, I'm Botty (for example)!", help_command=help_command, intents=intents)
                
                @bot.command()
                async def hello(ctx):
                  await ctx.send(ctx.author.mention + " hello!")
                
                @bot.event
                async def on_ready():
                  print('Ready!')
                
                @bot.event
                async def on_message(message):
                    for word in words:
                        if word in message.content.lower():
                            await message.delete()
                            await message.channel.send("Oops! Seems like " + message.author.mention + " was trying to send a message that was breaking the " + bot.get_channel(783064049859559434).mention + ". Luckily, I deleted it before it caused any more damage. Don't send any more messages like that!
                
                If you think that I made an error, please report it in " + bot.get_channel(783074030265040916).mention + ", " + bot.get_channel(783074002255478848).mention + " or in " + bot.get_channel(783092164590174251).mention)
                
                @bot.event
                async def on_member_join(member):
                  print(f"{member} joined the server")
                
                bot.run(TOKEN)
                

                现在,我可以毫无错误地编译和运行此代码,并且当成员加入或用户发送消息时,一切正常.但是当涉及到运行命令时,它甚至没有启动.我有什么遗漏吗?

                Now, I can compile and run this code with no errors, and when a member joins or a user sends a message, all works perfectly fine. But when it comes to run commands, it does not even start. Is there something i'm missing?

                提前致谢

                推荐答案

                文档:

                覆盖默认提供的 on_message 会禁止运行任何额外的命令.要解决此问题,请在 on_message 末尾添加 bot.process_commands(message) 行.

                Overriding the default provided on_message forbids any extra commands from running. To fix this, add a bot.process_commands(message) line at the end of your on_message.

                如果您覆盖 on_message,则需要使用 await bot.process_commands(message) 以便处理命令.尝试将其添加到您的 on_message 事件中.

                If you override an on_message, you need to use await bot.process_commands(message) so that the commands are processed. Try adding that to your on_message event.

                这篇关于discord.py @bot.command() 没有运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Discord.py ctx.guild.edit 有效,但 self.bot.guild.edit 无效 下一篇:如何使用上下文在同一行中定义的上下文设置默

                相关文章

                最新文章

                • <bdo id='0QaYd'></bdo><ul id='0QaYd'></ul>

                <tfoot id='0QaYd'></tfoot>

                <i id='0QaYd'><tr id='0QaYd'><dt id='0QaYd'><q id='0QaYd'><span id='0QaYd'><b id='0QaYd'><form id='0QaYd'><ins id='0QaYd'></ins><ul id='0QaYd'></ul><sub id='0QaYd'></sub></form><legend id='0QaYd'></legend><bdo id='0QaYd'><pre id='0QaYd'><center id='0QaYd'></center></pre></bdo></b><th id='0QaYd'></th></span></q></dt></tr></i><div id='0QaYd'><tfoot id='0QaYd'></tfoot><dl id='0QaYd'><fieldset id='0QaYd'></fieldset></dl></div>

                1. <small id='0QaYd'></small><noframes id='0QaYd'>

                  1. <legend id='0QaYd'><style id='0QaYd'><dir id='0QaYd'><q id='0QaYd'></q></dir></style></legend>