Help canceling a command

SShaLin2/24/2023
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
Solution
FFavna2/24/2023
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.
SShaLin2/24/2023
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
FFavna2/24/2023
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
FFavna2/25/2023
Marked my original message as the solution because ultimately that still does cover it.
AArarou2/26/2023
I recommend using a database for when reminders end and not using setTimeout since if the bot restarts the reminder is gone
SShaLin2/26/2023
Is there a specific database framework that you would recommend
FFavna2/26/2023
Prisma
AArarou2/26/2023
^
SSawako2/26/2023
mikro-orm

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
How to check if the bot has Permission X inside of the server? For example VIEW_AUDIT_LOGIn a listenerWhat parameter do I pass to the run method in my GuildCreate listener?Problem with this.container.stores.get().get();Code:InteractionCreate fileCan I easily create a listener for `interactionCreate`? I need it for some UI Abilities, and I am noHow to Create Threads?I dont get how to create threads programmatically. Please helpCommand infodoes sapphire have a built in command info funtions so we can get for example the aliases of a commaargs.pick("member")using `args.pick("member")`, is it intended to get the member even if you just provide 1 letter of twhy does this not work in sapphireindex.js ```js const { util } = require("./utils"); const { container } = require("@sapphire/framewoThis code is not running on sapphire```js const { Listener } = require("@sapphire/framework"); const { ActivityType } = require("discordBot stalls while registering commandsMy bot was working fine yesterday after noticing the new Cog section of the documentation (really coHow to edit an Embed(Documentation isn't working)Hi. Trying to make a discord bot that will send a message to a specific channel on startup. I have Schdeduler SQS Options in index.tsWhere can I find what options I have to pass for the SQS Version of the Scheduled Task? I cant seemType T[P] does not satisfy constraint Option<any>When building my project on my ubuntu server, with tsc, I get those errors, its more a TS issue thanWill using the new plugin-utilities-store enable HMR for this Helper files?As stated in the title: If i add some functions to the util store will they be reloaded on change wi"Send" does not exist on type "channel"Hi. Trying to make a discord bot that will send a message to a specific channel on startup. I try tHow can I create a listener for @discordjs/voice states?Title kinda explains itself lol, but how can I convert things like ```javascript const { VoiceConnecHow to delete interaction buttons?Hello@sapphire/shapeshift (?) crashes bot when trying to send embed with description exceeding 4096 charshi, so I have a message cmd which shows info on a github user in a nice embed. when bot sends the inuninstlling @sapphireHow do i uninstall this so that it stops loading as a dependency. I've run ```npm uninstall @sapphManual task not executingHiya, One of the tasks for a temp ban doesn't seem to execute after the amount of time I specified