Fix Discord API 429 Rate Limits & Loops
Track down and fix Discord HTTP 429 rate limits caused by stat channel renames, streaming AI edits, and bot-to-bot reply loops.
Why Discord returns HTTP 429 Too Many Requests
Discord enforces both a global rate limit (50 requests per second per bot) and stricter per-route rate limits on specific endpoints. Modern libraries like discord.js
and discord.py
throttle normal traffic automatically, so seeing repeated 429
warnings almost always points to a tight loop or a particularly strict Discord endpoint.
429
responses can trigger temporary Cloudflare bans or slow down every command your bot handles across all servers.
The 4 biggest triggers of Discord 429 loops
1. Renaming stat or player-count channels too often
Discord limits channel name/topic edits to 2 requests per 10 minutes per channel. A bot that updates a "Members: 142" or "FiveM Players: 38/64" voice channel every 30 seconds will stay permanently rate-limited. Increase channel-rename intervals to at least 5–10 minutes (and skip the edit if the number didn't change).
2. Streaming AI responses with unthrottled message edits
Calling message.edit()
on every token chunk from OpenAI or Claude floods Discord's message-edit bucket (roughly 5 edits per 5 seconds per channel). Buffer streamed chunks and edit the message at most once every 1.5–2 seconds, plus one final edit when generation completes.
3. Bot-to-bot reply loops on messageCreate
Always check if (message.author.bot) return;
at the very top of your message listener. Without that check, your bot can reply to its own messages (or argue with another bot) in an infinite loop.
4. Re-registering slash commands on every restart or guild event
Registering global application commands inside a per-guild loop or during a crash loop burns through Discord's command-sync limits quickly. Sync commands once on startup (or via a separate deploy script) rather than on every event.
Practical fixes in discord.js & discord.py
Add a simple per-user cooldown on expensive commands and skip redundant channel updates when the displayed value hasn't changed:
const cooldowns = new Map();
client.on('messageCreate', (message) => {
// Prevent self-reply and bot-to-bot loops:
if (message.author.bot) return;
const now = Date.now();
const expiresAt = cooldowns.get(message.author.id) ?? 0;
if (now < expiresAt) return;
cooldowns.set(message.author.id, now + 5_000); // 5-second cooldown
});
from discord import app_commands
@bot.tree.command(name="ask", description="Ask the bot a question")
@app_commands.checks.cooldown(1, 10.0, key=lambda i: i.user.id)
async def ask(interaction: discord.Interaction, prompt: str):
await interaction.response.defer()
# ...call your API and send one follow-up reply
For stat channels, cache the last name you set and only call channel.setName()
/ channel.edit(name=...)
on a 10-minute timer when the string actually changes.
Automatic 429 detection on Blip Host
Blip Host monitors your bot's Discord API health automatically. If a command loop, channel rename timer, or unthrottled edit burst starts triggering repeated 429
responses, Blip Host flags a Rate limits notice at the top of your bot overview and alerts you via email or Discord webhook so you can fix the loop before it degrades your bot.