@@ -26,7 +26,7 @@ class ComposeTextWithAI:
2626 async def compose_text_with_ai (
2727 self : "pyrogram.Client" ,
2828 text : Union [str , "types.FormattedText" ],
29- translate_to_language_code : Optional [str ],
29+ translate_to_language_code : Optional [str ] = None ,
3030 style_name : Optional [str ] = None ,
3131 add_emojis : Optional [bool ] = None ,
3232 ) -> "types.FormattedText" :
@@ -44,6 +44,7 @@ async def compose_text_with_ai(
4444 "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",
4545 "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",
4646 "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"
47+ Defaults to the client's language code.
4748
4849 style_name (``str``, *optional*):
4950 Name of the style of the resulted text.
@@ -53,14 +54,24 @@ async def compose_text_with_ai(
5354
5455 Returns:
5556 :obj:`~pyrogram.types.FormattedText`: On success, information about the composed text is returned.
57+
58+ Example:
59+ .. code-block:: python
60+
61+ await app.compose_text_with_ai(
62+ "hello, how are you?",
63+ translate_to_language_code="ru",
64+ style_name="formal",
65+ add_emojis=True
66+ )
5667 """
5768 if isinstance (text , str ):
5869 text = types .FormattedText (text = text )
5970
6071 r = await self .invoke (
6172 raw .functions .messages .ComposeMessageWithAI (
6273 text = await text .write (self ),
63- translate_to_lang = translate_to_language_code ,
74+ translate_to_lang = translate_to_language_code or self . lang_code ,
6475 tone = raw .types .InputAiComposeToneDefault (tone = style_name ) if style_name else None ,
6576 emojify = add_emojis ,
6677 )
0 commit comments