store /search command in mongo db#101
Open
ThomasWu931 wants to merge 1 commit intodhrumilp15:mainfrom
Open
Conversation
Owner
|
Sounds good - we've refactored a lot of the metrics logging to the discord server itself (no more space in mongodb, but mongodb is better to store more information). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
/searchcommand to be recorded into the mongoldb client.Solution
Following the current convention for
slash_removeandslash_delete, we add the@log_commanddecorator toslash_search. Nowlog_commandis called to manage search commands.Next Steps
Since log_command decorator is used, this means that
log_commandis 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_commandtakes 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.