这是我的代码。它仍处于早期开发中。另外,我对开发机器人还很陌生。
import discord
from discord.ext import commands
client = discord.Client()
bot_prefix: str = ">"
client = commands.Bot(command_prefix=bot_prefix)
@client.event
async def on_ready():
print('Miska Rise')
这是我现在要举行的活动:
@client.event
async def on_message(message):
if message.author == client.user:
return None
if message.content.startswith('woof') or message.content.startswith('Woof'):
await message.channel.send('Bork!')
这是命令:
@client.command()
async def ping(ctx):
await ctx.send('Pong!')
答案 0 :(得分:0)
如果您覆盖on_message
,则需要在其中调用Bot.process_commands
,以便仍然处理命令。
请参见Why does on_message
make my commands stop working? section of the FAQ in the documentation。