Help canceling a command
Here the code I have for a simple reminder command.https://pastebin.com/crRSdjEn. It works but id like to be able to cancel a specific reminder / list the current active reminders. Can someone explain how the code is being run? My current thought would be that the class only has one instance but the async method can have multiple independent instances. How would I go about soring a list of all of the current reminders / canceling said reminders
Solution:Jump to solution
reminders like that won't work at all because you need to reply within 3 seconds and even if you defer then you need to reply within 15 minutes so a reminder could never be longer than that. You need to completely rework this and use a proper queuing/scheduling system, use an external database to store reminders and write some way to check if a reminder has expired and only then send it to the user.
9 Replies
Solution
reminders like that won't work at all because you need to reply within 3 seconds and even if you defer then you need to reply within 15 minutes so a reminder could never be longer than that. You need to completely rework this and use a proper queuing/scheduling system, use an external database to store reminders and write some way to check if a reminder has expired and only then send it to the user.
Im a bit confused now. I was able to make a reminder for 4 hours later and it worked perfectly, would that break if more than one reminder was made at a time?
I reply with a confirmation message
and then send a follow up ping at the set time
oh well anyway you should still not do reminders like this
and outside of returning or throwing an error you cannot cancel a command, but doing either of those would also kill the timer
Marked my original message as the solution because ultimately that still does cover it.
I recommend using a database for when reminders end and not using setTimeout since if the bot restarts the reminder is gone
Is there a specific database framework that you would recommend
Prisma
^
mikro-orm