From 1da51ac60962ff8555d7a21ac62761ac2aa04796 Mon Sep 17 00:00:00 2001 From: douglascdev Date: Thu, 7 Dec 2023 21:21:24 -0300 Subject: [PATCH] Fix bugs caused by new features when changing channels --- CHANGELOG.md | 7 +------ hasherino/__main__.py | 5 ++--- hasherino/components/chat_container.py | 5 ++++- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1340c2..b9db495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,3 @@ Changes: -* Add 7tv emote support -* Add twitch emote support -* Add chat completion for twitch emotes -* Add chat completion for 7tv emotes -* Save settings and log on the right user folder for each OS -* Fix light theme text +* Fix bugs caused by new features when changing channels diff --git a/hasherino/__main__.py b/hasherino/__main__.py index 5240a28..df0c0b1 100644 --- a/hasherino/__main__.py +++ b/hasherino/__main__.py @@ -134,10 +134,9 @@ async def message_received(self, message: ParsedMessage): case Command.PRIVMSG: author: str = message.get_author_displayname() stv_emotes = await self.memory_storage.get("7tv_emotes") + channel = await self.persistent_storage.get("channel") channel_emotes = ( - stv_emotes[await self.persistent_storage.get("channel")] - if stv_emotes - else {} + stv_emotes[channel] if stv_emotes and channel in stv_emotes else {} ) await self.chat_container_on_msg( diff --git a/hasherino/components/chat_container.py b/hasherino/components/chat_container.py index 5415d10..4679838 100644 --- a/hasherino/components/chat_container.py +++ b/hasherino/components/chat_container.py @@ -71,7 +71,10 @@ async def add_author_to_user_list(self, author: str): # Get existing list from memory or initialize a new one if user_list := await self.memory_storage.get("channel_user_list"): - user_list[tab_name].append(author) + if tab_name in user_list: + user_list[tab_name].append(author) + else: + user_list[tab_name] = [author] else: user_list = {tab_name: [author]} diff --git a/pyproject.toml b/pyproject.toml index ee6e35c..74149d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "hasherino" description = "hasherino is a twitch chat client built using flet" -version = "0.1.10" +version = "0.1.11" authors = [ { name = "Douglas", email = "hashy.software@gmail.com" } ]