简体   繁体   中英

Error 429, Too many requests. When I was trying to keep my python discord 24/7 on replit

import discord
import keep_alive
TOKEN = ""
with open("bot.env", "r+") as file:
  content = file.read()
  lvl2 = content.split("=")
  TOKEN = lvl2[1]
SERVER_NAME = "CHAMP's SMP"
client = discord.Client()    
@client.event
async def on_ready():
    for guild in client.guilds:
        if guild.name == SERVER_NAME:
            break
    print(f'{client.user} has connected to:\n'
            f'{guild.name}(id: {guild.id})'
          )

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    if "Hi" in message.content or "Hello" in message.content:
        await message.channel.send("Hallo!")
    if "Happy Birthday" in message.content:
        await message.channel.send("Happy Birthday! ummm.... Whoever😅")
    if "Bye" in message.content:
        await message.channel.send("Bye, Guess I\'ll have to stay here...")
    if "$server" == message.content:
        await message.channel.send("""
-Cracked: Yes
-Joining Discord is mandatory
-Don't just join the server for once, need to be regular.
-No swearing
-No hacking
-IP: champ_99.aternos.me
-Port: 43075
-Build Your kingdoms and have wars
-This bot is currently in development
""")
    if "Good" in message.content and str(client.user.id) in message.content:
        await message.channel.send("Glad to see that you are glad from the work I just did. :-)")

    if str(client.user.id) in message.content:
      if "age" in message.content:
        await message.channel.send("I am a bot, we don't have ages. Though my master @Champ is 14 years old.")
      elif "name" in message.content:
        await message.channel.send("My name is Champ SMPee, as you can see")
      else:
        await message.channel.send("Yes? please type $help for more information.")
    if "$help" in message.content:
      await message.channel.send("""
      -> 
      """)

keep_alive.keep_alive()
client.run(TOKEN)
print("Bot started!")

That is all the code. When I run it, it shows a lot of html code with a message which says "Error 429 Too many requests". I am using uptimer bot for updating and even tried changing the port of the keep_alive.py file. Any help will be appreciated. Thank You

If you are using repl.it, enter kill 1 in the shell which is next to the console tab.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM