xlash123 / KHUx-Discord-Bot

A Discord bot that will aid players in getting information about the mobile game Kingdom Hearts Union X.
12 stars 7 forks source link

Global rate limits preventing messages from being sent to all servers #33

Closed SaltCrowns closed 6 years ago

SaltCrowns commented 6 years ago

hello, recently we've been unable to receive any tweet updates from the official NA khux twitter account, my admins and I have to manually type !tweet get in order for the tweet to show up. Is it supposed to be like that or is it supposed to automatically post the tweet in real time, like in sync with the twitter?

[I wanna add, that have given the bot permissions, we have it in a khux notifications channel, we have the status that says its on, and we turn it on, and it confirms it's on, but it just doesn't retrieve any tweets at all. unless we manually do so.]

xlash123 commented 6 years ago

Sorry for the late reply.

Has this issue resolved on its own? Sometimes the bot will fail to automatically grab one Tweet, but then will somehow be able to get it the next day. If not, I'll look into it.

SaltCrowns commented 6 years ago

It's alright, I trusted there would be a response since you suggest for people to leave their questions here to resolve.

It's been very weird , through it the past 2 weeks its retrieved only 2 out of like 10 tweets. Once, only on time. And any other tweet times it doesn't. To this day, like yesterdays 2nd anniversary tweet didn't show up and we had to manually get it.

SaltCrowns commented 6 years ago

Like right now the two tweets for 2nd anni and april and it never brought them up ;;

SaltCrowns commented 6 years ago

For the first time ever khux bot was on time with this one. I'll keep my eye on it though.

SaltCrowns commented 6 years ago

Well I guess I should ask, is the bot supposed to be able to post every tweet that kh_ux_na tweets, or is it supposed to miss out on some tweet?

Because I'd prefer if it can do all the tweets in real time. It didnt post anything from this afternoon.

SaltCrowns commented 6 years ago

Well I guess I should ask, is the bot supposed to be able to post every tweet that kh_ux_na tweets, or is it supposed to miss out on some tweet?

Because I'd prefer if it can do all the tweets in real time. It didnt post anything from this afternoon.

xlash123 commented 6 years ago

It's supposed to receive every Tweet, checking every minute for new Tweets to post. I have noticed that on rare occasions it'll skip a Tweet, although I do not know why. With what you've said, it seems to be a more common occurrence than a rare one, which seems conflicting.

SaltCrowns commented 6 years ago

That is weird, and are we the only one with this issue? Maybe I should remove and reinenlist the bot again?

MahindraPersaud commented 6 years ago

I'm actually getting this error on my server as well. It doesn't seem to recover every tweet either and it doesn't seem to send uc reminders or lux reminders if I have a channel just for bot info and another for the commands. The tweets and reminders are supposed to go into bot info but won't for some reason.

xlash123 commented 6 years ago

I'm thinking the problem may lie deeper than simply the logic behind grabbing Twitter updates. I'll do some more research into the problem.

xlash123 commented 6 years ago

I believe the bot is being affected by the Discord global rate limit, which restricts how much data the bot can send at one time. This never was an issue because the bot never used to have so many members, but now there are many servers (150+), and when it sends the data to all the servers, eventually it gets halted, so only so many servers receive the message.

I am currently working on finding a way to consider the rate limits.

SaltCrowns commented 6 years ago

Woahh interesting, hope it all works out!

MahindraPersaud commented 6 years ago

You can possibly try this. https://discordapp.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit

Check if you are being limited globally. If you are, have it try again in a minute or so? If not then just continue and get the tweets?

xlash123 commented 6 years ago

That's what I looked at when I determined this is likely the issue. I have a solution in mind, I just need to implement it and test it.

MahindraPersaud commented 6 years ago

Ahhh okay awesome. Also, if I night suggest something a !help command that displays all the commands and what and how to use them would be super helpful. I didn't see that in the command list sadly.

xlash123 commented 6 years ago

Huh. That's not in my command list in the readme, but it actually already exists!

Edit: I added it to the readme now.

xlash123 commented 6 years ago

I've just issued an update that (hopefully) will fix this issue. Let me know if you still experience problems.

SaltCrowns commented 6 years ago

Cool cool, we shall see Thursday tweet day.

SaltCrowns commented 6 years ago

So far so good with broom tweet. If Thursday tweet works on the dot. I'll come back here and let you know this case is closed on my end. 👍

MahindraPersaud commented 6 years ago

Steph did it work for you? The broom didn't work for me. I used the tweet command in a different channel to have it post to that channel and it's not appearing in that channel. I first used a command in another channel though is that affecting it? Meaning the tweets will only appear in the first channel I used a command in? I have one called #bot_info and #bot_commands. I set admin in bot commands the I did the tweet on in bot info and it says it'll post to bot info but I'm getting nothing sadly.

xlash123 commented 6 years ago

I’m just as clueless. I did get the Tweet last night, so obviously it did its job. Maybe for some reason it’s not setting the config? Run !tweet status and see if it returns a channel.

MahindraPersaud commented 6 years ago

image

Yep it does. I'll keep you updated tonight? Maybe it was just my permissions. I just changed them a bit so hopefully they work tonight.

xlash123 commented 6 years ago

The only permissions it should need is write access.

MahindraPersaud commented 6 years ago

Yea i think it was my permissions. It just posted the double lux reminder to the channel. I'll update you tonight?

SaltCrowns commented 6 years ago

I just got the emails, to reply to your question Mahindra, yeah I did get the broom tweet that time. We have a designated channel for it and make sure it tweets in there with the permissions.

I hope it does work out and keeping working in there for you. And I know for sure I'll keep yall updated tonight on Thursday tweet night. See yall in some hours.

MahindraPersaud commented 6 years ago

I believe it's working I got the stained glass banner from the na Twitter earlier today. Is it possible for lux and ux messages to be customized to say @everyone infront?

SaltCrowns commented 6 years ago

Alrighty, the Thursday Tweet day, has been successful. Thank you very much for working on this.

In my case, I consider it case closed, and a closed issue. You can close it on my behalf. since there was an interesting question about the @everyone feature.

SaltCrowns commented 6 years ago

You did a baller job, xlash123.

xlash123 commented 6 years ago

Thanks for reporting back. Glad to see this issue is fixed.

As for the lux/uc edits, see the !config command.