DM relay - minor fixes#1054
Merged
Merged
Conversation
added 3 commits
July 15, 2020 07:22
SebastiaanZ
reviewed
Jul 15, 2020
MarkKoz
approved these changes
Jul 15, 2020
Co-authored-by: Sebastiaan Zeeff <33516116+SebastiaanZ@users.noreply.github.com>
When we're using the !reply command, using a regular UserConverter is somewhat problematic. For example, if I wanted to send the message "lemon loves you", then I'd try to write `!reply lemon loves you` - however, the optional User converter would then try to convert `lemon` into a User, which it would successfully do since there's like 60 lemons on our server. As a result, the message "loves you" would be sent to a user called lemon.. god knows which one. To solve this bit of ambiguity, I introduce a new converter which only converts user mentions or user IDs into User, not strings that may be intended as part of the message you are sending. #1041
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.
This hotfix PR makes three minor changes - We restore user caching, add the user ID to the author name, and add some stats.
User caching
We previously had a feature to allow a
!replywithout specifying the target user. This was removed because we were afraid that the number of DMs would be so great that the risk of replying to the wrong user was high.As it turns out, this traffic is much lower than anticipated and the risk of replying to the wrong user appears to be low. That, coupled with the fact that we shouldn't really be using
!replyfor anything serious, has made me decide to restore this functionality.Adding the user ID to the username
When we get a DM, there's no actual user mention since it's relayed via a webhook. That means that a moderator would have to search for that user and figure out what their ID is in order to do stuff like infraction searches.
To make this easier, I'm adding the user ID to the author name:

Stats!
We're now incrementing
dm_relay.dm_sentwhenever we send a DM, anddm_relay.dm_receivedwhenever we receive one. This should allow us to track how many DMs the bot sends and receives.