Only fetch changelog, when auto-updates are enabled

Fixes: #268
This commit is contained in:
Martin Weinelt 2021-05-13 17:58:34 +02:00
parent f36611f07b
commit 849a0a0843
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 4 additions and 3 deletions

View File

@ -79,7 +79,7 @@ port = 64738
# 'download_attempts': how many times the bot will try to download an item # 'download_attempts': how many times the bot will try to download an item
#download_attempts = 2 #download_attempts = 2
# 'auto_check_update': check for updates every time the bot starts # 'auto_check_update': check for updates every time the bot starts, post the changelog after an update was applied
#auto_check_update = True #auto_check_update = True
#pip3_path = venv/bin/pip #pip3_path = venv/bin/pip

View File

@ -190,8 +190,9 @@ class MumbleBot:
last_startup_version = var.db.get("bot", "version", fallback=None) last_startup_version = var.db.get("bot", "version", fallback=None)
if not last_startup_version or version.parse(last_startup_version) < version.parse(self.version): if not last_startup_version or version.parse(last_startup_version) < version.parse(self.version):
var.db.set("bot", "version", self.version) var.db.set("bot", "version", self.version)
changelog = util.fetch_changelog() if var.config.getboolean("bot", "auto_check_update"):
self.send_channel_msg(tr("update_successful", version=self.version, changelog=changelog)) changelog = util.fetch_changelog()
self.send_channel_msg(tr("update_successful", version=self.version, changelog=changelog))
# Set the CTRL+C shortcut # Set the CTRL+C shortcut
def ctrl_caught(self, signal, frame): def ctrl_caught(self, signal, frame):