'Getting errors in loading a command in discord.py
So I am building a bot.
Here is the code:
import discord
from discord.ext import commands
from discord.utils import get
client = discord.Client()
bot = commands.Bot(command_prefix="&")
token = "<token censored for privacy>"
@client.event
async def on_ready():
print(f"{client.user} has connected to Discord.")
@bot.command()
async def repeat(ctx, args):
await ctx.send(args*10)
await ctx.send("You got rolled. Do it again.")
bot.add_command(repeat)
client.run(token)
But when I run the code, I get back an error:
discord.ext.commands.errors.CommandRegistrationError: The command repeat is already an existing command or alias.
I have not called the bot.add_command function before. Can anyone help out with this?
Screenshot of the error:
discord.ext.commands.errors.CommandRegistrationError image
Screenshot of the code:
bot.py file
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
