Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add the message id to this log

await self.api.append_log(message, type_="internal")
else:
await self.api.append_log(message, type_="internal")
elif ctx.invoked_with:
Expand Down
1 change: 1 addition & 0 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions core/config_help.json
Original file line number Diff line number Diff line change
Expand Up @@ -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`.",
Expand Down