aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--slack/register.py4
-rw-r--r--slack/slack_conversation.py8
-rw-r--r--slack/slack_message.py2
-rw-r--r--slack/slack_user.py2
-rw-r--r--slack/weechat_config.py9
5 files changed, 12 insertions, 13 deletions
diff --git a/slack/register.py b/slack/register.py
index d77163b..d45fc41 100644
--- a/slack/register.py
+++ b/slack/register.py
@@ -70,7 +70,7 @@ def modifier_input_text_display_with_cursor_cb(
def typing_self_cb(data: str, signal: str, signal_data: str) -> int:
- if not shared.config.look.typing_status_self.value:
+ if not shared.config.look.typing_status_self:
return weechat.WEECHAT_RC_OK
conversation = get_conversation_from_buffer_pointer(signal_data)
@@ -91,7 +91,7 @@ async def init_async():
if auto_connect:
await sleep(1) # Defer auto connect to ensure the logger plugin is loaded
for workspace in shared.workspaces.values():
- if workspace.config.autoconnect.value:
+ if workspace.config.autoconnect:
run_async(workspace.connect())
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py
index 7d44fba..1d89eae 100644
--- a/slack/slack_conversation.py
+++ b/slack/slack_conversation.py
@@ -416,11 +416,7 @@ class SlackConversation:
async def nicklist_add_user(self, user_id: str):
user = await self.workspace.users[user_id]
# TODO: weechat.color.nicklist_away
- color = (
- user.nick_color()
- if shared.config.look.color_nicks_in_nicklist.value
- else ""
- )
+ color = user.nick_color() if shared.config.look.color_nicks_in_nicklist else ""
weechat.nicklist_add_nick(
self.buffer_pointer, "", user.nick(), color, "", "", 1
)
@@ -492,7 +488,7 @@ class SlackConversation:
await self.rerender_message(message)
async def typing_add_user(self, user_id: str, thread_ts: Optional[str]):
- if not shared.config.look.typing_status_nicks.value:
+ if not shared.config.look.typing_status_nicks:
return
if not thread_ts:
diff --git a/slack/slack_message.py b/slack/slack_message.py
index d919cde..3537e1d 100644
--- a/slack/slack_message.py
+++ b/slack/slack_message.py
@@ -477,7 +477,7 @@ class SlackMessage:
assert_never(shared.config.look.render_emoji_as.value)
async def _create_reaction_string(self, reaction: SlackMessageReaction) -> str:
- if shared.config.look.display_reaction_nicks.value:
+ if shared.config.look.display_reaction_nicks:
# TODO: initialize_items?
users = await gather(
*(self.workspace.users[user_id] for user_id in reaction["users"])
diff --git a/slack/slack_user.py b/slack/slack_user.py
index 8e5bea5..c7ad0ae 100644
--- a/slack/slack_user.py
+++ b/slack/slack_user.py
@@ -23,7 +23,7 @@ def nick_color(nick: str) -> str:
# TODO: Probably need to do some mapping here based on the existing users, in case some has been changed to avoid duplicate names
def _name_from_user_info(workspace: SlackWorkspace, info: SlackUserInfo) -> str:
display_name = info["profile"].get("display_name")
- if display_name and not workspace.config.use_real_names.value:
+ if display_name and not workspace.config.use_real_names:
return display_name
return info["profile"].get("display_name") or info.get("real_name") or info["name"]
diff --git a/slack/weechat_config.py b/slack/weechat_config.py
index 6eab089..6e6cb85 100644
--- a/slack/weechat_config.py
+++ b/slack/weechat_config.py
@@ -86,13 +86,16 @@ class WeeChatOption(Generic[WeeChatOptionType]):
def __post_init__(self):
self._pointer = self._create_weechat_option()
+ def __bool__(self) -> bool:
+ return bool(self.value)
+
@property
def value(self) -> WeeChatOptionType:
if weechat.config_option_is_null(self._pointer):
if isinstance(self.parent_option, str):
parent_option_pointer = weechat.config_get(self.parent_option)
return option_get_value(parent_option_pointer, self.default_value)
- elif self.parent_option:
+ elif self.parent_option is not None:
return self.parent_option.value
return self.default_value
return option_get_value(self._pointer, self.default_value)
@@ -107,7 +110,7 @@ class WeeChatOption(Generic[WeeChatOptionType]):
return weechat.config_option_set(self._pointer, value, 1)
def value_set_null(self) -> int:
- if not self.parent_option:
+ if self.parent_option is None:
raise Exception(
f"Can't set null value for option without parent: {self.name}"
)
@@ -135,7 +138,7 @@ class WeeChatOption(Generic[WeeChatOptionType]):
return weechat.WEECHAT_RC_OK
def _create_weechat_option(self) -> str:
- if self.parent_option:
+ if self.parent_option is not None:
if isinstance(self.parent_option, str):
parent_option_name = self.parent_option
name = f"{self.name} << {parent_option_name}"