-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bot not sending all messages, updating status, or updating channel topic #139
Comments
Bots are not allowed to change their statuses very often due to discord's api rate limit rules. If i recall correctly we have it hard coded to twice every thirty minutes. Channel topics are especially like this, as discord's rules only allow 5 changes per day as far as I know. Similarly here, you're getting ratelimited by messages and player events. This would cause the bot to stop responding to discord a couple minutes at a time. Usually, there's nothing we can do about that, as that's just how discord's api rules work. You need to ask your players not to spam messages, if possible. Read the logs of your server, or send them here next time the ratelimiting happens, so we can help tell you when exactly that has occured. |
The behavior does sound like ratelimits for sure, but then the next question is why. You would need to have some serious spamming going on, to use up all 50 requests per second. My guess would be a command or commands being spammed to your discord. The other reason could be, if you are sharing bot tokens across bots, or in some really rare cases, if your hosting provider has a lot of discord bots running on their server, sharing the same IP, you could all get global ratelimited by discord. Webhooks have much worse ratelimits, of 15 (I think) per minute, but the webhooks being ratelimited, shouldn't stop the other things on the bot from working |
My server has no one spamming or spamming commands. I also don't have the bot logging that either. I have at most, 5 people playing and sending like 10 messages within 5 minutes. I don't really know much about Discord bots, but my Discord bot token is only used for this Discord Minecraft Chat Bot. My server host provides dedicated IPs as well, so I am the only Discord bot for my IP. The bot can entirely stop working for the day randomly it seems even despite a server restart. For example today/currently: There you can see events like logging in and out are missing and the bot's status is also missing. |
Something is preventing your bot from completing the startup process. Try running your server with debugging enabled, and see if it happens again. The debugging will spam your logs quite a bit more, but it should help us track down any issues. Additional, what host are you using for your server? |
I'll enable debug mode and see how things go then. I use Bloom for hosting. https://bloom.host/ |
Awesome, thanks. It's the first time we have a report from a bloom user, but not an uncommon issue. For some reason we can't replicate this issue to test potential fixes, or even figure out what the real cause is |
Restarted the server with debug mode enabled. Join / Disconnect messages don't seem to work nor do the channel topic and bot status updates. Player messages from in-game work. Messages sent via Discord don't get sent to Minecraft. |
about five seconds before the server suddenly considers itself not ready:
|
Yeah, so it's getting stuck in the cache loading stage. Interesting. The reason the player messages works, is because it uses webhooks, so it doesn't care that the cache is null |
@AllOutJay how accurately can you recreate this issue? Does it occur on every startup, or only every x amount? |
@hypherionmc I would say recently, it has been more frequent like an almost every day occurrence. Sometimes it naturally resolves itself and sometimes it goes back to not working. I restarted it again, and it still isn't playing nice. I feel like this has only started to occur back in October and it only has increasingly gotten worse. |
Round about the time there has been a spike in reports about this. I don't remember any massive code changes around that time that would cause this. Reason I'm asking, is I have an idea of where it gets stuck, but not sure why. I would need to send you a debug jar that adds some additional logging at the suspected points, so we can see what discord is doing |
Happy to do whatever I can to help diagnose! I thought it was strange that it eventually started to act, but I wasn't sure if something changed since October on the mod side or on the Discord side, which it seems like nothing should have changed. |
SimpleDiscordLink-Universal-3.2.2+release.2.jar.zip Sorry for the zip. GitHub does not like jar files |
It all appears to be working now. I did notice some funky stuff in the log, but I am not sure if that is just due to the debug jar.
|
That error is normal on servers that don't use access control. Keep an eye on it for when it happens again please. I am mostly interested in this: |
@hypherionmc It has been working fine the past few days, but it eventually broke today after a restart.
|
Fantastic (not that it broke, but that we now actually know where it's getting stuck). Basically, EDIT: I think I found the source of the bug. It's a little late now, but I'll push out a snapshot build later today. That will hopefully fix this issue once and for all |
@hypherionmc Glad to hear that this helped you identify the problem! I'll be on the lookout for the snapshot build. |
Thanks for your patience and help in identifying this as well. For some reason, it's never been possible for us to recreate this bug at all. The main issue is, that the event we rely on to know that the bot is now ready to start working, is the wrong one. My working theory on why we can't recreate it, is because the hardware we use for testing (local and server), is powerful enough to execute the code in such a way, that it works as we expect it to work. On shared hosting, the hardware itself is normally either overloaded, or under heavy load, making it possible for the bug to appear. Honestly, the bug should not have made it possible for the mod to work AT ALL |
Snapshot is out :) https://nightbloom.cc/project/sdlink/files/5KzOnxqE |
Installed the snapshot! Will let you know if I face any problems. |
After a successful week or so of using SimpleDiscordLink-Universal-3.2.2+release.2.jar, the issue came back :( Restarting the server did fix it afterwards
|
Can you tell me more or less what happens when this bug is usually triggered? Like what's the state of your server, what happens before the bug occurs etc? |
For today, it was working fine, but then I stopped the server to install updated mods. Upon booting it up after updating the mods, it was not working like before (status, channel topic, message from Discord to game). How I noticed is that a player got on 10 or so minutes after the restart, but no message was sent to the Discord channel. |
Odd..... Then I am out of ideas on this one. I think what I'm going to do, is add a flag if the bot connects, but is on that LOADING_SUBSYSTEMS state, then recheck after 5 seconds to see if it has changed. If after 10 seconds it has not, just force the bot to continue and hope that nothing breaks. I really can't imagine what else would cause this |
Implemented the checker. If the bot starts on that LOADING_SUBSYSTEMS state, it will check every 5 seconds to see if the bot has changed to ready. That way it can clear that loop, even if the event doesn't fire again
Edit: Previous link had a bug with the new spam checker. https://nightbloom.cc/project/sdlink/files/QS83Mer0 |
Installed it today. Will let you know if I face any issues. |
Information
Minecraft version: 1.21.4
Modloader: Fabric
Fabric loader version: 0.16.9
Environment: Multiplayer
Description
Some days, the bot does not send all messages that people on the server send, it could also be events like people joining, leaving, dying, etc; The bot doesn't always update its status on Discord, and it doesn't always update the channel topic. Not really sure why it does, but a temporary solution sometimes is restarting the server.
Config file: https://mclo.gs/kpMNHd5
The text was updated successfully, but these errors were encountered: