每次我尝试使用commands.Bot(command_prefix='')
,程序都会将其作为错误读取。例如,使用下面的代码,它会
Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "-ping" is not found Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "ping" is not found
在我想让机器人说的话(Pong!)在服务器中发送2次或更多次之前,重复了几次
\我想可能是循环?我不确定,但我让它工作过一次,但我等待的时间越长,每次使用命令它都会发送更多的响应-这是我最后一次尝试时发出的16'Pong。。。对此我能做些什么吗?\
我怎样才能解决这个问题
from discord.ext import commands
client = commands.Bot(command_prefix='-')
@client.event
async def on_ready():
print("Bot is ready for use...")
@client.command()
async def ping(ctx):
await ctx.send('Pong')
client.run('TOKEN')
问题不在于前缀,而在于您忘记了
client.command
装饰符后面的括号:client.event
装饰器没有任何参数,因此不需要括号,但是client.command()
可以有类似name=
、brief=
、description=
、aliases
的参数。。。所以你需要括号。^^相关问题 更多 >
编程相关推荐