diff --git a/CHANGELOG.md b/CHANGELOG.md index 38b43c0b7e..eb7f5f664a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html); however, insignificant breaking changes do not guarantee a major version bump, see the reasoning [here](https://github.com/kyb3r/modmail/issues/319). If you're a plugin developer, note the "BREAKING" section. +# 3.7.2 + +### Added +- Added `mention_channel_id` to specify which channel `alert_on_mention` was being sent to ([GH #2880](https://github.com/kyb3r/modmail/issues/2880)) + # v3.7.1 ### Fixed diff --git a/bot.py b/bot.py index ffd0621ba5..363784147d 100644 --- a/bot.py +++ b/bot.py @@ -1,4 +1,4 @@ -__version__ = "3.7.1" +__version__ = "3.7.2" import asyncio @@ -252,6 +252,21 @@ def log_channel(self) -> typing.Optional[discord.TextChannel]: ) return None + @property + def mention_channel(self): + channel_id = self.config["mention_channel_id"] + if channel_id is not None: + try: + channel = self.get_channel(int(channel_id)) + if channel is not None: + return channel + except ValueError: + pass + logger.debug("MENTION_CHANNEL_ID was invalid, removed.") + self.config.remove("mention_channel_id") + + return self.log_channel + async def wait_for_connected(self) -> None: await self.wait_until_ready() await self._connected.wait() @@ -1002,7 +1017,7 @@ async def on_message(self, message): color=self.main_color, timestamp=datetime.utcnow(), ) - await self.log_channel.send(content=self.config["mention"], embed=em) + await self.mention_channel.send(content=self.config["mention"], embed=em) await self.process_commands(message) @@ -1504,6 +1519,14 @@ def main(): except ImportError: pass + # check discord version + if discord.__version__ != "1.5.2": + logger.error( + "Dependencies are not updated, run pipenv install. discord.py version expected 1.5.2, recieved %s", + discord.__version__, + ) + sys.exit(0) + bot = ModmailBot() bot.run() diff --git a/cogs/utility.py b/cogs/utility.py index a525c7b131..35fa482416 100644 --- a/cogs/utility.py +++ b/cogs/utility.py @@ -324,6 +324,7 @@ async def about(self, ctx): embed.add_field(name="Latency", value=f"{self.bot.latency * 1000:.2f} ms") embed.add_field(name="Version", value=f"`{self.bot.version}`") embed.add_field(name="Authors", value="`kyb3r`, `Taki`, `fourjr`") + embed.add_field(name="Hosting Method", value=self.bot.hosting_method.name) changelog = await Changelog.from_url(self.bot) latest = changelog.latest_version diff --git a/core/config.py b/core/config.py index 9aab61acf2..58061b8ae2 100644 --- a/core/config.py +++ b/core/config.py @@ -42,6 +42,7 @@ class ConfigManager: "plain_reply_without_command": False, # logging "log_channel_id": None, + "mention_channel_id": None, # threads "sent_emoji": "✅", "blocked_emoji": "🚫", diff --git a/core/config_help.json b/core/config_help.json index 32cc694f32..f935e8657c 100644 --- a/core/config_help.json +++ b/core/config_help.json @@ -174,6 +174,17 @@ "If the Modmail logging channel ended up being non-existent/invalid, no logs will be sent." ] }, + "mention_channel_id": { + "default": "Log Channel (normally `#bot-logs`)", + "description": "This is the channel where bot mentions are sent to.", + "examples": [ + "`{prefix}config set mention_channel_id 9234932582312` (9234932582312 is the channel ID)" + ], + "notes": [ + "This has no effect unless `alert_on_mention` is set to yes.", + "See also: `log_channel_id`" + ] + }, "sent_emoji": { "default": "✅", "description": "This is the emoji added to the message when when a Modmail action is invoked successfully (ie. DM Modmail, edit message, etc.).",