50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
|
||
|
|
|
||
|
|
if TYPE_CHECKING:
|
||
|
|
from yuxi.channels.models import ChannelResponse, DeliveryResult
|
||
|
|
|
||
|
|
|
||
|
|
class OutboundContext:
|
||
|
|
chat_id: str
|
||
|
|
content: str
|
||
|
|
media_url: str | None = None
|
||
|
|
reply_to_id: str | None = None
|
||
|
|
|
||
|
|
|
||
|
|
@runtime_checkable
|
||
|
|
class ChannelOutboundProtocol(Protocol):
|
||
|
|
async def send(self, response: ChannelResponse) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def send_media(self, chat_id: str, media_type: str, data: Any) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def edit_message(self, chat_id: str, msg_id: str, content: str) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def delete_message(self, chat_id: str, msg_id: str) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def send_reaction(self, chat_id: str, msg_id: str, emoji: str) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
def chunker(self, text: str, limit: int) -> list[str]: ...
|
||
|
|
|
||
|
|
@property
|
||
|
|
def chunker_mode(self) -> str: ...
|
||
|
|
|
||
|
|
@property
|
||
|
|
def text_chunk_limit(self) -> int: ...
|
||
|
|
|
||
|
|
@property
|
||
|
|
def delivery_mode(self) -> str: ...
|
||
|
|
|
||
|
|
def sanitize_text(self, text: str) -> str: ...
|
||
|
|
|
||
|
|
async def send_text(self, ctx: OutboundContext) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def send_media_url(self, ctx: OutboundContext) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def send_poll(self, ctx: OutboundContext) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def pin_message(self, chat_id: str, msg_id: str) -> DeliveryResult: ...
|
||
|
|
|
||
|
|
async def unpin_message(self, chat_id: str, msg_id: str) -> DeliveryResult: ...
|