|
| 1 | +# Pyrofork - Telegram MTProto API Client Library for Python |
| 2 | +# Copyright (C) 2017-present Dan <https://github.com/delivrance> |
| 3 | +# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan> |
| 4 | +# |
| 5 | +# This file is part of Pyrofork. |
| 6 | +# |
| 7 | +# Pyrofork is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU Lesser General Public License as published |
| 9 | +# by the Free Software Foundation, either version 3 of the License, or |
| 10 | +# (at your option) any later version. |
| 11 | +# |
| 12 | +# Pyrofork is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU Lesser General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU Lesser General Public License |
| 18 | +# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + |
| 20 | +from pyrogram import raw |
| 21 | + |
| 22 | + |
| 23 | +class TranscribeAudio: |
| 24 | + """Transcribes the audio of a voice message. |
| 25 | + |
| 26 | + Parameters: |
| 27 | + transcription_id (``int``): |
| 28 | + Unique identifier of the transcription. |
| 29 | +
|
| 30 | + text (``str``): |
| 31 | + Transcribed text. |
| 32 | +
|
| 33 | + pending (``bool``, *optional*): |
| 34 | + Whether the transcription is pending. |
| 35 | +
|
| 36 | + trial_remains_num (``int``, *optional*): |
| 37 | + Number of trials remaining. |
| 38 | +
|
| 39 | + trial_remains_until_date (``int``, *optional*): |
| 40 | + Date the trial remains until. |
| 41 | + """ |
| 42 | + |
| 43 | + def __init__( |
| 44 | + self, |
| 45 | + *, |
| 46 | + transcription_id: int, |
| 47 | + text: str, |
| 48 | + pending: bool = None, |
| 49 | + trial_remains_num: int = None, |
| 50 | + trial_remains_until_date: int = None |
| 51 | + ): |
| 52 | + self.transcription_id = transcription_id |
| 53 | + self.text = text |
| 54 | + self.pending = pending |
| 55 | + self.trial_remains_num = trial_remains_num |
| 56 | + self.trial_remains_until_date = trial_remains_until_date |
| 57 | + |
| 58 | + @staticmethod |
| 59 | + def _parse(transcribe_result: "raw.types.messages.TranscribedAudio") -> "TranscribeAudio": |
| 60 | + return TranscribeAudio( |
| 61 | + transcription_id=transcribe_result.id, |
| 62 | + text=transcribe_result.text, |
| 63 | + pending=transcribe_result.pending, |
| 64 | + trial_remains_num=transcribe_result.trial_remains_num, |
| 65 | + trial_remains_until_date=transcribe_result.trial_remains_until_date |
| 66 | + ) |
0 commit comments