Conner-Anderson / discord-hvz

A Discord bot that helps manage a Humans vs. Zombies game. Built for the LeTourneau University game, but packaged up with documentation for outside use.
https://conner-anderson.github.io/discord-hvz-docs/latest/
MIT License
4 stars 0 forks source link

Bot Quarantine on Large registration load #84

Open Jermspace opened 1 month ago

Jermspace commented 1 month ago

We had this bot set up and ready to go and then opened it up to allow players to register. People then started getting messages that the bot was stating that it could not PM them because of their settings, even though they had allowed messages turned on.

Apparently the bot had sent out to many PMs at once and discord quarantined it

"Bot Quarantined Your bot has been flagged by our anti-spam system for abusive behavior. While your bot is quarantined, it is unable to join any more guilds, or send any direct messages to users it has not messaged before"

Could registration be done in private threads? That only the person who was signing up and moderators see?

Conner-Anderson commented 1 month ago

I'm sorry that happened to you: ouch. Last I heard, Discord limits messages to 5 messages per 5 seconds. From my testing, it appeared that Discord's servers would queue actions above that limit so the only real consequence would be a delay. Unfortunately, I can't test a real situation with multiple users on my own, so this problem slipped past.

Discord bots cannot create private threads--I did look into it at one time. You also can't properly put response buttons on "ephemeral" messages in a normal channel. There are a few other options, but they all sucked in one way or another last I checked.

As for your current issue, I believe you could create a new bot with Discord to get around the quarantine and try again... but Discord might just look at the IP address. The problem could happen again, so I'll work on giving you a hot fix tonight, unless you've moved on to another system. Have you installed using the Express or the Advanced install?

Also, about how many users are you expecting? Most of my testing has been with 80-150 player games.

Conner-Anderson commented 1 month ago

Apparently, "All bots can make up to 50 requests per second to our API." https://discord.com/developers/docs/topics/rate-limits

Pycord, the library I'm using, is supposed to manage rate limits. I have no idea why it didn't here. Also, 50 requests per second is massive. If you just roll out the launch a bit softer, I expect you can avoid the issue until I find a solution. Also, I have accidentally run multiple copies of the bot on the same computer, which duplicated some things. Make sure you aren't doing that.

Conner-Anderson commented 1 month ago

Huh, actually, Discord may have changed its API and allowed bots to create private threads. This is good news. I'll investigate that.

Jermspace commented 1 month ago

Yea fully my bad for doing a hard launch there, didn't know that discord would ding it. I set up a second one and that one had a much slower trickle in and worked fine. (Though the good news is for the people it could work for under the stress it worked fine)

One @.everyone really gave me the run around

Jermspace commented 1 month ago

Sorry didn't see your top message up there just the last 2. I used the express install. And don't worry about rushing a hot fix, event for us is over but I'd say closer to 200-250 but never got a final number and we had a lot of people who didn't use discord at all.

Just wanted to report the problem!

Conner-Anderson commented 1 month ago

Cool, thanks. Yeah, I didn't know Discord would ding a hard launch either... I thought I had all that handled.

Thanks for making me take another look at threads: I'll probably switch over to that now that it's possible. A nicer solution all around, as far as I can tell.

Eventually, I'd appreciate some notes on how the bot worked out for you, apart from the Discord ban. I mostly developed it for the needs of my former school so it's useful to hear about another perspective. Everyone plays HvZ differently. It's totally possible to not use a digital system at all. You could just email me at conneranderson.dev@gmail.com