From df72d752c114b5e1c970ff791699c1cf7b58ac08 Mon Sep 17 00:00:00 2001 From: AlberLC Date: Sun, 26 May 2024 09:07:00 +0200 Subject: [PATCH] Fix channel heating (level 0 channel name) --- flanabot/bots/flana_disc_bot.py | 5 +++-- flanabot/models/heating_context.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/flanabot/bots/flana_disc_bot.py b/flanabot/bots/flana_disc_bot.py index 4545f0d..99be01a 100644 --- a/flanabot/bots/flana_disc_bot.py +++ b/flanabot/bots/flana_disc_bot.py @@ -81,8 +81,9 @@ class FlanaDiscBot(DiscordBot, FlanaBot): if channel.members: heating_context.heat_level += 0.5 else: - if not heating_context.heat_level: + if heating_context.heat_level == -1: return + heating_context.heat_level -= 0.5 if heating_context.heat_level > len(constants.DISCORD_HEAT_NAMES) - 1: heating_context.heat_level = float(int(heating_context.heat_level)) @@ -91,7 +92,7 @@ class FlanaDiscBot(DiscordBot, FlanaBot): continue i = int(heating_context.heat_level) - if not i: + if i == -1: n_fires = 0 new_name = channels_data['C'].original_name elif i < len(constants.DISCORD_HEAT_NAMES): diff --git a/flanabot/models/heating_context.py b/flanabot/models/heating_context.py index 0e4e48a..8dd1f06 100644 --- a/flanabot/models/heating_context.py +++ b/flanabot/models/heating_context.py @@ -16,4 +16,4 @@ class ChannelData: class HeatingContext: channels_data: dict[str, ChannelData] = field(default_factory=dict) is_active: bool = False - heat_level: float = 0.0 + heat_level: float = -1