My Discord Bot seems to be doing everything twice. At first, I thought this was a cog issue but upon adding a testing function to the main .py file, even doing #test responds twice. Furthermore, when an unrecognised command is run, I will get an error message twice. How do I amend this?
import discord
from discord.ext import commands, tasks
import os #For Loading/Unloading Cogs
token="[redacted]"
help_command = commands.DefaultHelpCommand(no_category = "Placeholder")
client=commands.Bot(command_prefix="#", help_command=help_command) #The prefix for the Bot is "#", Changes the default group title for cogless commands.
for filename in os.listdir("./cogs"):
if filename.endswith(".py"): #Checks that the file in the cogs folder ends with ".py".
client.load_extension(f"cogs.{filename[:-3]}") #Loads cogs whilst cutting of the ".py" file extenstion.
print(f"{filename} has been loaded")
@client.command()
async def test(ctx):
await ctx.send("test done")
client.run(token)