From 12ce8befda90d79ff3c1533770e38f865728482f Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 2 Oct 2023 00:19:45 +0200 Subject: Mark as read when switching away from buffer --- slack/slack_workspace.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'slack/slack_workspace.py') diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py index 59ac415..f202a86 100644 --- a/slack/slack_workspace.py +++ b/slack/slack_workspace.py @@ -50,6 +50,7 @@ if TYPE_CHECKING: from slack_api.slack_users_conversations import SlackUsersConversations from slack_api.slack_users_info import SlackUserInfo from slack_rtm.slack_rtm_message import SlackRtmMessage + from typing_extensions import Literal else: SlackBotInfo = object SlackConversationsInfo = object @@ -196,6 +197,15 @@ class SlackWorkspace: def __repr__(self): return f"{self.__class__.__name__}('{self.name}')" + @property + def token_type(self) -> Literal["oauth", "session", "unknown"]: + if self.config.api_token.value.startswith("xoxp-"): + return "oauth" + elif self.config.api_token.value.startswith("xoxc-"): + return "session" + else: + return "unknown" + @property def is_connected(self): return self._is_connected -- cgit