Skip to content

Commit

Permalink
silent_alert_on_mention, resolve #2907
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjr committed Dec 3, 2020
1 parent e8be5d1 commit d922683
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
9 changes: 7 additions & 2 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def run(self, *args, **kwargs):
intents = discord.Intents.default()
intents.members = True
# Try again with members intent
super().__init__(command_prefix=None, intents=intents) # implemented in `get_prefix`
self._connection._intents = intents
logger.warning("Attempting to login with only the server members privileged intent. Some plugins might not work correctly.")
try:
self.loop.run_until_complete(self.start(self.token))
Expand Down Expand Up @@ -1060,7 +1060,12 @@ async def on_message(self, message):
)
if self.config["show_timestamp"]:
em.timestamp = datetime.utcnow()
await self.mention_channel.send(content=self.config["mention"], embed=em)

if not self.config["silent_alert_on_mention"]:
content = self.config["mention"]
else:
content = ""
await self.mention_channel.send(content=content, embed=em)

await self.process_commands(message)

Expand Down
2 changes: 2 additions & 0 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class ConfigManager:
"close_on_leave": False,
"close_on_leave_reason": "The recipient has left the server.",
"alert_on_mention": False,
"silent_alert_on_mention": False,
"show_timestamp": True,
"anonymous_snippets": False,
# moderation
Expand Down Expand Up @@ -168,6 +169,7 @@ class ConfigManager:
"transfer_reactions",
"close_on_leave",
"alert_on_mention",
"silent_alert_on_mention",
"show_timestamp",
"confirm_thread_creation",
"use_regex_autotrigger",
Expand Down
15 changes: 13 additions & 2 deletions core/config_help.json
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,23 @@
},
"alert_on_mention": {
"default": "No",
"description": "Mentions all mods (mention) in logs channel when bot is mentioned",
"description": "Mentions all mods (mention) in mention channel when bot is mentioned",
"examples":[
"`{prefix}config set alert_on_mention yes`"
],
"notes": [
"See also: `mention`"
"See also: `mention`, `mention_channel_id`"
]
},
"silent_alert_on_mention": {
"default": "No",
"description": "Send a message in the mention channel without mentioning all mods (mention).",
"examples":[
"`{prefix}config set alert_on_mention yes`"
],
"notes": [
"This has no effect unless `alert_on_mention` is set to yes.",
"See also: `mention`, `mention_channel_id`"
]
},
"show_timestamp": {
Expand Down

0 comments on commit d922683

Please sign in to comment.