From 988c7770e2c70e0cdf8268dabb4ef6f02ce2ca99 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sun, 15 Jan 2023 14:18:37 +0100 Subject: Show nick suffix for bots --- typings/slack_api/slack_bots_info.pyi | 24 +++++++++++++++++++++++ typings/slack_api/slack_conversations_history.pyi | 24 +++++++++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 typings/slack_api/slack_bots_info.pyi (limited to 'typings/slack_api') diff --git a/typings/slack_api/slack_bots_info.pyi b/typings/slack_api/slack_bots_info.pyi new file mode 100644 index 0000000..0fb296f --- /dev/null +++ b/typings/slack_api/slack_bots_info.pyi @@ -0,0 +1,24 @@ +from typing import Dict, Literal, TypedDict, final + +from typing_extensions import NotRequired + +class SlackBotInfo(TypedDict): + id: str + deleted: bool + name: str + updated: int + app_id: str + user_id: NotRequired[str] + icons: Dict[str, str] + +@final +class SlackBotsInfoErrorResponse(TypedDict): + ok: Literal[False] + error: str + +@final +class SlackBotsInfoSuccessResponse(TypedDict): + ok: Literal[True] + bot: SlackBotInfo + +SlackBotInfoResponse = SlackBotsInfoSuccessResponse | SlackBotsInfoErrorResponse diff --git a/typings/slack_api/slack_conversations_history.pyi b/typings/slack_api/slack_conversations_history.pyi index 479fe50..b0220e3 100644 --- a/typings/slack_api/slack_conversations_history.pyi +++ b/typings/slack_api/slack_conversations_history.pyi @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import List, Literal, TypedDict, final +from typing import Dict, List, Literal, TypedDict, final from typing_extensions import NotRequired @@ -81,17 +81,21 @@ class SlackMessageFile(TypedDict): class SlackMessageCommon(TypedDict): type: Literal["message"] text: str - user: str ts: str reactions: NotRequired[List[SlackMessageReaction]] -class SlackMessageStandard(SlackMessageCommon): +class SlackMessageStandardCommon(SlackMessageCommon): client_msg_id: NotRequired[str] + user: str blocks: List[SlackMessageBlock] attachments: NotRequired[List[SlackMessageAttachment]] team: str -class SlackMessageThreadParentCommon(SlackMessageStandard): +@final +class SlackMessageStandard(SlackMessageStandardCommon): + pass + +class SlackMessageThreadParentCommon(SlackMessageStandardCommon): thread_ts: str reply_count: int reply_users_count: int @@ -108,21 +112,32 @@ class SlackMessageThreadParentSubscribed(SlackMessageThreadParentCommon): subscribed: Literal[True] last_read: str +@final class SlackMessageWithFiles(SlackMessageCommon): + user: str files: List[SlackMessageFile] upload: bool display_as_bot: bool # TODO: Add other subtypes +@final +class SlackMessageSubtypeBotMessage(SlackMessageCommon): + subtype: Literal["bot_message"] + bot_id: str + username: NotRequired[str] + icons: NotRequired[Dict[str, str]] + @final class SlackMessageSubtypeBotRemove(SlackMessageCommon): subtype: Literal["bot_remove"] + user: str bot_id: str bot_link: str @final class SlackMessageSubtypeBotAdd(SlackMessageCommon): subtype: Literal["bot_add"] + user: str bot_id: str bot_link: str @@ -136,6 +151,7 @@ SlackMessage = ( | SlackMessageThreadParentNotSubscribed | SlackMessageThreadParentSubscribed | SlackMessageWithFiles + | SlackMessageSubtypeBotMessage | SlackMessageSubtypeBotRemove | SlackMessageSubtypeBotAdd ) -- cgit