diff --git a/bot.py b/bot.py index 7fc41b650d..b07727bd4e 100644 --- a/bot.py +++ b/bot.py @@ -1197,7 +1197,7 @@ async def on_message(self, message): await self.process_commands(message) - async def process_commands(self, message): + async def process_commands(self, message: discord.Message): if message.author.bot: return @@ -1231,7 +1231,12 @@ async def process_commands(self, message): or self.config.get("anon_reply_without_command") or self.config.get("plain_reply_without_command") ): - await thread.reply(message, anonymous=anonymous, plain=plain) + # Check to see if the message starts with the ignore prefix + if not message.content.startswith(self.config.get("ignore_prefix")): + await thread.reply(message, anonymous=anonymous, plain=plain) + else: + logger.debug("Message ignored because it started with the ignore_prefix.") + await self.api.append_log(message, type_="internal") else: await self.api.append_log(message, type_="internal") elif ctx.invoked_with: diff --git a/core/config.py b/core/config.py index b8bb35d40c..27c8c81263 100644 --- a/core/config.py +++ b/core/config.py @@ -39,6 +39,7 @@ class ConfigManager: "reply_without_command": False, "anon_reply_without_command": False, "plain_reply_without_command": False, + "ignore_prefix": "\0", # logging "log_channel_id": None, "mention_channel_id": None, diff --git a/core/config_help.json b/core/config_help.json index 80ebf1a48a..ad8bc059f9 100644 --- a/core/config_help.json +++ b/core/config_help.json @@ -195,6 +195,16 @@ "See also: `anon_reply_without_command`, `plain_reply_without_command`." ] }, + "ignore_prefix": { + "default": "\\0", + "description": "Messages that start with this prefix will be ignored by Modmail.", + "examples": [ + "`{prefix}config set ignore_prefix .`" + ], + "notes": [ + "`reply_without_command` must be enabled" + ] + }, "anon_reply_without_command": { "default": "Disabled", "description": "Setting this configuration will make all non-command messages sent in the thread channel to be anonymously forwarded to the recipient without the need of `{prefix}reply`.",