From 9bec011dee4ef3f0968aa44d2459a9367d25313c Mon Sep 17 00:00:00 2001 From: sco1 Date: Sat, 29 Dec 2018 13:10:38 -0500 Subject: Add optional return to modlog post coro Enables generation of a context for AntiSpam to reference for posting infractions --- bot/cogs/modlog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py index 1d1546d5b..ef4544f81 100644 --- a/bot/cogs/modlog.py +++ b/bot/cogs/modlog.py @@ -123,7 +123,8 @@ class ModLog: if ping_everyone: content = "@everyone" - await self.bot.get_channel(channel_id).send(content=content, embed=embed, files=files) + log_message = await self.bot.get_channel(channel_id).send(content=content, embed=embed, files=files) + return self.bot.get_context(log_message) # Optionally return for use with antispam async def on_guild_channel_create(self, channel: GUILD_CHANNEL): if channel.guild.id != GuildConstant.id: -- cgit v1.2.3 From 9698cf42a22e0637c1afc21dbf3c8282829ccff0 Mon Sep 17 00:00:00 2001 From: sco1 Date: Sat, 29 Dec 2018 13:58:03 -0500 Subject: Add infraction posting for AntiSpam mutes --- bot/cogs/antispam.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bot/cogs/antispam.py b/bot/cogs/antispam.py index d5b72718c..052fd48b2 100644 --- a/bot/cogs/antispam.py +++ b/bot/cogs/antispam.py @@ -15,6 +15,7 @@ from bot.constants import ( Colours, DEBUG_MODE, Event, Guild as GuildConfig, Icons, Roles, ) +from bot.utils.moderation import post_infraction from bot.utils.time import humanize_delta @@ -133,7 +134,8 @@ class AntiSpam: mod_alert_message += f"{content}" - await self.mod_log.send_log_message( + # Return the mod log message Context that we can use to post the infraction + mod_log_message = await self.mod_log.send_log_message( icon_url=Icons.filtering, colour=Colour(Colours.soft_red), title=f"Spam detected!", @@ -143,28 +145,30 @@ class AntiSpam: ping_everyone=AntiSpamConfig.ping_everyone ) - await member.add_roles(self.muted_role, reason=reason) + # Post AntiSpam mute as a regular infraction so it can be reversed + ctx = await self.bot.get_context(mod_log_message) + response_object = await post_infraction(ctx, member, type="mute", reason=reason, duration=remove_role_after) + if response_object is None: + return # Appropriate error(s) are already raised by post_infraction + + self.mod_log.ignore(Event.member_update, member.id) + await member.add_roles(self._muted_role, reason=reason) + + loop = asyncio.get_event_loop() + infraction_object = response_object["infraction"] + self.schedule_task(loop, infraction_object["id"], infraction_object) + description = textwrap.dedent(f""" **Channel**: {msg.channel.mention} **User**: {msg.author.mention} (`{msg.author.id}`) **Reason**: {reason} Role will be removed after {human_duration}. """) - await self.mod_log.send_log_message( icon_url=Icons.user_mute, colour=Colour(Colours.soft_red), title="User muted", text=description ) - await asyncio.sleep(remove_role_after) - await member.remove_roles(self.muted_role, reason="AntiSpam mute expired") - - await self.mod_log.send_log_message( - icon_url=Icons.user_mute, colour=Colour(Colours.soft_green), - title="User unmuted", - text=f"Was muted by `AntiSpam` cog for {human_duration}." - ) - async def maybe_delete_messages(self, channel: TextChannel, messages: List[Message]): # Is deletion of offending messages actually enabled? if AntiSpamConfig.clean_offending: -- cgit v1.2.3 From 9e379f23528bef0faf4ffafbdd2470526bd78773 Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Sun, 6 Jan 2019 02:14:04 +0100 Subject: Adding 'rich embed' filter to filtering, 'embed'-support to modlog, and 'rich embed' filtering options to config --- bot/cogs/filtering.py | 73 ++++++++++++++++++++++++++++++++++++++++++++------- bot/cogs/modlog.py | 17 ++++++++++++ config-default.yml | 18 +++++++------ 3 files changed, 91 insertions(+), 17 deletions(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index 247ee26b8..f6a1e7b4d 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -45,6 +45,7 @@ class Filtering: "enabled": Filter.filter_zalgo, "function": self._has_zalgo, "type": "filter", + "content_only": True, "user_notification": Filter.notify_user_zalgo, "notification_msg": ( "Your post has been removed for abusing Unicode character rendering (aka Zalgo text). " @@ -55,6 +56,7 @@ class Filtering: "enabled": Filter.filter_invites, "function": self._has_invites, "type": "filter", + "content_only": True, "user_notification": Filter.notify_user_invites, "notification_msg": ( f"Per Rule 10, your invite link has been removed. {_staff_mistake_str}\n\n" @@ -65,20 +67,36 @@ class Filtering: "enabled": Filter.filter_domains, "function": self._has_urls, "type": "filter", + "content_only": True, "user_notification": Filter.notify_user_domains, "notification_msg": ( f"Your URL has been removed because it matched a blacklisted domain. {_staff_mistake_str}" ) }, + "filter_rich_embeds": { + "enabled": Filter.filter_rich_embeds, + "function": self._has_rich_embed, + "type": "filter", + "content_only": False, + "user_notification": Filter.notify_user_rich_embeds, + "notification_msg": ( + "Your post has been removed because it contained a rich embed. " + "This indicates that you're either using an unofficial discord client or are using a self-bot, " + "both of which violate Discord's Terms of Service.\n\n" + f"Please don't use a self-bot or an unofficial Discord client on our server. {_staff_mistake_str}" + ) + }, "watch_words": { "enabled": Filter.watch_words, "function": self._has_watchlist_words, "type": "watchlist", + "content_only": True, }, "watch_tokens": { "enabled": Filter.watch_tokens, "function": self._has_watchlist_tokens, "type": "watchlist", + "content_only": True, }, } @@ -115,18 +133,46 @@ class Filtering: ) # If we're running the bot locally, ignore role whitelist and only listen to #dev-test + # if DEBUG_MODE: + # filter_message = not msg.author.bot and msg.channel.id == Channels.devtest + if DEBUG_MODE: - filter_message = not msg.author.bot and msg.channel.id == Channels.devtest + filter_message = msg.author.id != 414020331980980234 and msg.channel.id == Channels.devtest # If none of the above, we can start filtering. if filter_message: + for filter_name, _filter in self.filters.items(): # Is this specific filter enabled in the config? if _filter["enabled"]: - triggered = await _filter["function"](msg.content) + # Does the filter only need the message content or the full message? + if _filter["content_only"]: + triggered = await _filter["function"](msg.content) + else: + triggered = await _filter["function"](msg) if triggered: + # If this is a filter (not a watchlist), we should delete the message. + if _filter["type"] == "filter": + try: + # Embeds (can) trigger both the `on_message` and `on_message_edit` + # event handlers, triggering filtering twice for the same message. + # + # If `on_message`-triggered filtering already deleted the message + # then `on_message_edit`-triggered filtering will raise exception + # since the message no longer exists. + # + # In addition, to avoid sending two notifications to the user, the + # logs, and mod_alert, we return if the message no longer exists. + await msg.delete() + except discord.errors.NotFound: + return + + # Notify the user if the filter specifies + if _filter["user_notification"]: + await self.notify_member(msg.author, _filter["notification_msg"], msg.channel) + if isinstance(msg.channel, DMChannel): channel_str = "via DM" else: @@ -153,13 +199,12 @@ class Filtering: ping_everyone=Filter.ping_everyone, ) - # If this is a filter (not a watchlist), we should delete the message. - if _filter["type"] == "filter": - await msg.delete() - - # Notify the user if the filter specifies - if _filter["user_notification"]: - await self.notify_member(msg.author, _filter["notification_msg"], msg.channel) + if filter_name == "filter_rich_embeds": + await self.mod_log.send_log_embeds( + embeds=msg.embeds, + content="The message contained the following embed(s):\n", + channel_id=Channels.mod_alerts, + ) break # We don't want multiple filters to trigger @@ -272,6 +317,16 @@ class Filtering: return True return False + @staticmethod + async def _has_rich_embed(msg: Message): + """ + Returns True if any of the embeds in the message + are of type 'rich', returns False otherwise + """ + if msg.embeds: + return any(embed.type == "rich" for embed in msg.embeds) + return False + async def notify_member(self, filtered_member: Member, reason: str, channel: TextChannel): """ Notify filtered_member about a moderation action with the reason str diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py index 0561b5afb..a167ba9e8 100644 --- a/bot/cogs/modlog.py +++ b/bot/cogs/modlog.py @@ -127,6 +127,23 @@ class ModLog: await self.bot.get_channel(channel_id).send(content=content, embed=embed, files=files) + async def send_log_embeds( + self, embeds: List[Embed], content: Optional[str], + channel_id: int = Channels.modlog, ping_everyone: bool = False, + ): + + if ping_everyone: + if content: + content = f"@everyone\n{content}" + else: + content = "@everyone" + + if content: + await self.bot.get_channel(channel_id).send(content=content) + + for embed in embeds: + await self.bot.get_channel(channel_id).send(embed=embed) + async def on_guild_channel_create(self, channel: GUILD_CHANNEL): if channel.guild.id != GuildConstant.id: return diff --git a/config-default.yml b/config-default.yml index ad87e44ac..ad3487c78 100644 --- a/config-default.yml +++ b/config-default.yml @@ -134,17 +134,19 @@ guild: filter: # What do we filter? - filter_zalgo: false - filter_invites: true - filter_domains: true - watch_words: true - watch_tokens: true + filter_zalgo: false + filter_invites: true + filter_domains: true + filter_rich_embeds: true + watch_words: true + watch_tokens: true # Notify user on filter? # Notifications are not expected for "watchlist" type filters - notify_user_zalgo: false - notify_user_invites: true - notify_user_domains: false + notify_user_zalgo: false + notify_user_invites: true + notify_user_domains: false + notify_user_rich_embeds: true # Filter configuration ping_everyone: true # Ping @everyone when we send a mod-alert? -- cgit v1.2.3 From d9130047e7fcbedd0e033c23c6b82f608cd9039b Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Sun, 6 Jan 2019 02:38:17 +0100 Subject: Restoring DEBUG_MODE filtering condition and adding comment --- bot/cogs/filtering.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index f6a1e7b4d..9324314df 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -133,11 +133,8 @@ class Filtering: ) # If we're running the bot locally, ignore role whitelist and only listen to #dev-test - # if DEBUG_MODE: - # filter_message = not msg.author.bot and msg.channel.id == Channels.devtest - if DEBUG_MODE: - filter_message = msg.author.id != 414020331980980234 and msg.channel.id == Channels.devtest + filter_message = not msg.author.bot and msg.channel.id == Channels.devtest # If none of the above, we can start filtering. if filter_message: @@ -199,6 +196,7 @@ class Filtering: ping_everyone=Filter.ping_everyone, ) + # If filtering rich embeds, also send the removed embeds to mod_alerts if filter_name == "filter_rich_embeds": await self.mod_log.send_log_embeds( embeds=msg.embeds, -- cgit v1.2.3 From 9f8e4774ae6eeac8cbcece8c65c8de390c3300fd Mon Sep 17 00:00:00 2001 From: sco1 Date: Sun, 6 Jan 2019 00:27:49 -0500 Subject: Antispam Infraction Fixes Add muted role object to cog attributes Fix unawaited coroutine in modlog Adjust modlog message ctx variable to be more explicit Fix duration being sent to API as integer instead of string Fix temporary infraction being placed into a nonexistent schedule, now placed into the moderation cog's task schedule --- bot/cogs/antispam.py | 15 +++++++++------ bot/cogs/modlog.py | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bot/cogs/antispam.py b/bot/cogs/antispam.py index 052fd48b2..cf52d30fa 100644 --- a/bot/cogs/antispam.py +++ b/bot/cogs/antispam.py @@ -45,7 +45,7 @@ WHITELISTED_ROLES = (Roles.owner, Roles.admin, Roles.moderator, Roles.helpers) class AntiSpam: def __init__(self, bot: Bot): self.bot = bot - self.muted_role = None + self._muted_role = Object(Roles.muted) @property def mod_log(self) -> ModLog: @@ -135,7 +135,7 @@ class AntiSpam: mod_alert_message += f"{content}" # Return the mod log message Context that we can use to post the infraction - mod_log_message = await self.mod_log.send_log_message( + mod_log_ctx = await self.mod_log.send_log_message( icon_url=Icons.filtering, colour=Colour(Colours.soft_red), title=f"Spam detected!", @@ -146,17 +146,20 @@ class AntiSpam: ) # Post AntiSpam mute as a regular infraction so it can be reversed - ctx = await self.bot.get_context(mod_log_message) - response_object = await post_infraction(ctx, member, type="mute", reason=reason, duration=remove_role_after) + response_object = await post_infraction( + mod_log_ctx, member, type="mute", reason=reason, duration=f"{remove_role_after}S" + ) if response_object is None: return # Appropriate error(s) are already raised by post_infraction self.mod_log.ignore(Event.member_update, member.id) await member.add_roles(self._muted_role, reason=reason) - loop = asyncio.get_event_loop() + # Insert ourselves into the moderation infraction loop infraction_object = response_object["infraction"] - self.schedule_task(loop, infraction_object["id"], infraction_object) + loop = asyncio.get_event_loop() + moderation_cog = self.bot.get_cog('Moderation') + moderation_cog.schedule_task(loop, infraction_object["id"], infraction_object) description = textwrap.dedent(f""" **Channel**: {msg.channel.mention} diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py index f36c431e6..9d26fa925 100644 --- a/bot/cogs/modlog.py +++ b/bot/cogs/modlog.py @@ -126,7 +126,7 @@ class ModLog: content = "@everyone" log_message = await self.bot.get_channel(channel_id).send(content=content, embed=embed, files=files) - return self.bot.get_context(log_message) # Optionally return for use with antispam + return await self.bot.get_context(log_message) # Optionally return for use with antispam async def on_guild_channel_create(self, channel: GUILD_CHANNEL): if channel.guild.id != GuildConstant.id: -- cgit v1.2.3 From 76951b4f1b0ada06b45f38271e6eb8c93ce8e51e Mon Sep 17 00:00:00 2001 From: sco1 Date: Sun, 6 Jan 2019 00:54:27 -0500 Subject: Invoke Moderation tempmute directly --- bot/cogs/antispam.py | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/bot/cogs/antispam.py b/bot/cogs/antispam.py index cf52d30fa..800700a50 100644 --- a/bot/cogs/antispam.py +++ b/bot/cogs/antispam.py @@ -1,22 +1,18 @@ -import asyncio import logging -import textwrap from datetime import datetime, timedelta from typing import List -from dateutil.relativedelta import relativedelta from discord import Colour, Member, Message, Object, TextChannel from discord.ext.commands import Bot from bot import rules +from bot.cogs.moderation import Moderation from bot.cogs.modlog import ModLog from bot.constants import ( AntiSpam as AntiSpamConfig, Channels, Colours, DEBUG_MODE, Event, Guild as GuildConfig, Icons, Roles, ) -from bot.utils.moderation import post_infraction -from bot.utils.time import humanize_delta log = logging.getLogger(__name__) @@ -111,8 +107,6 @@ class AntiSpam: # Sanity check to ensure we're not lagging behind if self.muted_role not in member.roles: remove_role_after = AntiSpamConfig.punishment['remove_after'] - duration_delta = relativedelta(seconds=remove_role_after) - human_duration = humanize_delta(duration_delta) mod_alert_message = ( f"**Triggered by:** {member.display_name}#{member.discriminator} (`{member.id}`)\n" @@ -145,32 +139,8 @@ class AntiSpam: ping_everyone=AntiSpamConfig.ping_everyone ) - # Post AntiSpam mute as a regular infraction so it can be reversed - response_object = await post_infraction( - mod_log_ctx, member, type="mute", reason=reason, duration=f"{remove_role_after}S" - ) - if response_object is None: - return # Appropriate error(s) are already raised by post_infraction - - self.mod_log.ignore(Event.member_update, member.id) - await member.add_roles(self._muted_role, reason=reason) - - # Insert ourselves into the moderation infraction loop - infraction_object = response_object["infraction"] - loop = asyncio.get_event_loop() - moderation_cog = self.bot.get_cog('Moderation') - moderation_cog.schedule_task(loop, infraction_object["id"], infraction_object) - - description = textwrap.dedent(f""" - **Channel**: {msg.channel.mention} - **User**: {msg.author.mention} (`{msg.author.id}`) - **Reason**: {reason} - Role will be removed after {human_duration}. - """) - await self.mod_log.send_log_message( - icon_url=Icons.user_mute, colour=Colour(Colours.soft_red), - title="User muted", text=description - ) + # Run a tempmute + await mod_log_ctx.invoke(Moderation.tempmute, member, f"{remove_role_after}S", reason=reason) async def maybe_delete_messages(self, channel: TextChannel, messages: List[Message]): # Is deletion of offending messages actually enabled? -- cgit v1.2.3 From 990a901d9a1d00340d401ea9f2c87f648056a144 Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Sun, 6 Jan 2019 20:48:20 +0100 Subject: Clarifying comment --- bot/cogs/filtering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index 9324314df..67ff9d0bf 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -153,7 +153,7 @@ class Filtering: # If this is a filter (not a watchlist), we should delete the message. if _filter["type"] == "filter": try: - # Embeds (can) trigger both the `on_message` and `on_message_edit` + # Embeds (can?) trigger both the `on_message` and `on_message_edit` # event handlers, triggering filtering twice for the same message. # # If `on_message`-triggered filtering already deleted the message -- cgit v1.2.3 From 5f4e617a98422a588e98e1e0d067e638877c5d65 Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 7 Jan 2019 19:45:57 +0100 Subject: Reverting modlog.py to original state --- bot/cogs/modlog.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py index a167ba9e8..0561b5afb 100644 --- a/bot/cogs/modlog.py +++ b/bot/cogs/modlog.py @@ -127,23 +127,6 @@ class ModLog: await self.bot.get_channel(channel_id).send(content=content, embed=embed, files=files) - async def send_log_embeds( - self, embeds: List[Embed], content: Optional[str], - channel_id: int = Channels.modlog, ping_everyone: bool = False, - ): - - if ping_everyone: - if content: - content = f"@everyone\n{content}" - else: - content = "@everyone" - - if content: - await self.bot.get_channel(channel_id).send(content=content) - - for embed in embeds: - await self.bot.get_channel(channel_id).send(embed=embed) - async def on_guild_channel_create(self, channel: GUILD_CHANNEL): if channel.guild.id != GuildConstant.id: return -- cgit v1.2.3 From fafa80ebcb29e4de5986a276ff85fb84e1d267be Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 7 Jan 2019 19:47:22 +0100 Subject: Modifying 'send_log_message' so it supports sending additional embeds to the specified (log) channel --- bot/cogs/modlog.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py index 0561b5afb..c96838a54 100644 --- a/bot/cogs/modlog.py +++ b/bot/cogs/modlog.py @@ -106,7 +106,7 @@ class ModLog: async def send_log_message( self, icon_url: Optional[str], colour: Colour, title: Optional[str], text: str, thumbnail: str = None, channel_id: int = Channels.modlog, ping_everyone: bool = False, - files: List[File] = None, content: str = None + files: List[File] = None, content: str = None, additional_embeds: List[Embed] = None, ): embed = Embed(description=text) @@ -125,7 +125,14 @@ class ModLog: else: content = "@everyone" - await self.bot.get_channel(channel_id).send(content=content, embed=embed, files=files) + channel = self.bot.get_channel(channel_id) + + await channel.send(content=content, embed=embed, files=files) + + if additional_embeds: + await channel.send("With the following embed(s):") + for additional_embed in additional_embeds: + await channel.send(embed=additional_embed) async def on_guild_channel_create(self, channel: GUILD_CHANNEL): if channel.guild.id != GuildConstant.id: -- cgit v1.2.3 From e3ace591d9dca2d4ab95c7b07d6af3e6fc84b7c3 Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 7 Jan 2019 19:51:16 +0100 Subject: Changing the way in which the filter_rich_embed sends the embeds to mod_log.send_log_message --- bot/cogs/filtering.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index 67ff9d0bf..5c6ed9c26 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -185,6 +185,8 @@ class Filtering: log.debug(message) + additional_embeds = msg.embeds if filter_name == "filter_rich_embeds" else None + # Send pretty mod log embed to mod-alerts await self.mod_log.send_log_message( icon_url=Icons.filtering, @@ -194,16 +196,10 @@ class Filtering: thumbnail=msg.author.avatar_url_as(static_format="png"), channel_id=Channels.mod_alerts, ping_everyone=Filter.ping_everyone, + additional_embeds=additional_embeds, ) # If filtering rich embeds, also send the removed embeds to mod_alerts - if filter_name == "filter_rich_embeds": - await self.mod_log.send_log_embeds( - embeds=msg.embeds, - content="The message contained the following embed(s):\n", - channel_id=Channels.mod_alerts, - ) - break # We don't want multiple filters to trigger @staticmethod -- cgit v1.2.3 From a78ac6d6e1661d2647dd61ca114ab695b5aa72af Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 7 Jan 2019 20:00:37 +0100 Subject: Including the filter_rich_embeds constants in bot/constants.py --- bot/constants.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bot/constants.py b/bot/constants.py index bbe6c1604..c1375bb13 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -201,6 +201,7 @@ class Filter(metaclass=YAMLGetter): filter_zalgo: bool filter_invites: bool filter_domains: bool + filter_rich_embeds: bool watch_words: bool watch_tokens: bool @@ -208,6 +209,7 @@ class Filter(metaclass=YAMLGetter): notify_user_zalgo: bool notify_user_invites: bool notify_user_domains: bool + notify_user_rich_embeds: bool ping_everyone: bool guild_invite_whitelist: List[int] -- cgit v1.2.3 From 543b2ae88c82fd5558785cee224680ff0285c7ad Mon Sep 17 00:00:00 2001 From: Daniel Brown Date: Mon, 7 Jan 2019 13:04:09 -0600 Subject: Corrected the delete_reminder() method to use the correct _delete_reminder method(). Signed-off-by: Daniel Brown --- bot/cogs/reminders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/cogs/reminders.py b/bot/cogs/reminders.py index f6ed111dc..ddf5cc1f3 100644 --- a/bot/cogs/reminders.py +++ b/bot/cogs/reminders.py @@ -398,7 +398,7 @@ class Reminders(Scheduler): ) if not failed: - self.cancel_reminder(response_data["reminder_id"]) + await self._delete_reminder(response_data["reminder_id"]) def setup(bot: Bot): -- cgit v1.2.3 From 16afa8d6cfa7ff70d73639ea3665bb47c5814586 Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 7 Jan 2019 20:44:00 +0100 Subject: Removing orphaned comment and restructuring user notification for filter_rich_embed --- bot/cogs/filtering.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index 5c6ed9c26..42424cd05 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -82,8 +82,8 @@ class Filtering: "notification_msg": ( "Your post has been removed because it contained a rich embed. " "This indicates that you're either using an unofficial discord client or are using a self-bot, " - "both of which violate Discord's Terms of Service.\n\n" - f"Please don't use a self-bot or an unofficial Discord client on our server. {_staff_mistake_str}" + f"both of which violate Discord's Terms of Service. {_staff_mistake_str}\n\n" + "Please don't use a self-bot or an unofficial Discord client on our server." ) }, "watch_words": { @@ -140,7 +140,6 @@ class Filtering: if filter_message: for filter_name, _filter in self.filters.items(): - # Is this specific filter enabled in the config? if _filter["enabled"]: # Does the filter only need the message content or the full message? @@ -199,7 +198,6 @@ class Filtering: additional_embeds=additional_embeds, ) - # If filtering rich embeds, also send the removed embeds to mod_alerts break # We don't want multiple filters to trigger @staticmethod -- cgit v1.2.3 From 84437e0ddfed04b87c4d98d47f432e5f7d2e136f Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 7 Jan 2019 20:45:37 +0100 Subject: Deleting unnecessary additional line --- bot/cogs/filtering.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index 42424cd05..570d6549f 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -138,7 +138,6 @@ class Filtering: # If none of the above, we can start filtering. if filter_message: - for filter_name, _filter in self.filters.items(): # Is this specific filter enabled in the config? if _filter["enabled"]: -- cgit v1.2.3 From 623923780bd5bb2aa1c9624e27faa20229c150a7 Mon Sep 17 00:00:00 2001 From: sco1 Date: Tue, 8 Jan 2019 13:40:04 -0500 Subject: Add RLBot to server whitelist Yay partners! --- config-default.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config-default.yml b/config-default.yml index ad87e44ac..4f4c79fa1 100644 --- a/config-default.yml +++ b/config-default.yml @@ -154,6 +154,7 @@ filter: - 267624335836053506 # Python Discord - 440186186024222721 # Python Discord: ModLog Emojis - 273944235143593984 # STEM + - 348658686962696195 # RLBot domain_blacklist: - pornhub.com -- cgit v1.2.3 From e9134a769b39e2cad58d03193d139760d3840bd7 Mon Sep 17 00:00:00 2001 From: sco1 Date: Tue, 8 Jan 2019 13:59:41 -0500 Subject: Add Pallets to server whitelist Yay partners! --- config-default.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config-default.yml b/config-default.yml index 4f4c79fa1..a51d00778 100644 --- a/config-default.yml +++ b/config-default.yml @@ -155,6 +155,7 @@ filter: - 440186186024222721 # Python Discord: ModLog Emojis - 273944235143593984 # STEM - 348658686962696195 # RLBot + - 531221516914917387 # Pallets domain_blacklist: - pornhub.com -- cgit v1.2.3 From e61a818b394a40185b934d67fe7a2a943edf81fc Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Wed, 9 Jan 2019 19:05:06 +0100 Subject: Patch to make \!help work outside of #bot-commands again. We should look into a proper rewrite later. --- bot/cogs/help.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bot/cogs/help.py b/bot/cogs/help.py index d30ff0dfb..c82a25417 100644 --- a/bot/cogs/help.py +++ b/bot/cogs/help.py @@ -9,11 +9,13 @@ from discord.ext import commands from fuzzywuzzy import fuzz, process from bot import constants +from bot.decorators import InChannelCheckFailure from bot.pagination import ( DELETE_EMOJI, FIRST_EMOJI, LAST_EMOJI, LEFT_EMOJI, LinePaginator, RIGHT_EMOJI, ) + REACTIONS = { FIRST_EMOJI: 'first', LEFT_EMOJI: 'back', @@ -427,7 +429,15 @@ class HelpSession: # see if the user can run the command strikeout = '' - can_run = await command.can_run(self._ctx) + + # Patch to make the !help command work outside of #bot-commands again + # This probably needs a proper rewrite, but this will make it work in + # the mean time. + try: + can_run = await command.can_run(self._ctx) + except InChannelCheckFailure: + can_run = False + if not can_run: # skip if we don't show commands they can't run if self._only_can_run: -- cgit v1.2.3 From 5dd611793c598508c5be8868725ca5400ad0c304 Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Fri, 11 Jan 2019 11:01:53 +0100 Subject: Using stronger language in the message and emphazising the 'strongly recommend' with bold --- bot/cogs/token_remover.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot/cogs/token_remover.py b/bot/cogs/token_remover.py index 8277513a7..c1a0e18ba 100644 --- a/bot/cogs/token_remover.py +++ b/bot/cogs/token_remover.py @@ -16,8 +16,9 @@ log = logging.getLogger(__name__) DELETION_MESSAGE_TEMPLATE = ( "Hey {mention}! I noticed you posted a seemingly valid Discord API " - "token in your message and have removed your message to prevent abuse. " - "We recommend regenerating your token regardless, which you can do here: " + "token in your message and have removed your message. " + "We **strongly recommend** regenerating your token as it's probably " + "been compromised. You can do that here: " "\n" "Feel free to re-post it with the token removed. " "If you believe this was a mistake, please let us know!" -- cgit v1.2.3