aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_user.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2024-01-10 22:37:29 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:55 +0100
commitfa0001661c400327c4fdebeb226a08bcdb1a5fd1 (patch)
tree7915745a11f3c32494f202b736bec512177f7452 /slack/slack_user.py
parent5dff7099aee39f1a2881387c00c55a3ea1641997 (diff)
downloadwee-slack-fa0001661c400327c4fdebeb226a08bcdb1a5fd1.tar.gz
Fix bots with multiple names only being added once to nicklist
If a bot uses multiple nicks, we have to add all of them to the nicklist, so none of the nicks are shown as offline.
Diffstat (limited to 'slack/slack_user.py')
-rw-r--r--slack/slack_user.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/slack/slack_user.py b/slack/slack_user.py
index 2d3c6b6..07a87d2 100644
--- a/slack/slack_user.py
+++ b/slack/slack_user.py
@@ -15,6 +15,7 @@ if TYPE_CHECKING:
from slack_api.slack_conversations_history import SlackMessageUserProfile
from slack_api.slack_usergroups_info import SlackUsergroupInfo
from slack_api.slack_users_info import SlackProfile, SlackUserInfo
+ from typing_extensions import Literal
from slack.slack_workspace import SlackWorkspace
@@ -24,6 +25,10 @@ class Nick:
color: str
raw_nick: str
suffix: str
+ type: Literal["user", "bot", "unknown"]
+
+ def __hash__(self) -> int:
+ return hash(self.raw_nick)
def format(self, colorize: bool = False) -> str:
color = self.color if colorize else ""
@@ -67,6 +72,7 @@ def get_user_nick(
nick_color(nick, is_self),
nick,
suffix,
+ "user",
)
@@ -76,6 +82,7 @@ def get_bot_nick(nick: str) -> Nick:
nick_color(nick),
nick,
shared.config.look.bot_user_suffix.value,
+ "bot",
)