From 35bc2e98583d3e04e9310ea3950549f64da7fb6d Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sun, 15 Oct 2023 16:07:49 +0200 Subject: Fix bug with setting bool config values --- slack/weechat_config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'slack') diff --git a/slack/weechat_config.py b/slack/weechat_config.py index 6e6cb85..9c0c098 100644 --- a/slack/weechat_config.py +++ b/slack/weechat_config.py @@ -102,9 +102,12 @@ class WeeChatOption(Generic[WeeChatOptionType]): @value.setter def value(self, value: WeeChatOptionType): - rc = self.value_set_as_str(str(value)) + value_str = ( + str(value).lower() if isinstance(self.default_value, bool) else str(value) + ) + rc = self.value_set_as_str(value_str) if rc == weechat.WEECHAT_CONFIG_OPTION_SET_ERROR: - raise Exception(f"Failed to value for option: {self.name}") + raise Exception(f"Failed to set value for option: {self.name}") def value_set_as_str(self, value: str) -> int: return weechat.config_option_set(self._pointer, value, 1) -- cgit