当我启动我的机器人并打字时!你好,我收到这个错误,这是我的代码
import discord
from discord.ext import commands
import os
import asyncio
intents = discord.Intents.all()
intents.members = True
client = commands.Bot(command_prefix='!', intents=intents)
@client.command()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
@client.command()
async def unload(ctx, extension):
client.unload_extension(f'cogs.{extension}')
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs,{filename[:-3]}')
client.run("*")
用于齿轮的第二个文件example.py
import discord
from discord.ext import commands
class example(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print('Bot is ready')
@commands.command()
async def hello(self, ctx):
await ctx.send('Hi')
async def setup(client):
await client.add.cog(example(client))
如果有人能帮我解决这个问题,我将非常高兴