synzen / MonitoRSS

MonitoRSS RSS bot (formerly known as Discord.RSS) with customizable feeds. https://monitorss.xyz
https://monitorss.xyz
MIT License
1.05k stars 238 forks source link

Guild/feeds are removed when server becomes temporarily unavailable #52

Closed dbgrigsby closed 6 years ago

dbgrigsby commented 6 years ago

I run this bot on a large server that for whatever reason, regularly disappears from the server sidebar on Discord. Some of the time when this happens, the guild and feed are deleted, and I need to readd them, even after the server reappears.

Logs of event:

[17:57:29.598] RSS Info: Finished default feed retrieval cycle. Cycle Time: 0.07s.
[18:12:29.595] RSS Info: Finished default feed retrieval cycle. Cycle Time: 0.06s.
[18:27:29.593] RSS Info: Finished default feed retrieval cycle. Cycle Time: 0.06s.
[18:41:24.885] Guild "/r/PathofExile" (Users: 37690) has been removed.
[18:41:24.887] RSS Info: Guild profile 174993814845521922.json (/r/PathofExile) deleted from sources folder.
[18:41:49.075] Guild "/r/PathofExile" (Users: 37540) has been added.
[18:42:29.532] RSS Info: Finished default feed retrieval cycle. No feeds to retrieve.
[18:57:29.532] RSS Info: Finished default feed retrieval cycle. No feeds to retrieve.
[19:12:29.532] RSS Info: Finished default feed retrieval cycle. No feeds to retrieve.
[19:27:29.533] RSS Info: Finished default feed retrieval cycle. No feeds to retrieve.

I'm the only one with permissions on the bot, and no commands were issued during this range. This output is created in https://github.com/synzen/Discord.RSS/blob/master/events/guildDelete.js , and is being called from the listener file, at https://github.com/synzen/Discord.RSS/blob/master/util/listeners.js#L24

I've temporarily solved the problem by making the json config file for the server unremovable by the user account running the bot, but this probably should be fixed.

When running the bot on many servers, perhaps as a public bot, this behavior makes sense, when a server is deleted or the bot kicked, removing the RSS feed makes sense. However, Discord servers simply are unavailable for minutes at a time, even an hour in extreme cases. There should be some sort of delay on the bot side that prevents this, I'm not sure what though.

synzen commented 6 years ago

Yeah I realized this some time after I started on the dev branch and is fixed there, but I just pushed a new config option to the master branch that lets you persist a guild's profile after it sees a guild removal (config.botSettings.persistGuildProfile). This should satisfy your needs, let me know if it doesn't.

dbgrigsby commented 6 years ago

Thanks! I pulled. I'll let you know if it ever fails!