L iPL`dZddlmZddlmZmZmZddlmZddl m Z ddl m Z ddl mZddlmZmZdd lmZerdd lmZGd d e ZGd deZGddeZGddeZGdde ZGddeZGddeZGddeZGddeZGdde Zy) z9This module contains objects related to chat backgrounds.)Sequence) TYPE_CHECKINGFinalOptional) constants)Document)TelegramObject)enum)de_json_optionalparse_sequence_arg)JSONDict)Botc^eZdZUdZdZej jZeej e d< ej jZ eej e d< ej jZ eej e d< ddde d e effd Zedd ed e d ddffd ZxZS)BackgroundFillauBase class for Telegram BackgroundFill Objects. It can be one of: * :class:`telegram.BackgroundFillSolid` * :class:`telegram.BackgroundFillGradient` * :class:`telegram.BackgroundFillFreeformGradient` Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type` is equal. .. versionadded:: 21.2 Args: type (:obj:`str`): Type of the background fill. Can be one of: :attr:`~telegram.BackgroundFill.SOLID`, :attr:`~telegram.BackgroundFill.GRADIENT` or :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`. Attributes: type (:obj:`str`): Type of the background fill. Can be one of: :attr:`~telegram.BackgroundFill.SOLID`, :attr:`~telegram.BackgroundFill.GRADIENT` or :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`. typeSOLIDGRADIENTFREEFORM_GRADIENTN api_kwargsrrct||tjtj |||_|j f|_|jyNr) super__init__r get_memberrBackgroundFillTyper _id_attrs_freezeselfrr __class__s ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_chatbackground.pyrzBackgroundFill.__init__EE J/)E)EtTR )) databotrreturnc,|j|}|jt|jt|j t i}|tur8|jd|vr%||jdj||St|)||S,See :meth:`telegram.TelegramObject.de_json`.rr&r') _parse_datarBackgroundFillSolidrBackgroundFillGradientrBackgroundFillFreeformGradientrgetpopde_jsonrclsr&r'_class_mappingr"s r#r3zBackgroundFill.de_jsonRst$ II* LL0  ! !#A;  . TXXf%5%G!$((6"23;;3;O OwDc22r%N)__name__ __module__ __qualname____doc__ __slots__rrrr__annotations__rrstrrr r classmethodr3 __classcell__r"s@r#rr#s,I1:1M1M1S1SE5-- .S>4=4P4P4Y4YHeI001YA$$66uY99:K *.  X&  38 3(5/ 3EU 3 3r%rc<eZdZdZdZdddedeeffdZxZ S)r.a$ The background is filled using the selected color. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`color` is equal. .. versionadded:: 21.2 Args: color (:obj:`int`): The color of the background fill in the `RGB24` format. Attributes: type (:obj:`str`): Type of the background fill. Always :attr:`~telegram.BackgroundFill.SOLID`. color (:obj:`int`): The color of the background fill in the `RGB24` format. )colorNrrCrct||j||j5||_|jf|_dddy#1swYyxYwN)rr)rrr _unfrozenrCr)r!rCrr"s r#rzBackgroundFillSolid.__init__wsN djjZ@ ^^  +#DJ"jj]DN + + + AA r8r9r:r;r<intrr rr@rAs@r#r.r.cs5"I *. + +X& + +r%r.c DeZdZdZdZdddedededeeffd ZxZ S) r/a~ The background is a gradient fill. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`top_color`, :attr:`bottom_color` and :attr:`rotation_angle` are equal. .. versionadded:: 21.2 Args: top_color (:obj:`int`): Top color of the gradient in the `RGB24` format. bottom_color (:obj:`int`): Bottom color of the gradient in the `RGB24` format. rotation_angle (:obj:`int`): Clockwise rotation angle of the background fill in degrees; 0-:tg-const:`telegram.constants.BackgroundFillLimit.MAX_ROTATION_ANGLE`. Attributes: type (:obj:`str`): Type of the background fill. Always :attr:`~telegram.BackgroundFill.GRADIENT`. top_color (:obj:`int`): Top color of the gradient in the `RGB24` format. bottom_color (:obj:`int`): Bottom color of the gradient in the `RGB24` format. rotation_angle (:obj:`int`): Clockwise rotation angle of the background fill in degrees; 0-:tg-const:`telegram.constants.BackgroundFillLimit.MAX_ROTATION_ANGLE`. ) bottom_colorrotation_angle top_colorNrrMrKrLrct||j||j5||_||_||_|j|j |j f|_dddy#1swYyxYwrE)rrrrFrMrKrLr)r!rMrKrLrr"s r#rzBackgroundFillGradient.__init__ss dmm C ^^  V"+DN%1D '5D "nnd.?.?ATATUDN  V V Vs >A44A=rHrAs@r#r/r/sP6@I*. VVV V X& VVr%r/cBeZdZdZdZdddeedeeffdZ xZ S)r0a The background is a freeform gradient that rotates after every message in the chat. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`colors` is equal. .. versionadded:: 21.2 Args: colors (Sequence[:obj:`int`]): A list of the 3 or 4 base colors that are used to generate the freeform gradient in the `RGB24` format Attributes: type (:obj:`str`): Type of the background fill. Always :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`. colors (Sequence[:obj:`int`]): A list of the 3 or 4 base colors that are used to generate the freeform gradient in the `RGB24` format )colorsNrrPrct||j||j5t ||_|j f|_dddy#1swYyxYwrE)rrrrFr rPr)r!rPrr"s r#rz'BackgroundFillFreeformGradient.__init__sU d44L ^^  ,+=f+EDK"kk^DN , , ,s #AA") r8r9r:r;r<rrIrr rr@rAs@r#r0r0s9&I *. ,  ,X& , ,r%r0ceZdZUdZdZej jZeej e d< ej jZ eej e d< ej jZ eej e d< ej jZ eej e d< ddd e d eeffd Zedd ed edddffd ZxZS)BackgroundTypeaBase class for Telegram BackgroundType Objects. It can be one of: * :class:`telegram.BackgroundTypeFill` * :class:`telegram.BackgroundTypeWallpaper` * :class:`telegram.BackgroundTypePattern` * :class:`telegram.BackgroundTypeChatTheme`. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type` is equal. .. versionadded:: 21.2 Args: type (:obj:`str`): Type of the background. Can be one of: :attr:`~telegram.BackgroundType.FILL`, :attr:`~telegram.BackgroundType.WALLPAPER` :attr:`~telegram.BackgroundType.PATTERN` or :attr:`~telegram.BackgroundType.CHAT_THEME`. Attributes: type (:obj:`str`): Type of the background. Can be one of: :attr:`~telegram.BackgroundType.FILL`, :attr:`~telegram.BackgroundType.WALLPAPER` :attr:`~telegram.BackgroundType.PATTERN` or :attr:`~telegram.BackgroundType.CHAT_THEME`. rFILL WALLPAPERPATTERN CHAT_THEMENrrrct||tjtj |||_|j f|_|jyr) rrr rrBackgroundTypeTyperrrr s r#rzBackgroundType.__init__r$r%r&r'rr(c|j|}|jt|jt|j t |jti}|tur8|jd|vr%||jdj||Sd|vr#t|jdt||d<d|vr#t|jdt||d<t |1||S)r+rr,filldocument)r-rTBackgroundTypeFillrUBackgroundTypeWallpaperrVBackgroundTypePatternrWBackgroundTypeChatThemerSr1r2r3r rrrr4s r#r3zBackgroundType.de_json st$ HH( MM2 KK. NN3 ;  . TXXf%5%G!$((6"23;;3;O O T>+DHHV,rr rr?r3r@rAs@r#rSrSs4I090L0L0Q0QD% ,, -Q=5>5Q5Q5[5[IuY112[B3<3O3O3W3WGU9// 0W@6?6R6R6]6]Ji223]C *.  X& 383(5/3EU33r%rSc@eZdZdZdZdddededeeffdZ xZ S) r]a The background is automatically filled based on the selected colors. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`fill` and :attr:`dark_theme_dimming` are equal. .. versionadded:: 21.2 Args: fill (:class:`telegram.BackgroundFill`): The background fill. dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a percentage; 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`. Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.FILL`. fill (:class:`telegram.BackgroundFill`): The background fill. dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a percentage; 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`. )dark_theme_dimmingr[Nrr[rbrct||j||j5||_||_|j|j f|_dddy#1swYyxYwrE)rrrTrFr[rbr)r!r[rbrr"s r#rzBackgroundTypeFill.__init__>sc diiJ? ^^  B(,DI+=D #"ii)@)@ADN  B B Bs ,A""A+) r8r9r:r;r<rrIrr rr@rAs@r#r]r]$sD./I*. B B  B X& B Br%r]c ZeZdZdZdZ d dddededeedeed ee f fd Z xZ S) r^a The background is a wallpaper in the `JPEG` format. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`document` and :attr:`dark_theme_dimming` are equal. .. versionadded:: 21.2 Args: document (:class:`telegram.Document`): Document with the wallpaper dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a percentage; 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`. is_blurred (:obj:`bool`, optional): :obj:`True`, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12 is_moving (:obj:`bool`, optional): :obj:`True`, if the background moves slightly when the device is tilted Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.WALLPAPER`. document (:class:`telegram.Document`): Document with the wallpaper dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a percentage; 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`. is_blurred (:obj:`bool`): Optional. :obj:`True`, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12 is_moving (:obj:`bool`): Optional. :obj:`True`, if the background moves slightly when the device is tilted )rbr\ is_blurred is_movingNrr\rbrerfrct||j||j5||_||_||_||_|j|j f|_dddy#1swYyxYwrE) rrrUrFr\rbrerfr)r!r\rbrerfrr"s r#rz BackgroundTypeWallpaper.__init__psq dnnD ^^  F&.DM+=D #.8DO-6DN"mmT-D-DEDN F F Fs :A00A9NN) r8r9r:r;r<rrIrboolr rr@rAs@r#r^r^Nsq>NI &*$( F*.FF FTN F D> FX&FFr%r^c^eZdZdZdZ d dddedededee d ee d ee f fd Z xZ S) r_a The background is a ``.PNG`` or ``.TGV`` (gzipped subset of ``SVG`` with ``MIME`` type ``"application/x-tgwallpattern"``) pattern to be combined with the background fill chosen by the user. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`document` and :attr:`fill` and :attr:`intensity` are equal. .. versionadded:: 21.2 Args: document (:class:`telegram.Document`): Document with the pattern. fill (:class:`telegram.BackgroundFill`): The background fill that is combined with the pattern. intensity (:obj:`int`): Intensity of the pattern when it is shown above the filled background; 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_INTENSITY`. is_inverted (:obj:`int`, optional): :obj:`True`, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only. is_moving (:obj:`bool`, optional): :obj:`True`, if the background moves slightly when the device is tilted. Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.PATTERN`. document (:class:`telegram.Document`): Document with the pattern. fill (:class:`telegram.BackgroundFill`): The background fill that is combined with the pattern. intensity (:obj:`int`): Intensity of the pattern when it is shown above the filled background; 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_INTENSITY`. is_inverted (:obj:`int`): Optional. :obj:`True`, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only. is_moving (:obj:`bool`): Optional. :obj:`True`, if the background moves slightly when the device is tilted. )r\r[ intensity is_invertedrfNrr\r[rkrlrfrct||j||j5||_||_||_||_||_|j|j |j f|_ dddy#1swYyxYwrE) rrrVrFr\r[rkrlrfr)r!r\r[rkrlrfrr"s r#rzBackgroundTypePattern.__init__s| dllzB ^^  H&.DM(,DI"+DN/:D -6DN"mmTYYGDN H H Hs A BB rh) r8r9r:r;r<rrrIrrir rr@rAs@r#r_r_s|%NI'+$( H*.HHH H d^ H D> HX&HHr%r_c<eZdZdZdZdddedeeffdZxZ S)r`a3 The background is taken directly from a built-in chat theme. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`theme_name` is equal. .. versionadded:: 21.2 Args: theme_name (:obj:`str`): Name of the chat theme, which is usually an emoji. Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.CHAT_THEME`. theme_name (:obj:`str`): Name of the chat theme, which is usually an emoji. ) theme_nameNrrorct||j||j5||_|jf|_dddy#1swYyxYwrE)rrrWrFror)r!rorr"s r#rz BackgroundTypeChatTheme.__init__sO doo*E ^^  0#-DO"oo/DN 0 0 0rG) r8r9r:r;r<r>rr rr@rAs@r#r`r`s5" I *. 0 0X& 0 0r%r`cfeZdZdZdZdddedeeffdZe d ded ed d dffd Z xZ S)ChatBackgrounda This object represents a chat background. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type` is equal. .. versionadded:: 21.2 Args: type (:class:`telegram.BackgroundType`): Type of the background. Attributes: type (:class:`telegram.BackgroundType`): Type of the background. rNrrrcxt||||_|jf|_|j yr)rrrrrr s r#rzChatBackground.__init__s2 J/$( )) r%r&r'rr(c|j|}t|jdt||d<t|||Sr*)r-r r1rSrr3)r5r&r'r"s r#r3zChatBackground.de_jsonsAt$'(8.#NV wDc22r%r7) r8r9r:r;r<rSrr rr?r3r@rAs@r#rrrrs^ I *.  X& 383(5/3EU33r%rrN)r;collections.abcrtypingrrrtelegramrtelegram._files.documentrtelegram._telegramobjectr telegram._utilsr telegram._utils.argumentparsingr r telegram._utils.typesr rrr.r/r0rSr]r^r_r`rrr%r#r~s&@$11-3 P*=3^=3@+.+D-V^-V`!,^!,HH3^H3V'B'BT5Fn5FpEHNEHP0n0D%3^%3r%