【发布时间】:2021-06-24 02:08:24
【问题描述】:
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='$')
def read_token():
with open("token.txt", "r") as f:
lines = f.readlines()
return lines[0].strip()
token = read_token()
client = discord.Client()
@bot.command()
async def commands():
embed = discord.Embed(title="Commands")
embed.add_field(name="$info", value="Shows info about the bot", inline=False)
embed.add_field(name="$users", value="Shows how many members the server has", inline=False)
await message.channel.send(content=None, embed=embed)
@bot.command()
async def info():
await message.channel.send("Bot feito por Ra'Ed#2931")
@bot.command()
async def users():
await message.channel.send(f"""Esse server tem {id.member_count} membros""")
bot.add_command(commands)
bot.add_command(info)
bot.add_command(users)
client.run(token)
当我运行此代码时,我会收到以下输出:
discord.ext.commands.errors.CommandRegistrationError:命令命令已经是现有命令或别名。
我能做些什么来解决这个问题?
【问题讨论】: