Skip to content

Commit

Permalink
Fix flawed logic in config.get function
Browse files Browse the repository at this point in the history
  • Loading branch information
kyb3r committed Jan 16, 2019
1 parent edc7a28 commit 9ace0ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
3 changes: 2 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
SOFTWARE.
"""

__version__ = '2.4.4'
__version__ = '2.4.5'

import asyncio
import textwrap
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9ace0ab

Please sign in to comment.