aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar sco1 <[email protected]>2019-01-02 20:32:59 -0500
committerGravatar sco1 <[email protected]>2019-01-02 20:32:59 -0500
commit44f35ec35818c8355766a08d586691be5d76d860 (patch)
tree96aee753c50af1413eca671a3930dca456a20b1a
parentAdd user notification on invite remove (diff)
Add identification of invite via DM
-rw-r--r--bot/cogs/filtering.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py
index 0c62be77e..8adde6312 100644
--- a/bot/cogs/filtering.py
+++ b/bot/cogs/filtering.py
@@ -1,7 +1,7 @@
import logging
import re
-from discord import Colour, Member, Message, TextChannel
+from discord import Colour, DMChannel, Member, Message, TextChannel
import discord.errors
from discord.ext.commands import Bot
@@ -126,10 +126,15 @@ class Filtering:
triggered = await _filter["function"](msg.content)
if triggered:
+ if isinstance(msg.channel, DMChannel):
+ channel_str = "via DM"
+ else:
+ channel_str = f"in <#{msg.channel.id}>"
+
message = (
f"The {filter_name} {_filter['type']} was triggered "
f"by **{msg.author.name}#{msg.author.discriminator}** "
- f"(`{msg.author.id}`) in <#{msg.channel.id}> with [the "
+ f"(`{msg.author.id}`) {channel_str} with [the "
f"following message]({msg.jump_url}):\n\n"
f"{msg.content}"
)