伙计们,我正在制作一个不和谐的机器人,但我有一个错误,上面写着“名称‘机器人’未定义”。有人能帮忙吗? 谢谢
import discord
from discord.ext import commands
from discord.ext.commands import has_permissions
client = commands.Bot(command_prefix = ';')
@client.event
async def on_ready():
print("{0.user} logged in as".format(client))
@bot.command(pass_context=True)
@has_permissions(administrator=True)
async def help(ctx):
await ctx.send('Help')
client.run('TOKEN')
您需要使用
Client
或Bot
来实例您的bot。 在代码中,您正在将bot实例化为Client
,但尝试使用@bot.command()
创建命令您需要使用
@client.command()
或@commands.command()
相关问题 更多 >
编程相关推荐