feat: add SST
This commit is contained in:
1 parent
51093da660
commit
bfd16ab02c
11 files changed
+196
-4
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from pyrogram import Client
|
||||
from pyrogram.errors import FloodPremiumWait, FloodWait, RPCError
|
||||
|
||||
from userbot.modules.capture.context import CaptureContext
|
||||
from userbot.modules.jobs.repository import enqueue
|
||||
from userbot.modules.stt.service import transcribe_message
|
||||
from utils.logging import logger
|
||||
|
||||
|
||||
async def safe_transcribe(
|
||||
client: Client, ctx: CaptureContext, chat_id: int, message_id: int
|
||||
) -> None:
|
||||
try:
|
||||
await transcribe_message(client, ctx, chat_id, message_id)
|
||||
except (FloodWait, FloodPremiumWait):
|
||||
await enqueue(
|
||||
ctx.pool,
|
||||
ctx.account_id,
|
||||
"transcribe",
|
||||
{"chat_id": chat_id, "message_id": message_id},
|
||||
)
|
||||
except RPCError as exc:
|
||||
logger.warning(f"[yellow]STT failed for {chat_id}/{message_id}: {exc}[/]")
|
||||
Reference in new issue
Block a user