34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
|
|
from yuxi.channel.message.models import UnifiedMessage
|
||
|
|
from yuxi.channel.protocols import ReplyTransport, ThreadInfo
|
||
|
|
|
||
|
|
|
||
|
|
class SlackThreading:
|
||
|
|
def extract_thread_id(self, msg: UnifiedMessage) -> str | None:
|
||
|
|
if msg.group and msg.group.thread_id:
|
||
|
|
return msg.group.thread_id
|
||
|
|
return None
|
||
|
|
|
||
|
|
def resolve_reply_transport(self, msg: UnifiedMessage, thread_id: str | None) -> ReplyTransport:
|
||
|
|
if thread_id:
|
||
|
|
return ReplyTransport(mode="thread", thread_id=thread_id)
|
||
|
|
return ReplyTransport(mode="inline")
|
||
|
|
|
||
|
|
def get_thread_info(self, thread_id: str) -> ThreadInfo | None:
|
||
|
|
return ThreadInfo(thread_id=thread_id, is_threaded=True)
|
||
|
|
|
||
|
|
def resolve_reply_to_mode(self, config, account_id=None, chat_type=None) -> str:
|
||
|
|
if chat_type == "thread":
|
||
|
|
return "first"
|
||
|
|
return "all"
|
||
|
|
|
||
|
|
allow_explicit_reply_tags_when_off: bool = True
|
||
|
|
|
||
|
|
def build_tool_context(self, config, account_id, context, has_replied_ref=None) -> object | None:
|
||
|
|
return None
|
||
|
|
|
||
|
|
def resolve_auto_thread_id(self, config, account_id, to, tool_context=None, reply_to_id=None) -> str | None:
|
||
|
|
return None
|
||
|
|
|
||
|
|
def resolve_focused_binding(self, config, account_id, context) -> object | None:
|
||
|
|
return None
|