我有一个错误,我不能解决它 该错误是标题 我已经在其他情况下测试过了
import discord
from discord.ext import commands
client = discord.Client()
class utility(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print("Cog utility pronto!")
@commands.command()
async def ping(self, ctx):
await ctx.send(f"Pong! {round(client.latency * 1000)}ms")
@commands.command()
async def clear(ctx, amount=5):
await ctx.channel.purge(limit=amount)
await ctx.send(f"{amount}Messaggi eliminati")
def setup(client):
client.add_cog(utility(client))