Here is my code in main.py
:
import discordimport asynciofrom discord.ext import commandsTOKEN="secret"intents = discord.Intents.default()bot = commands.Bot(command_prefix="?", intents = intents)@bot.eventasync def on_ready(): print(f'{bot.user} successfully logged in!')@bot.eventasync def on_message(message): if message.author == bot.user: return await bot.process_commands(message)@bot.command()async def spam(ctx, message, *, amount:int): await ctx.send("Starting Spam...") new_amount = amount+1 for i in range(1, new_amount): await ctx.send(message) await asyncio.sleep(0.5) await ctx.send("Spam Completed!")try: bot.run(TOKEN, bot = False)except discord.HTTPException as e: if e.status == 429: print("The Discord servers denied the connection for making too many requests") else: raise e
My bot does go online, however, when I use the spam command, it doesn't work.The code doesn't give any errors. So I am wondering what the problem is.Any help will be appreciated.