I made a discord bot that is basically a super simple honeypot to get bots banned from my server, however, when I try to host my bot using render, I get this error:
discord.errors.HTTPException: 429 Too Many Requests (error code: 0):
The weird part is that when I run this code locally on my computer, I don't get this error and it is only when I try to host it using render. Also for some reason I am unable to view the discord.log file in render, so I have no idea how to debug this.
Here is the code for the bot:
import discord
from discord.ext import commands
import logging
from dotenv import load_dotenv
import os
import random
from keep_alive import keep_alive
# bot setup
load_dotenv()
token = os.getenv("DISCORD_TOKEN")
keep_alive()
handler = logging.FileHandler(filename="discord.log", encoding="utf-8", mode="w")
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
# constants
MOD_ROLES = ["Mod"]
BOT_TRAP_CHANNEL = 1472514187757355131
BANNED_BOTS_CHANNEL = 1472840649433944145
BOT_ROLE = "I am a robot"
BAN_REASON = "you are a bot and bots are cringe"
BAN_MESSAGES = [
"{m} thought they were a robot",
"{m} selected the \"I am a robot\" role (not a good idea)",
"{m} was NOT cooking. (you CAN believe it)",
"{m} is a bot. Have fun being banned!",
"{m} can't read... or they were a bot.",
"Everyone please laugh at {m}.",
"What is {m} doing? (being a bot and probably scamming people or smth)",
"{m} died",
"{b} is better that {m}.",
"{b} is the only bot here that we like. The same can not be said about {m}",
"{m}.ban(reason=\"you are a bot and bots are cringe\")",
"{m} get banned noob",
"{m} was NOT a human.",
"{m} is a filthy clanker",
"A wild {m} turned out to actually be a bot!"
]
# ban member function
async def banMember(member: discord.Member):
await member.ban(reason=BAN_REASON)
await bot.get_channel(BANNED_BOTS_CHANNEL).send(random.choice(BAN_MESSAGES).format(m=member.mention, b=bot.user.mention))
# ban bots in bot-trap channel
def MemberIsMod(member: discord.Member):
for role in member.roles:
if role.name in MOD_ROLES:
return True
return False
@bot.event
async def on_message(message: discord.Message):
if message.author == bot.user:
return
if message.channel == bot.get_channel(BOT_TRAP_CHANNEL):
if not MemberIsMod(message.author):
await banMember(message.author)
await bot.process_commands(message)
# ban bots with "I AM A BOT PLEASE BAN ME" role
def MemberHasBotRole(member: discord.Member):
for role in member.roles:
if role.name == BOT_ROLE:
return True
return False
@bot.event
async def on_member_update(before: discord.Member, after: discord.Member):
if len(before.roles) < len(after.roles):
if MemberHasBotRole(after):
await banMember(after)
@bot.event
async def on_ready():
for member in bot.get_all_members():
if MemberHasBotRole(member):
await banMember(member)
bot.run(token, log_handler=handler, log_level=logging.DEBUG)
Here is the log from render:
2026-03-03T06:15:58.43508941Z 127.0.0.1 - - [03/Mar/2026 06:15:58] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:21:03.5180319Z 127.0.0.1 - - [03/Mar/2026 06:21:03] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:26:07.415685655Z 127.0.0.1 - - [03/Mar/2026 06:26:07] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:31:11.314376365Z 127.0.0.1 - - [03/Mar/2026 06:31:11] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:36:16.728865579Z 127.0.0.1 - - [03/Mar/2026 06:36:16] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:41:21.370584379Z 127.0.0.1 - - [03/Mar/2026 06:41:21] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:46:30.710635137Z 127.0.0.1 - - [03/Mar/2026 06:46:30] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:51:37.702580677Z 127.0.0.1 - - [03/Mar/2026 06:51:37] "HEAD / HTTP/1.1" 200 -
2026-03-03T06:56:43.136182407Z 127.0.0.1 - - [03/Mar/2026 06:56:43] "HEAD / HTTP/1.1" 200 -
2026-03-03T07:01:48.387383028Z 127.0.0.1 - - [03/Mar/2026 07:01:48] "HEAD / HTTP/1.1" 200 -
2026-03-03T07:05:10.209759642Z ==> Deploying...
2026-03-03T07:05:10.315228536Z ==> Setting WEB_CONCURRENCY=1 by default, based on available CPUs in the instance
2026-03-03T07:05:59.176133378Z ==> Running 'python3 main.py'
2026-03-03T07:06:05.513511362Z * Serving Flask app ''
2026-03-03T07:06:05.513959902Z * Debug mode: off
2026-03-03T07:06:05.60569915Z WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
2026-03-03T07:06:05.60572466Z * Running on all addresses (0.0.0.0)
2026-03-03T07:06:05.605729841Z * Running on http://127.0.0.1:8080
2026-03-03T07:06:05.60573427Z * Running on http://10.19.182.181:8080
2026-03-03T07:06:05.605777722Z Press CTRL+C to quit
2026-03-03T07:06:05.706825405Z Traceback (most recent call last):
2026-03-03T07:06:05.708642485Z File "/opt/render/project/src/main.py", line 92, in
2026-03-03T07:06:05.708657386Z bot.run(token, log_handler=handler, log_level=logging.DEBUG)
2026-03-03T07:06:05.708661686Z ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-03T07:06:05.708666216Z File "/opt/render/project/src/.venv/lib/python3.14/site-packages/discord/client.py", line 929, in run
2026-03-03T07:06:05.708671216Z asyncio.run(runner())
2026-03-03T07:06:05.708675066Z ~~~~~~~~~~~^^^^^^^^^^
2026-03-03T07:06:05.708679116Z File "/opt/render/project/python/Python-3.14.3/lib/python3.14/asyncio/runners.py", line 204, in run
2026-03-03T07:06:05.708683076Z return runner.run(main)
2026-03-03T07:06:05.708686836Z ~~~~~~~~~~^^^^^^
2026-03-03T07:06:05.708690756Z File "/opt/render/project/python/Python-3.14.3/lib/python3.14/asyncio/runners.py", line 127, in run
2026-03-03T07:06:05.708695966Z return self._loop.run_until_complete(task)
2026-03-03T07:06:05.708699737Z ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
2026-03-03T07:06:05.708704417Z File "/opt/render/project/python/Python-3.14.3/lib/python3.14/asyncio/base_events.py", line 719, in run_until_complete
2026-03-03T07:06:05.708708157Z return future.result()
2026-03-03T07:06:05.708712257Z ~~~~~~~~~~~~~^^
2026-03-03T07:06:05.708716137Z File "/opt/render/project/src/.venv/lib/python3.14/site-packages/discord/client.py", line 918, in runner
2026-03-03T07:06:05.708720127Z await self.start(token, reconnect=reconnect)
2026-03-03T07:06:05.708724847Z File "/opt/render/project/src/.venv/lib/python3.14/site-packages/discord/client.py", line 846, in start
2026-03-03T07:06:05.708729187Z await self.login(token)
2026-03-03T07:06:05.708733277Z File "/opt/render/project/src/.venv/lib/python3.14/site-packages/discord/client.py", line 675, in login
2026-03-03T07:06:05.708737318Z data = await self.http.static_login(token)
2026-03-03T07:06:05.708741127Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-03T07:06:05.708745198Z File "/opt/render/project/src/.venv/lib/python3.14/site-packages/discord/http.py", line 839, in static_login
2026-03-03T07:06:05.708748988Z data = await self.request(Route('GET', '/users/@me'))
2026-03-03T07:06:05.708752868Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-03T07:06:05.708756778Z File "/opt/render/project/src/.venv/lib/python3.14/site-packages/discord/http.py", line 709, in request
2026-03-03T07:06:05.708760668Z raise HTTPException(response, data)
2026-03-03T07:06:05.708765448Z discord.errors.HTTPException: 429 Too Many Requests (error code: 0):
2026-03-03T07:06:05.708769858Z
2026-03-03T07:06:05.708773598Z
2026-03-03T07:06:05.708780658Z
2026-03-03T07:06:05.708785019Z
2026-03-03T07:06:05.708798779Z
2026-03-03T07:06:05.708801539Z
2026-03-03T07:06:05.708803879Z
2026-03-03T07:06:05.708806109Z Access denied | discord.com used Cloudflare to restrict access | discord.com | Cloudflare
2026-03-03T07:06:05.708808489Z
2026-03-03T07:06:05.708810719Z
2026-03-03T07:06:05.708813159Z
2026-03-03T07:06:05.708815309Z
2026-03-03T07:06:05.708817489Z
2026-03-03T07:06:05.708819979Z
2026-03-03T07:06:05.708832329Z
2026-03-03T07:06:05.70884133Z
2026-03-03T07:06:05.70884349Z
2026-03-03T07:06:05.70884563Z
2026-03-03T07:06:05.70884786Z
2026-03-03T07:06:05.70886377Z
2026-03-03T07:06:05.70886607Z
2026-03-03T07:06:05.708876961Z
2026-03-03T07:06:05.708884301Z Error
2026-03-03T07:06:05.708886611Z 1015
2026-03-03T07:06:05.708888821Z
2026-03-03T07:06:05.708891021Z Ray ID: 9d66cbe959ea150f •
2026-03-03T07:06:05.708906131Z 2026-03-03 07:06:05 UTC
2026-03-03T07:06:05.708915071Z
2026-03-03T07:06:05.708922282Z You are being rate limited
2026-03-03T07:06:05.708924531Z
2026-03-03T07:06:05.708926802Z
2026-03-03T07:06:05.708928962Z
2026-03-03T07:06:05.708931492Z
2026-03-03T07:06:05.708933832Z
2026-03-03T07:06:05.708936092Z
2026-03-03T07:06:05.708938362Z
2026-03-03T07:06:05.708948142Z What happened?
2026-03-03T07:06:05.708950422Z
2026-03-03T07:06:05.708952872Z
2026-03-03T07:06:05.708955712Z The owner of this website (discord.com) has banned you temporarily from accessing this website.
2026-03-03T07:06:05.708957902Z
2026-03-03T07:06:05.708960092Z
2026-03-03T07:06:05.708964563Z
2026-03-03T07:06:05.708966872Z Please see
2026-03-03T07:06:05.708969192Z https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/error-1015/
2026-03-03T07:06:05.708983463Z for more details.
2026-03-03T07:06:05.708985633Z
2026-03-03T07:06:05.708987963Z
2026-03-03T07:06:05.709017474Z
2026-03-03T07:06:05.709022804Z
2026-03-03T07:06:05.709025394Z
2026-03-03T07:06:05.709027794Z
2026-03-03T07:06:05.709030434Z
2026-03-03T07:06:05.709032574Z
2026-03-03T07:06:05.709037014Z
2026-03-03T07:06:05.709039384Z
2026-03-03T07:06:05.709083755Z
2026-03-03T07:06:05.709086045Z Thank you for your feedback!
2026-03-03T07:06:05.709088305Z
2026-03-03T07:06:05.709091265Z
2026-03-03T07:06:05.709130016Z
2026-03-03T07:06:05.709132396Z
2026-03-03T07:06:05.709134696Z
2026-03-03T07:06:05.709136926Z
2026-03-03T07:06:05.709138946Z
2026-03-03T07:06:05.709141006Z
2026-03-03T07:06:05.709154597Z
2026-03-03T07:06:05.709159167Z
2026-03-03T07:06:05.709167167Z
2026-03-03T07:06:05.76991699Z 127.0.0.1 - - [03/Mar/2026 07:06:05] "HEAD / HTTP/1.1" 200 -
2026-03-03T07:06:08.753876963Z ==> Your service is live 🎉
2026-03-03T07:06:08.821146576Z ==>
2026-03-03T07:06:08.824142747Z ==> ///////////////////////////////////////////////////////////
2026-03-03T07:06:08.826781528Z ==>
2026-03-03T07:06:08.832224409Z ==>
2026-03-03T07:06:08.834515968Z ==> ///////////////////////////////////////////////////////////
2026-03-03T07:06:08.93309394Z 127.0.0.1 - - [03/Mar/2026 07:06:08] "GET / HTTP/1.1" 200 -
2026-03-03T07:06:53.902454713Z 127.0.0.1 - - [03/Mar/2026 07:06:53] "HEAD / HTTP/1.1" 200 -
2026-03-03T07:11:10.925348034Z ==> Detected service running on port 8080
2026-03-03T07:11:11.002822429Z ==> Docs on specifying a port: https://render.com/docs/web-services#port-binding
2026-03-03T07:11:59.588732057Z 127.0.0.1 - - [03/Mar/2026 07:11:59] "HEAD / HTTP/1.1" 200 -