Skip to content

DM relay - minor fixes#1054

Merged
lemonsaurus merged 8 commits into
masterfrom
dm_relay
Jul 15, 2020
Merged

DM relay - minor fixes#1054
lemonsaurus merged 8 commits into
masterfrom
dm_relay

Conversation

@lemonsaurus
Copy link
Copy Markdown
Contributor

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 !reply without 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 !reply for 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:
image

Stats!

We're now incrementing dm_relay.dm_sent whenever we send a DM, and dm_relay.dm_received whenever we receive one. This should allow us to track how many DMs the bot sends and receives.

Leon Sandøy added 3 commits July 15, 2020 07:22
This reverts commit 042f472
Without this, it is difficult to know precisely who the user that is
DMing us is, which might be useful to us.

#1041
@lemonsaurus lemonsaurus added t: bug Something isn't working a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) p: 1 - high High Priority labels Jul 15, 2020
@lemonsaurus lemonsaurus requested a review from a team as a code owner July 15, 2020 05:47
@lemonsaurus lemonsaurus requested review from dementati and ikuyarihS and removed request for a team July 15, 2020 05:47
@ghost ghost added the needs 2 approvals label Jul 15, 2020
Comment thread bot/cogs/dm_relay.py Outdated
Comment thread bot/cogs/dm_relay.py Outdated
lemonsaurus and others added 4 commits July 15, 2020 10:15
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
Copy link
Copy Markdown
Contributor

@tagptroll1 tagptroll1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@ghost ghost removed the needs 1 approval label Jul 15, 2020
@lemonsaurus lemonsaurus merged commit 9f90a35 into master Jul 15, 2020
@lemonsaurus lemonsaurus deleted the dm_relay branch July 15, 2020 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) p: 1 - high High Priority t: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants