Discord.py 使用process_命令时出现错误消息
我收到一条错误消息,原因是命令进程\ u命令和命令不起作用,而EVNT确实起作用Discord.py 使用process_命令时出现错误消息,discord.py,Discord.py,我收到一条错误消息,原因是命令进程\ u命令和命令不起作用,而EVNT确实起作用 import discord from discord import commands import os bot = commands.Bot(command_prefix="!") client = discord.Client() @client.event async def on_ready(): print('Logged in as as {0.user}'.forma
import discord
from discord import commands
import os
bot = commands.Bot(command_prefix="!")
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('Hello'):
await message.channel.send('Hello!')
#here comes the error message
await bot.process_commands(message)
#this command doesn't work
@bot.command()
async def testymesty(ctx):
await ctx.send('test')
keep_alive()
client.run(os.environ['TOKEN'])
简单错误,您将客户端定义为commands.bot,那么它将是: 等待客户端处理命令(消息) 在客户端和bot之间做出决定
不要同时使用客户端和bot您必须使用客户端或bot,使用bot,删除不一致。客户端已定义,并将所有表示客户端的内容更改为botOh,好的,谢谢,现在它工作了!但是你能解释一下commands.Bot和discord.client之间的区别吗?我相信
commands.Bot
是discord.client的一个稍微扩展的版本。好的,非常感谢你的帮助!