Discord.js bot’s reaction roles embeds do not work after bot restart

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

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật