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:
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.
Jump to solution
9 Replies
Solution
Favna
Favna16mo ago
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.
ShaLin
ShaLin16mo ago
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
Favna
Favna16mo ago
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
Favna
Favna16mo ago
Marked my original message as the solution because ultimately that still does cover it.
Ararou
Ararou16mo ago
I recommend using a database for when reminders end and not using setTimeout since if the bot restarts the reminder is gone
ShaLin
ShaLin16mo ago
Is there a specific database framework that you would recommend
Favna
Favna16mo ago
Prisma
Ararou
Ararou16mo ago
^
Sawako
Sawako16mo ago
mikro-orm