ermcy
SIASapphire - Imagine a Framework
•Created by ermcy on 4/7/2025 in #sapphire-support
`Precondition` doubts.
Hi, I'm rewriting my bot from Rust's poise framework to Sapphire. In the rust version, there was a config parameter that let me run a check every time, a command is ran. These are regular commands and not slash commands aka
?avatar
. Is there anything similar for Sapphire where I can provide a function that will return either true
or false
to know if the command should be ran or not. Secondly, how do I handle preconditions that may take sometime to execute, something sort of a database lookup which may take from 50-300ms depending on the workload for the bot. I tried doing something like below
But I get the error that the interaction was already replied to. I don't see how I would send a defer reply when running the check and if the check passes, the command's chatInputRun
can use it
interaction response or if it fails pass that error to an external error handler and then respond inside that. Any help is much appreciated.21 replies