我实际上是在尝试使用discord.py创建一个简单的Discord机器人。当我尝试执行此代码时,问题就出在这里:
import discord
from discord.ext import commands
myid = 3586xxxxxxxxxx
cliente = commands.Bot(command_prefix="!!")
@cliente.command()
async def clear(ctx,amount):
if myid == ctx.author.id:
print("Entering If statement") # This is printed
await ctx.channel.purge(limit=int(amount)) # This is not executed
else:
await ctx.channel.send("You don't have enough permissions.") # This is executed
输出没有意义,当我在服务器上运行“ !! clear 2”时,程序进入If并显示“ Entering the If语句”,它不会删除任何内容,然后bot发送消息在其他地方。
我现在很困惑:s