Skip to content

Commit dd9e25e

Browse files
committed
check dpy v, mention_chnanel_id, resolves #2880
1 parent c5db7b9 commit dd9e25e

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
77
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.
88

9+
# 3.7.2
10+
11+
### Added
12+
- Added `mention_channel_id` to specify which channel `alert_on_mention` was being sent to ([GH #2880](https://github.com/kyb3r/modmail/issues/2880))
13+
914
# v3.7.1
1015

1116
### Fixed

bot.py

+25-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.7.1"
1+
__version__ = "3.7.2"
22

33

44
import asyncio
@@ -252,6 +252,21 @@ def log_channel(self) -> typing.Optional[discord.TextChannel]:
252252
)
253253
return None
254254

255+
@property
256+
def mention_channel(self):
257+
channel_id = self.config["mention_channel_id"]
258+
if channel_id is not None:
259+
try:
260+
channel = self.get_channel(int(channel_id))
261+
if channel is not None:
262+
return channel
263+
except ValueError:
264+
pass
265+
logger.debug("MENTION_CHANNEL_ID was invalid, removed.")
266+
self.config.remove("mention_channel_id")
267+
268+
return self.log_channel
269+
255270
async def wait_for_connected(self) -> None:
256271
await self.wait_until_ready()
257272
await self._connected.wait()
@@ -1002,7 +1017,7 @@ async def on_message(self, message):
10021017
color=self.main_color,
10031018
timestamp=datetime.utcnow(),
10041019
)
1005-
await self.log_channel.send(content=self.config["mention"], embed=em)
1020+
await self.mention_channel.send(content=self.config["mention"], embed=em)
10061021

10071022
await self.process_commands(message)
10081023

@@ -1504,6 +1519,14 @@ def main():
15041519
except ImportError:
15051520
pass
15061521

1522+
# check discord version
1523+
if discord.__version__ != "1.5.2":
1524+
logger.error(
1525+
"Dependencies are not updated, run pipenv install. discord.py version expected 1.5.2, recieved %s",
1526+
discord.__version__,
1527+
)
1528+
sys.exit(0)
1529+
15071530
bot = ModmailBot()
15081531
bot.run()
15091532

cogs/utility.py

+1
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ async def about(self, ctx):
324324
embed.add_field(name="Latency", value=f"{self.bot.latency * 1000:.2f} ms")
325325
embed.add_field(name="Version", value=f"`{self.bot.version}`")
326326
embed.add_field(name="Authors", value="`kyb3r`, `Taki`, `fourjr`")
327+
embed.add_field(name="Hosting Method", value=self.bot.hosting_method.name)
327328

328329
changelog = await Changelog.from_url(self.bot)
329330
latest = changelog.latest_version

core/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class ConfigManager:
4242
"plain_reply_without_command": False,
4343
# logging
4444
"log_channel_id": None,
45+
"mention_channel_id": None,
4546
# threads
4647
"sent_emoji": "✅",
4748
"blocked_emoji": "🚫",

core/config_help.json

+11
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@
174174
"If the Modmail logging channel ended up being non-existent/invalid, no logs will be sent."
175175
]
176176
},
177+
"mention_channel_id": {
178+
"default": "Log Channel (normally `#bot-logs`)",
179+
"description": "This is the channel where bot mentions are sent to.",
180+
"examples": [
181+
"`{prefix}config set mention_channel_id 9234932582312` (9234932582312 is the channel ID)"
182+
],
183+
"notes": [
184+
"This has no effect unless `alert_on_mention` is set to yes.",
185+
"See also: `log_channel_id`"
186+
]
187+
},
177188
"sent_emoji": {
178189
"default": "",
179190
"description": "This is the emoji added to the message when when a Modmail action is invoked successfully (ie. DM Modmail, edit message, etc.).",

0 commit comments

Comments
 (0)