My trouble begins from trying to get my bot to store and fetch reaction data from the embed properly between up/downtime. When my bot goes down and then comes back up again, all of my logging seems to imply the correct information as far as I’m able to read–the embed, its reactions, and the users responsible for them are being stored in database.sqlite
. They’re also being fetched properly according to the logs. But this is sort of proven wrong by virtue that the initial removal of a reaction is not logged and so, subsequently, a role is not removed when doing that. Adding the same reaction back is logged, but the role is not added because it was never removed to begin with. A subsequent second attempt to remove the reaction does log and does remove the role because, I guess, by that time, the bot is truly aware that there was a reaction to remove in the first place… but so then why does it pretend to be aware that a reaction exists upon restart? Why is it logged from the embed that there is an existing reaction, but it’s incapable of recognizing the removal of that reaction the first time?
Below is everything that is logged from initial startup (lots of logged info from up to 3 existing embeds for you to ignore), creation of a new embed via a new /roll
command, reacting to that embed, turning the bot off, turning the bot back on, removing the reaction I originally gave to the embed (not logged, as explained above), then re-adding that same reaction (logged but ineffective because the role was never removed from the reaction’s removal, as explained above), then–for good measure–removing and re-adding the reaction again to show that it all logs properly (and I can vouch that it functions correctly in those actions, too).
Please forgive some irrelevant log information from other commands and any spaghetti code. I’ve been round and round on this, so it’s not pretty.
- log: https://sourceb.in/Po6RUlhutU
// my command, which functions well up until the problem detailed above...
- ./commands/roles.js: https://sourceb.in/myjlXQXoGV
// my interaction events handler...
- ./events/interactionCreate.js: https://sourceb.in/9pM254j4Av
// my ready event, which plays a role in this mess, I'm sure...
- ./events/ready.js: https://sourceb.in/rsf99Q8Cuy
// my role handler, which also probably plays a role in the mess, I'm sure...
- ./utils/roleManager.js: https://sourceb.in/GXFYjn9wcJ
// my sqlite3 database file is at the root near my index...
- ./database.sqlite
// schema info...
- ./models/database.js: https://sourceb.in/fyI0fVCKN7
- ./models/embed.js: https://sourceb.in/PtEEwIVWo7
- ./models/reaction.js: https://sourceb.in/rsBipMjYQN
- ./models/user.js: https://sourceb.in/URDcRVfyHl
// my index and database sync files...
- ./index.js: https://sourceb.in/lfs0btrMTd
- ./syncdb.js: https://sourceb.in/O1azamh9TS