看看我的代码/ 这是输出: 回溯(最近一次调用最后一次): 文件“C:\Games\Coding ickets.py”,第 8 行,位于 @client.event ^^^^^^^^^^^^^ AttributeError:模块“discord.client”没有属性“event”
代码:
import discord
from discord.ext import commands
client = commands.bot
@client.event
async def on_ready():
print("Bot is ready to execute action")
这里出了什么问题?
它是
commands.Bot
,你需要使用command_prefix
参数来调用它。
from discord.ext import commands
client = commands.Bot(command_prefix='!')
@client.event
async def on_ready():
print("Make something with the bot")
client.run('BOT_TOKEN')