Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
We want the
/search
command to be recorded into the mongoldb client.Solution
Following the current convention for
slash_remove
andslash_delete
, we add the@log_command
decorator toslash_search
. Nowlog_command
is called to manage search commands.Next Steps
Since log_command decorator is used, this means that
log_command
is called prior toDiscordFS.locate
. This means thatctx.defer(hidden=kwargs.get("dm", False))
is called after the slash command has been saved to the data base bylog_command
. This can be an issue iflog_command
takes too long which will raise a time out error by the discord api (Top answer here).TLDR: Defering the msg should be called first before we store the command or anything else.