aboutsummaryrefslogtreecommitdiffstats
path: root/slack
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-10-14 17:25:10 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commita1fedfb2b173a2240a0a695dfe8bf38bca352f0a (patch)
tree2fbc88613f2771e57c4f31c74585d9ce4db82201 /slack
parent08f29b315dd3e3234357e4ffadea4b1334f2539a (diff)
downloadwee-slack-a1fedfb2b173a2240a0a695dfe8bf38bca352f0a.tar.gz
Add some repr methods for useful debug printing
Diffstat (limited to 'slack')
-rw-r--r--slack/slack_conversation.py3
-rw-r--r--slack/slack_message.py6
-rw-r--r--slack/slack_workspace.py2
3 files changed, 10 insertions, 1 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py
index 4a33989..ba76803 100644
--- a/slack/slack_conversation.py
+++ b/slack/slack_conversation.py
@@ -121,6 +121,9 @@ class SlackConversation(SlackBuffer):
info_response = await workspace.api.fetch_conversations_info(conversation_id)
return cls(workspace, info_response["channel"])
+ def __repr__(self):
+ return f"{self.__class__.__name__}({self.workspace}, {self.id})"
+
@property
def id(self) -> str:
return self._info["id"]
diff --git a/slack/slack_message.py b/slack/slack_message.py
index 21402dd..c1953d3 100644
--- a/slack/slack_message.py
+++ b/slack/slack_message.py
@@ -180,6 +180,9 @@ class PendingMessageItem:
self.item_id = item_id
self.display_type: Literal["mention", "chat"] = display_type
+ def __repr__(self):
+ return f"{self.__class__.__name__}({self.message}, {self.item_type}, {self.item_id}, {self.display_type})"
+
async def resolve(self) -> str:
if self.item_type == "conversation":
conversation = await self.message.workspace.conversations[self.item_id]
@@ -254,6 +257,9 @@ class SlackMessage:
)
self._deleted = False
+ def __repr__(self):
+ return f"{self.__class__.__name__}({self.conversation}, {self.ts})"
+
@property
def workspace(self) -> SlackWorkspace:
return self.conversation.workspace
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py
index 1b60013..76c8350 100644
--- a/slack/slack_workspace.py
+++ b/slack/slack_workspace.py
@@ -195,7 +195,7 @@ class SlackWorkspace:
self.usergroups = SlackUsergroups(self)
def __repr__(self):
- return f"{self.__class__.__name__}('{self.name}')"
+ return f"{self.__class__.__name__}({self.name})"
@property
def token_type(self) -> Literal["oauth", "session", "unknown"]: