Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14331

My discord bot made with python is not working

$
0
0

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.


Viewing all articles
Browse latest Browse all 14331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>