Skip to content

Commit

Permalink
pyrofork: fix Message.translate docs
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Sep 2, 2024
1 parent acd5ead commit cccfdb7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ def get_title_list(s: str) -> list:
Message.reply_web_page
Message.get_media_group
Message.react
Message.translate
Message.wait_for_click
""",
chat="""
Expand Down
22 changes: 15 additions & 7 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -5290,22 +5290,30 @@ async def translate(
to_language_code: str
) -> "types.TranslatedText":
"""Bound method *translate* of :obj:`~pyrogram.types.Message`.
Use as a shortcut for:
.. code-block:: python
await client.translate_message_text(
chat_id=message.chat.id,
message_ids=message_id,
to_language_code="en"
)
.. code-block:: python
await client.translate_message_text(
chat_id=message.chat.id,
message_ids=message_id,
to_language_code="en"
)
Example:
.. code-block:: python
await message.translate("en")
await Message.translate("en")
Parameters:
to_language_code (``str``):
Language code of the language to which the message is translated.
Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu".
Returns:
:obj:`~pyrogram.types.TranslatedText`: The translated result is returned.
Raises:
RPCError: In case of a Telegram RPC error.
"""
Expand Down

0 comments on commit cccfdb7

Please sign in to comment.