From 44f35ec35818c8355766a08d586691be5d76d860 Mon Sep 17 00:00:00 2001 From: sco1 Date: Wed, 2 Jan 2019 20:32:59 -0500 Subject: Add identification of invite via DM --- bot/cogs/filtering.py | 9 +++++++-- 1 file 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}" ) -- cgit v1.2.3