Skip to content

Commit 63461bb

Browse files
committed
add update_notifications, resolves #2896
1 parent fc086bf commit 63461bb

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ 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+
# v3.7.14-dev0
10+
11+
### Fixed
12+
13+
- Mentioned `competing` as an activity type ([PR #2902](https://github.com/kyb3r/modmail/pull/2902))
14+
15+
### Added
16+
17+
- `update_notifications` configuration option to toggle bot autoupdate notifications ([GH #2896](https://github.com/kyb3r/modmail/issues/2896))
18+
919
# v3.7.13
1020

1121
### Fixed

bot.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.7.13"
1+
__version__ = "3.7.14-dev0"
22

33

44
import asyncio
@@ -1502,7 +1502,8 @@ async def autoupdate(self):
15021502
)
15031503
logger.info("Bot has been updated.")
15041504
channel = self.log_channel
1505-
await channel.send(embed=embed)
1505+
if self.bot.config["update_notifications"]:
1506+
await channel.send(embed=embed)
15061507
else:
15071508
try:
15081509
# update fork if gh_token exists
@@ -1527,14 +1528,18 @@ async def autoupdate(self):
15271528
channel = self.update_channel
15281529
if self.hosting_method == HostingMethod.PM2:
15291530
embed = discord.Embed(title="Bot has been updated", color=self.main_color)
1530-
await channel.send(embed=embed)
1531+
embed.set_footer(text=f"Updating Modmail v{self.version} " f"-> v{latest.version}")
1532+
if self.bot.config["update_notifications"]:
1533+
await channel.send(embed=embed)
15311534
else:
15321535
embed = discord.Embed(
15331536
title="Bot has been updated and is logging out.",
15341537
description="If you do not have an auto-restart setup, please manually start the bot.",
15351538
color=self.main_color,
15361539
)
1537-
await channel.send(embed=embed)
1540+
embed.set_footer(text=f"Updating Modmail v{self.version} " f"-> v{latest.version}")
1541+
if self.bot.config["update_notifications"]:
1542+
await channel.send(embed=embed)
15381543
await self.logout()
15391544

15401545
async def before_autoupdate(self):

core/config.py

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class ConfigManager:
4444
"log_channel_id": None,
4545
"mention_channel_id": None,
4646
"update_channel_id": None,
47+
# updates
48+
"update_notifications": True,
4749
# threads
4850
"sent_emoji": "✅",
4951
"blocked_emoji": "🚫",
@@ -171,6 +173,7 @@ class ConfigManager:
171173
"data_collection",
172174
"enable_eval",
173175
"disable_autoupdates",
176+
"update_notifications",
174177
"thread_contact_silently",
175178
}
176179

core/config_help.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,21 @@
192192
"`{prefix}config set update_channel_id 9234932582312` (9234932582312 is the channel ID)"
193193
],
194194
"notes": [
195-
"This has no effect unless `disable_autoupdates` is set to no.",
195+
"This has no effect unless `disable_autoupdates` is set to no and `update_notifications` is set to yes.",
196196
"See also: `log_channel_id`"
197197
]
198198
},
199+
"update_notifications": {
200+
"default": "Yes",
201+
"description": "This is the channel where update notifications are sent to.",
202+
"examples": [
203+
"`{prefix}config set update_notifications no"
204+
],
205+
"notes": [
206+
"This has no effect unless `disable_autoupdates` is set to no.",
207+
"See also: `update_channel_id`"
208+
]
209+
},
199210
"sent_emoji": {
200211
"default": "",
201212
"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)