24 lines
687 B
Python
24 lines
687 B
Python
from pyrogram import raw
|
|
|
|
from userbot import PyroClient
|
|
from userbot.modules.capture.chat_meta import meta_from_peer
|
|
from userbot.modules.stt import repository
|
|
|
|
HANDLES = (raw.types.UpdateTranscribedAudio,)
|
|
|
|
|
|
async def handle(
|
|
client: PyroClient,
|
|
update: raw.types.UpdateTranscribedAudio,
|
|
users: dict,
|
|
chats: dict,
|
|
) -> None:
|
|
ctx = client.capture
|
|
if ctx is None or not update.text:
|
|
return
|
|
meta = meta_from_peer(update.peer, chats, users, ctx.contacts.ids)
|
|
await repository.set_extracted_text(
|
|
ctx.pool, ctx.account_id, meta.chat_id, update.msg_id, update.text
|
|
)
|
|
await ctx.watches.on_text(meta.chat_id, update.msg_id, update.text)
|