我正在为我的特殊兴趣编写一个不和谐的机器人,请问我能得到一些帮助吗?代码格式如下:
import os
import discord
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
client = discord.Client()
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
client.run(TOKEN)```
How do I make this work?发布于 2021-04-23 17:03:39
我认为,您对客户端的定义是错误的。尝试:
from discord.ext import commands
//*Your dotenv stuff here*
client = commands.Bot(command_prefix="Your prefix here")
client.run(TOKEN)我希望它能工作,如果不能,请随时纠正我。
https://stackoverflow.com/questions/67225758
复制相似问题