diff options
author | 2021-03-28 12:12:41 -0400 | |
---|---|---|
committer | 2021-03-28 12:12:41 -0400 | |
commit | d36e179912242ea6c21a1d5e1a4485034a1b5343 (patch) | |
tree | 01375571c31fd490c58fa61a3b064caa7449422b | |
parent | Account for requesting the bot's DMs with itself. (diff) |
Force cache to update for user history.
Before, the user would have to send a DM to the bot after startup
for the bot to realize there is DM history with that specific user.
Now, we force a cache refresh when a moderator invokes `!dmrelay`,
so this shouldn't be an issue anymore.
-rw-r--r-- | bot/exts/moderation/dm_relay.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bot/exts/moderation/dm_relay.py b/bot/exts/moderation/dm_relay.py index ed1c45292..17316ff48 100644 --- a/bot/exts/moderation/dm_relay.py +++ b/bot/exts/moderation/dm_relay.py @@ -22,7 +22,14 @@ class DMRelay(Cog): """Relays the direct message history between the bot and given user.""" log.trace(f"Relaying DMs with {user.name} ({user.id})") - if self.bot.user == user or not user.dm_channel: + if self.bot.user == user: + await ctx.send(f"{Emojis.cross_mark} No direct message history with myself.") + return + + # Force cache to update + await user.history(limit=1).flatten() + + if not user.dm_channel: await ctx.send(f"{Emojis.cross_mark} No direct message history with {user.mention}.") return |