From 9ace0abd9c6811665901638a134ada0d7c3857f0 Mon Sep 17 00:00:00 2001 From: kyb3r Date: Wed, 16 Jan 2019 17:14:24 +1100 Subject: [PATCH] Fix flawed logic in config.get function --- CHANGELOG.md | 6 ++++++ bot.py | 3 ++- core/config.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a20d4b5fd..2c98d2ed83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +# v2.4.5 + +### Fixed +Fixed activity setting due to flawed logic in `config.get` function. + # v2.4.4 ### Fixed Fixed a bug in activity command where it would fail to set the activity on bot restart if the activity type was `playing` diff --git a/bot.py b/bot.py index bc3dba675e..c630e44366 100644 --- a/bot.py +++ b/bot.py @@ -22,7 +22,7 @@ SOFTWARE. """ -__version__ = '2.4.4' +__version__ = '2.4.5' import asyncio import textwrap @@ -179,6 +179,7 @@ async def on_connect(self): activity_type = self.config.get('activity_type') message = self.config.get('activity_message') + if activity_type is not None and message: url = self.config.get('twitch_url', 'https://www.twitch.tv/discord-modmail/') if activity_type == ActivityType.streaming else None activity = discord.Activity(type=activity_type, name=message, diff --git a/core/config.py b/core/config.py index 7f2bba4ad9..6086a55c2c 100644 --- a/core/config.py +++ b/core/config.py @@ -72,4 +72,4 @@ def __getitem__(self, key): return self.cache[key] def get(self, value, default=None): - return self.cache.get(value) or default + return self.cache.get(value, default)