Running Async Code in Precinditions
I didn’t see this in the docs. But, is it possible to run async code in preconditions?
TLDR: I need to load a “guild configuration” from my database, which contains the ID of a role that the caller must (in the server) to be allowed to execute some command.
Long question is, users (server owners) of my bot must run a “setup” command, which will create a “GuildProfile” for their server before they are allowed to use any of the other commands. In my precondition, what I want to do is get the “GuildProfile” for the server and see if the caller of the command has the role specified in that profile. If so,
return this.ok()
. Otherwise, return this.error()
.
However, it doesn’t look like I can run async code in preconditions. So, is there a way to do so? Or am I gonna need to perform this check in the *Run()
method of my command?1 Reply
Solution
I’m blind. Yes you can. Just found it in the docs. lol