您好,我正在尝试制作一个反应角色机器人,但遇到了这个错误。它说我的名为 USER_SETUP 的变量未使用,但事实并非如此。我已经尝试了大多数事情,但我似乎无法做到正确。这是我的代码:
USER_DOING_SETUP = False
USER_SETUP = 0
@client.command(aliases=['rr', 'reactionroles'])
async def reactionrole(ctx, user, arg):
if arg == "setup":
if USER_DOING_SETUP == False:
userId = user.id
USER_SETUP = userId
USER_DOING_SETUP = True
await ctx.send(f"TEST REACTION ROLES TYPE {BOT_PREFIX}!rr cancel TO CANCEL")
else:
await ctx.send("Setup is used by another user")
elif arg == "cancel":
USER_DOING_SETUP = True
USER_SETUP = 0
await ctx.send("setup was cancled :)")
@client.event
async def on_message(message):
if message.author != client.user:
if USER_DOING_SETUP == False:
await message.channel.send("false")
elif USER_DOING_SETUP == True:
if USER_SETUP == message.author.id:
await message.channel.send("true")
else:
await message.channel.send("false")
错误: Unused variable 'USER_SETUP'
开满天机
相关分类