I was making a game command in discord.js, but when attempting to editReply, it won't go past that... I tried putting console logs before and after, and the one after didn't run. I tried using await interaction.deferReply(), and that just stayed on BotName is thinking.... The arguments are passed in correctly and there aren't any errors.
Here is the code:
async execute(client, interaction, args) {
await interaction.reply(`valid string here`) // does send
let num = Math.floor((Math.random() * (args[0] || 1000)) + 1); //get random number
let guesses = 0;
let logs = ["None"];
console.log("Running 1") // logs
await interaction.editReply(
`valid string here`
)
console.log("Running 2") // doesn't log and doesn't edit
// ...
}
After using client.on("debug") and client.on("warn"), it seems I'm getting a 429, but I'm not even looping, and it was working just fine yesterday
Hit a 429 while executing a request.
Global : false
Method : patch
Path : /webhooks/---/messages/@original
Route : /webhooks/:id/---/messages/@original
Limit : Infinity
Timeout : 500ms
Sublimit: 1130000ms
Your new edit to the question most likely answers your question. If you host a bot on replit (especially with free hosting), it is likely that your bot will share an IP with other bots hosted on replit. Discord's rate limits are enforced based on the IP that is requesting the API. All it takes for this error to occur is for someone else on replit (whose bot happens to share the same IP as yours) to create a poorly/maliciously designed discord bot that spams the API and causes your bot's IP to get rate limited. In this case, I assume someone was using .editReply() too much in a poorly designed loop or such.
As for a solution to this issue, I found this replit post. It suggests that you can "run kill 1 in the shell tab to destroy the current container and switch to a new one." That post is from 10 months ago, so it may or may not work now. (If this doesn't work, an alternate solution could also be to fork your own repl, and then delete the original. This may also switch your bot over to a new IP).