ralphkb / sentinel-tickets

Sentinel Tickets is a free and configurable open source discord ticket bot without watermarks or bloat.
https://sentineltickets.com
MIT License
35 stars 8 forks source link

database tweak #41

Closed mrkingtj closed 6 months ago

mrkingtj commented 6 months ago

Would it be possible for the database to be read incase of internet failure etc so open tickets arent affected when the bot restarts?

ralphkb commented 6 months ago

Hey, after a lot of testing I think I found the problem to be in the cache of discord.js which is not persistent when you restart the bot. The database works fine and is storing/reading data correctly regardless of bot restarts but the issue is that the method I use to fetch the user based on their ID relies on cache in this case.

So basically what happens is that if a ticket is left open and you restart the bot, the ticket will likely no longer work until the ticket creator interacts with the bot again such that the bot can cache it's information probably after using a command or creating another ticket.

This has been an issue for a while and I've been trying to find the root cause for some time but now I understand why it happens. I'll have to find a fix for it or try to retain that cache in another SQLite database so that the bot will function properly regardless of any restarts that may happen.

Hopefully I can push a commit with a fix for this soon when I have it sorted, thanks for reporting.

ralphkb commented 6 months ago

This is now fixed in the latest commit. a958367