aboutsummaryrefslogtreecommitdiffstats
path: root/slack/weechat_config.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-08-20 12:20:55 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit60f560ef4d70350524514dfb5a516ec4e7c558f9 (patch)
tree4b892053087d87f19b71aad7572e94dbf151f647 /slack/weechat_config.py
parentb4c1ebeead35f84d50dee33a9bf6d314a84a3d86 (diff)
downloadwee-slack-60f560ef4d70350524514dfb5a516ec4e7c558f9.tar.gz
Fix default value True not working for options
Diffstat (limited to 'slack/weechat_config.py')
-rw-r--r--slack/weechat_config.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/slack/weechat_config.py b/slack/weechat_config.py
index c2f5b16..9db9625 100644
--- a/slack/weechat_config.py
+++ b/slack/weechat_config.py
@@ -1,13 +1,16 @@
from __future__ import annotations
from dataclasses import dataclass
-from typing import Callable, Generic, Optional, TypeVar, Union, cast
+from typing import TYPE_CHECKING, Callable, Generic, Optional, TypeVar, Union, cast
import weechat
from slack.shared import shared
from slack.util import get_callback_name
+if TYPE_CHECKING:
+ from typing_extensions import Literal
+
class WeeChatColor(str):
pass
@@ -111,7 +114,9 @@ class WeeChatOption(Generic[WeeChatOptionType]):
return weechat.config_option_set_null(self._pointer, 1)
@property
- def weechat_type(self) -> str:
+ def weechat_type(
+ self,
+ ) -> Literal["integer", "boolean", "color", "string"]:
if self.string_values:
return "integer"
if isinstance(self.default_value, bool):
@@ -150,13 +155,17 @@ class WeeChatOption(Generic[WeeChatOptionType]):
)
else:
name = self.name
- default_value = str(self.default_value)
+ default_value = (
+ str(self.default_value).lower()
+ if self.weechat_type == "boolean"
+ else str(self.default_value)
+ )
null_value_allowed = False
value = None
if shared.weechat_version < 0x3050000:
- default_value = str(self.default_value)
+ default_value = str(default_value)
value = default_value
return weechat.config_new_option(