1616# You should have received a copy of the GNU Lesser General Public License
1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
19+ from typing import Optional
20+
1921import pyrogram
2022from pyrogram import raw , types
2123
@@ -25,7 +27,7 @@ async def summarize_message(
2527 self : "pyrogram.Client" ,
2628 chat_id : str ,
2729 message_id : int ,
28- translate_to_language_code : str ,
30+ translate_to_language_code : Optional [ str ] = None ,
2931 ) -> "types.FormattedText" :
3032 """Summarizes content of the message with non-empty summary_language_code.
3133
@@ -40,12 +42,13 @@ async def summarize_message(
4042 message_id (``int``):
4143 Identifier of the message.
4244
43- translate_to_language_code (``str``):
45+ translate_to_language_code (``str``, *optional* ):
4446 Language code of the language to which the message is translated.
4547 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",
4648 "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",
4749 "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",
4850 "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"
51+ Defaults to the client's language code.
4952
5053 Returns:
5154 :obj:`~pyrogram.types.FormattedText`: On success, information about the summarized text is returned.
@@ -54,7 +57,7 @@ async def summarize_message(
5457 raw .functions .messages .SummarizeText (
5558 peer = await self .resolve_peer (chat_id ),
5659 id = message_id ,
57- to_lang = translate_to_language_code
60+ to_lang = translate_to_language_code or self . lang_code
5861 )
5962 )
6063
0 commit comments