Ë
    £| k×}  ã                  óü  — d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZ ddlmZmZ ddlmZmZ dd	lmZmZmZmZmZmZmZmZmZ dd
lmZmZmZm Z m!Z! ddl"m#Z# ddl$m%Z%m&Z&m'Z'm(Z(m)Z) ddl*m+Z+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9m:Z:  ejv                  e<«      Z=dZ>e G d„ d«      «       Z?e G d„ d«      «       Z@ ej‚                  d«      ZBdd„ZC	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„ZDdd„ZEy)zf/shift <source> <destination> [from_id] [to_id]: copy posts from one channel into another. Owner only.é    )ÚannotationsN)Ú	dataclassÚfield)ÚOptional)ÚButtonÚerrorsé   )Ú
ChannelRefÚresolve_channel)	ÚCtxÚ	UserErrorÚcmdÚedit_callback_messageÚguardÚon_cbÚpurge_pendingÚrequire_ownerÚsay)ÚCrossResultÚprogress_textÚrelink_after_shiftÚreport_linesÚrestore_after_shift_undo)Úprofile_lines)ÚRepostOptionsÚ
RepostPlanÚRepostResultÚplan_repostÚsaved_lookup)Údelete_shift_copiesÚplan_from_my_postsÚ	run_shiftÚshift_profileÚ	source_of)ÚescÚexplain_rpcÚ
get_rightsÚ	post_link)Údelete_problem_texté   )Úfinishing_notesÚheld_plan_linesÚhidden_progressu×  Usage: <code>/shift &lt;source&gt; &lt;destination&gt; [from_id] [to_id]</code>
Copies posts from one channel into another - text, formatting, media, albums, buttons, replies - and registers the copies in My posts. The source is only read: nothing in it is changed or deleted.

A channel can be given as <code>@username</code>, a t.me link, its id (<code>-100â€¦</code>) or an invite link (the bot must be a member). The bot must be an admin of the destination (Post messages).

<code>/shift @source @destination</code> - every post
<code>/shift @source @destination 15 20</code> - only the posts with message ids 15 to 20
<code>/shift @source @destination 15</code> - only post 15

A channel that Telegram restricts (a copyright strike: â€œThis channel is unavailable due to copyright infringementâ€�, its posts shown as â€œThis message couldn't be displayed on your device due to copyright infringementâ€�) is copied from what My posts saved of it - every post that has a saved copy, however intact Telegram's version looks. Telegram's notice is never copied. A post without a saved copy is copied as Telegram hands it out if it is still the post itself, and skipped if only the notice is left.

Three extras, each optional, in any order, with or without a range:
<code>-c</code> - afterwards every link to a post of the source - in ANY of your connected channels - is pointed at the copy in the destination
<code>-all</code> - afterwards the destination gets the source's name, description and profile photo
<code>--no-media</code> - no file is copied: every post goes out as its text with its formatting and buttons (use it when Telegram hides the copies because of their files)
<code>/shift @source @destination -c -all</code> does the first two.c                  ó<   — e Zd ZU dZdZded<   dZded<   dZded<   y)Ú
ShiftFlagszThe optional extras of /shift.FÚboolÚlinksÚprofileÚno_mediaN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r1   Ú__annotations__r2   r3   © ó    ú/app/app/handlers/shift.pyr/   r/   1   s#   … á(à€Eˆ4ÓØ€GˆTÓØ€HˆdÔr:   r/   c                  ó¾   — e Zd ZU dZded<   ded<   ded<   ded<   d	Zded
<    ee¬«      Zded<   dZ	ded<   dZ
ded<   dZded<    eej                  ¬«      Zded<   y)ÚShiftJobzKA shift that was planned and is waiting for the owner's OK (or is running).ÚintÚuserr
   ÚsrcÚdstr   Úplanr   Úalready)Údefault_factoryr/   ÚflagsFr0   ÚrunningÚstopÚ ÚstrÚshift_idÚfloatÚcreatedN)r4   r5   r6   r7   r8   rC   r   r/   rE   rF   rG   rJ   ÚtimeÚ	monotonicrL   r9   r:   r;   r=   r=   :   sd   … áUà
ƒIØ	ƒOØ	ƒOØ
ÓØ€GˆSÓÙ¨jÔ9€Eˆ:Ó9Ø€GˆTÓØ€Dˆ$ÓØ€HˆcÓÙ¨4¯>©>Ô:€GˆUÔ:r:   r=   z.^[-\u2013\u2014]{1,2}([A-Za-z][A-Za-z0-9_-]*)$c                óH  — t        j                  dd| xs dt         j                  ¬«      }t        «       g }}|j	                  «       D ]”  }t
        j                  |«      }|€|j                  |«       Œ,t        j                  dd|j                  d«      «      j                  «       }|dk(  rd	|_
        Œm|d
k(  rd	|_        Œz|dk(  rd	|_        Œ‡t        d|› d�«      ‚ t        |«      dk  st        |«      dkD  rt        d«      ‚g }|dd D ]I  }|j                  «       rt!        |«      dk  rt        d|› d�«      ‚|j                  t!        |«      «       ŒK dx}}	t        |«      dk(  r|d   x}}	n$t        |«      dk(  rt#        |«      t%        |«      }	}|d   |d   ||	|fS )a(  -> (source text, destination text, first id or None, last id or None, ShiftFlags).

    -c, -all and --no-media can stand anywhere, in any order ("- all" with a space is understood too, and so are
    -nomedia and a long dash in place of --); a channel id such as -1001234567890 is not an option.z:(?<!\S)([-\u2013\u2014]{1,2})\s+(all|c|no[-_]?media)(?!\S)z\1\2rH   )rE   Nz[-_]r*   ÚcTÚallÚnomediazUnknown option z*. The options are -c, -all and --no-media.r	   é   z^Give the source and the destination channel, and optionally the first and the last message id.u   â€œuM   â€� is not a message id. Message ids are positive numbers, for example 15 20.r   )ÚreÚsubÚIr/   ÚsplitÚ_OPTIONÚmatchÚappendÚgroupÚlowerr1   r2   r3   Ú
ValueErrorÚlenÚisdigitr>   ÚminÚmax)
ÚrawÚtextrE   ÚtoksÚtÚmÚnameÚnumsÚfirstÚlasts
             r;   Úparse_shift_argsrk   M   s‘  € ô
 �6‰6ÐOÐQXÐZ]ÒZcÐacÔkm×koÑkoÔp€DÜ“, ˆ4€EØ�Z‰ZŽ\ˆÜ�M‰M˜!ÓˆØˆ9Ø�K‰K˜ŒNØÜ�v‰v�g˜r 1§7¡7¨1£:Ó.×4Ñ4Ó6ˆØ�3Š;ØˆE�KØ�UŠ]Ø ˆE�MØ�YÒØ!ˆE�Nä˜¨q¨cÐ1[Ð\Ó]Ð]ð ô ˆ4ƒy�1‚}œ˜D›	 AšÜÐyÓzÐzØ€DØ�!�"‹XˆØ�y‰yŒ{œc !›f qšjÜ˜s 1 #Ð%rÐsÓtÐtØ�‰”C˜“FÕð ð Ð€EˆDÜ
ˆ4ƒy�A‚~Ø˜A‘wÐˆ‘Ü	ˆT‹�aŠÜ˜$“i¤ T£ˆtˆØ�‰7�D˜‘G˜U D¨%Ð/Ð/r:   c                óÎ  — | j                   › d| j                  › d�}| j                  r|d| j                  › d�z  }| j                  r|d| j                  › d�z  }ddt	        |j
                  «      › dt	        |j
                  «      › d	�d
| j                  › d| j                  › d| j                  › d| j                  › d| j                  › d|› �g}	| j                  r|	j                  d| j                  › d�«       | j                  r|	j                  d«       | j                  r|	j                  d| j                  › d�«       |	t        | |j
                  d¬«      z  }	| j                  rTd}
| j                   r|
d| j                   › d�z  }
| j"                  r|
d| j"                  › d�z  }
|	j                  |
dz   «       | j$                  rB|	j                  d| j$                  › d| j&                  › dt	        |j
                  «      › d�«       | j(                  r|	j                  d| j(                  › d�«       |r+|	j                  d |› d!t	        |j
                  «      › d"�«       |xs
 t+        «       }| j,                  rC|	j/                  d#d$t	        |j
                  «      › d%t	        | j0                  xs d&«      › d'�«       |j2                  ra|rd(|› d)�nd*}|	j                  d+t	        |j
                  «      › d,|› d-t	        |j
                  «      › d.t	        |j
                  «      › d/�	«       |j4                  rh|	j                  d0t	        |j
                  «      › d1t	        |j
                  «      › d2�«       |s(|	j                  d3t	        |j
                  «      › d4�«       t7        d5t9        | j;                  |«      d6z  «      «      }| j,                  r| j                  rd7nd8}d9|› d:�}d;}nC| j                  rd<}d=}n2| j<                  rd>}d?}n!d@}| j>                  s| j@                  r|dAz  }d?}|	dB|dB|dC|› dDt	        |j
                  «      › dE�gz  }	dFjC                  |	«      S )GNz text, z mediaú, z poll(s)z otheru   ðŸ“¦ <b>Shift plan</b>zFrom <b>õ   </b> â†’ <b>ú</b>z	Post ids Ú-ú: <b>z posts</b> to copy (z messages, z album(s)) - u   â€¢ uQ    service message(s) (like â€œpinned a messageâ€�) can't be copied and are skippedu(   â€¢ polls are copied without their voteszH post(s) carry other bots' buttons (reactions...) - those are not copiedT©Úshiftuo   â€¢ ðŸš« <b>--no-media</b>: no file is copied - every post goes out as its text with its formatting and buttonsz. z$ post(s) carry a file that stays outz; zR post(s) are only a file, so there is nothing to copy of them and they are skippedÚ.z link(s) in z! post(s) point at other posts of z7: those that are shifted too will point at their copieszU post(s) answer another post: the copy answers the copy (if that post is shifted too)u   â€¢ âš ï¸� z* of these posts were already shifted into z# before: they would be copied againr	   u   âš ï¸� <b>I can't read z</b>: zTelegram refuseszD. My posts has the saved posts of it, so they are copied from there.zyour z other connected channel(s)zyour connected channelsu7   â€¢ ðŸ”— <b>-c</b>: afterwards every link to a post of z. - a hyperlink, a typed link or a button - in z is pointed at the copy in z9 (links to posts that are not shifted stay as they are). z itself is not changed.u!   â€¢ ðŸ–¼ <b>-all</b>: afterwards z1 gets the name, description and profile photo of zi. Its own are replaced - undo does not bring them back. A part the source does not have is left as it is.uN   â€¢ âš ï¸� The bot does not have the â€œChange channel infoâ€� admin right in u]    yet - give it before the copying is finished, or use the â€œcopy againâ€� button afterwards.r*   é<   z its text, formatting and buttonszZits text, formatting, buttons and media (a file that Telegram refuses goes out without it)zH<b>How:</b> every post is posted again from what My posts saved of it - z£ - and every button is read back to make sure it is there. Copies go to the end of the destination silently, in the original order, and are registered in My posts.zž<b>Not kept:</b> original dates, view counts, reactions, comments, poll votes, pins, replies and albums (every picture of an album becomes a post of its own).a	  <b>How:</b> every post is posted again as its text with its formatting and buttons - no file is copied - and every button is read back to make sure it is there. Copies go to the end of the destination silently, in the original order, and are registered in My posts.z�<b>Not kept:</b> the files, albums (a caption becomes a post of its own), original dates, view counts, reactions, comments, poll votes and pins.a“  <b>How:</b> Telegram copies nothing out of a restricted channel, so every post is posted again - from what My posts saved of it, or as Telegram hands it out when there is no saved copy - with its text, formatting, media and buttons in one go, and every button is read back to make sure it is there. Copies go to the end of the destination silently, in the original order, and are registered in My posts.zW<b>Not kept:</b> original dates, view counts, reactions, comments, poll votes and pins.a_  <b>How:</b> posts are copied by Telegram itself where possible (exactly as they are); posts with buttons or replies are posted again with their text, formatting, media and buttons in one go, and every button is read back to make sure it is there. Copies go to the end of the destination silently, in the original order, and are registered in My posts.zZ Posts that Telegram restricts are never copied by Telegram itself: they are posted again.rH   zTime: about z min. <b>Nothing is changed in z.</b>Ú
)"rc   ÚmediaÚpollsÚotherr%   Útitleri   rj   ÚunitsÚmessagesÚalbumsÚservicerZ   Údropped_postsr,   r3   Úfiles_left_outÚ	file_onlyÚ
post_linksÚpost_link_postsÚrepliesr/   Úfrom_dbÚinsertÚ
unreadabler1   r2   ra   ÚroundÚeta_secondsÚchannel_restrictedÚ
held_savedÚlive_restrictedÚjoin)Úpr@   rA   rC   ÚdelayrE   ÚothersÚ
info_rightÚkindsÚlinesÚnoteÚwhereÚminutesÚwhatÚhowÚkepts                   r;   Ú	plan_textrš   q   s~  € ð �v‰vˆh�g˜aŸg™g˜Y fÐ-€EØ‡w‚wØ�2�a—g‘g�Y˜hÐ'Ñ'ˆØ‡w‚wØ�2�a—g‘g�Y˜fÐ%Ñ%ˆà Ø
”3�s—y‘y“>Ð" ,¬s°3·9±9«~Ð.>¸dÐCØ
�A—G‘G�9˜A˜aŸf™f˜X U¨1¯7©7¨)Ð3GÈÏ
É
À|ÐS^Ð_`×_gÑ_gÐ^hÐhuÐv{Ðu|Ð}ð€Eð
 	‡y‚yØ�‰�t˜AŸI™I˜;Ð&wÐxÔyØ‡w‚wØ�‰Ð?Ô@Ø‡‚Ø�‰�t˜AŸO™OÐ,Ð,tÐuÔvØ	Œ_˜Q §	¡	°Ô6Ñ6€EØ‡z‚zð AˆØ×ÒØ�b˜×)Ñ)Ð*Ð*NÐOÑOˆDØ�;Š;Ø�b˜Ÿ™˜Ð%wÐxÑxˆDØ�‰�T˜C‘ZÔ Ø‡|‚|Ø�‰Ø�1—<‘<�. ¨Q×->Ñ->Ð,?Ð?`ÔadÐeh×enÑenÓaoÐ`pð q9ð 9ô	
ð 	‡y‚yØ�‰�t˜AŸI™I˜;Ð&{Ð|Ô}ÙØ�‰Ø˜'˜Ð"LÌSÐQT×QZÑQZË^ÐL\Ð\ð  Aô	
ð Ò!”Z“\€EØ‡y‚yØ�‰ØØ%¤c¨#¯)©)£nÐ%5°V¼CÀÇÁÒ@bÐPbÓ<cÐ;dð e:ð :ô	
ð
 ‡{‚{Ù?E�%˜�xÐ:Ñ;ÐKdˆØ�‰ØEÄcÈ#Ï)É)ÃnÐEUð VØ ˜'Ð!<¼SÀÇÁ»^Ð<Lð MÜ  §¡›^Ð,Ð,CðEô	
ð
 ‡}‚}Ø�‰Ø/´°C·I±I³Ð/?Ð?pÜ�3—9‘9‹~Ðð  ð ô	
ñ
 Ø�L‰LØ`ÔadÐeh×enÑenÓaoÐ`pð qað aôô �!”U˜1Ÿ=™=¨Ó/°"Ñ4Ó5Ó6€GØ‡y‚yØ56·Z²ZÑ1Øhð 	ð WÐW[ÐV\ð ]*ð *ð 	ð
 p‰Ø	
�Šð>ð 	ð
 b‰Ø	
×	Ò	ð_ð 	ð i‰ð*ð 	ð �<Š<˜1×,Ò,ØÐoÑoˆCØhˆØ	Ø
ØØ
ØØ
�w�iÐ>¼sÀ3Ç9Á9»~Ð>NÈeÐTðñ €Eð �9‰9�UÓÐr:   c                óˆ  ‡ ‡‡‡‡‡‡— ‰ j                   ‰ j                  ‰ j                  cŠŠŠˆfd„Š‰j                  t	        dd¬«      «      t        ‰ d¬«      ˆˆˆ ˆˆfd„«       «       }t        ‰ d«      ˆ fd„«       }ddˆˆˆ ˆˆfd	„Št        ‰ d
«      ˆˆ ˆˆfd„«       }t        ‰ d«      ˆ ˆˆfd„«       }t        ‰ d«      ˆ fd„«       }t        ‰ d«      ˆˆˆ ˆˆˆfd„«       }t        ‰ d«      ˆˆ ˆˆˆfd„«       }ˆfd„Št        ‰ d«      ˆˆfd„«       }t        ‰ d«      ˆ ˆˆfd„«       }	t        ‰ d«      ˆˆˆ ˆˆfd„«       }
y )Nc              “  ó„  •K  — ‰j                  | j                  «      ƒ d{  –—† }‰j                  | j                  «      ƒ d{  –—† }t	        | j
                  xs t        | j                  «      «      }|rt	        |j                  «      nt        | j                  «      }d|› d|› d�}d}|r|d   rdt        ||d   «      › d�}t        j                  d	d
| j                  › �«      g}‰j                  | j                  «      ƒ d{  –—† }d|v r|dz  }g }	d|v r3|	j                  t        j                  dd| j                  › �«      g«       d|v r7d|vr3|	j                  t        j                  dd| j                  › �«      g«       | j                  dk(  r3d|› d|d   › d| j                  › d| j                   › d|› d�}
|	|gz   }|
|fS | j                  dk(  rd|› d�}
g }|
|fS | j                  dk(  r@d|› d |d   › d!|› �}
d"|v rd#nd$}t        j                  |d%| j                  › �«      g|g}|
|fS | j                  d&k(  r8d'|› d(|d   › d)|› �}
t        j                  d$d%| j                  › �«      g|g}|
|fS d*|› d+|d   › d)|› d,�}
t        j                  d-d%| j                  › �«      g|g}|
|fS 7 �Œ•7 �Œu7 �Œ´­w).z1Text and buttons describing where a shift stands.Nú<b>rn   ro   rH   Ú	first_newz

<a href="z">First copy</a>u   â†©ï¸� Undo - remove the copieszsfu:rR   z (without files)Úrelinku   ðŸ”— Update links againzsfl:r2   Úprofile_doneu(   ðŸ–¼ Copy name, description, photo againzsfp:Úcopiedu   âœ… rq   z# message(s) copied</b> (source ids rp   z) and registered in My posts.zw
The source was not changed. Look at the end of the destination; if something is wrong, undo removes just these copies.Úcopies_deletedu   â†©ï¸� z : the copies were removed again.Ústoppedu   â�¹ z: <b>stopped</b>. z message(s) copied so far.Úhiddenoku   â–¶ï¸� Continue anywayu   â–¶ï¸� Continuezsfc:Úcopyingu   â�³ z,: a shift was running when the bot stopped. z message(s) copied.õ   âš ï¸� z$: <b>not everything was copied</b>. z#
Nothing was changed in the source.u   ðŸ”� Try the rest again)Úget_channelÚdst_channel_idÚshift_countsÚidr%   Ú	src_titlerI   Úsrc_channel_idrz   r(   r   ÚinlineÚmarks_ofrZ   ÚstatusÚfirst_idÚlast_id)ÚshrA   rP   Úsrc_nameÚdst_nameÚrouteÚ
first_copyÚundoÚmarksÚextrasrc   ÚkbÚgoÚdbs                €r;   Úview_forzregister.<locals>.view_forã   s+  øè ø€ à—N‘N 2×#4Ñ#4Ó5×5ˆØ—/‘/ "§%¡%Ó(×(ˆÜ�r—|‘|Ò=¤s¨2×+<Ñ+<Ó'=Ó>ˆÙ%(”3�s—y‘y”>¬c°"×2CÑ2CÓ.DˆØ�h�Z˜|¨H¨:°TÐ:ˆØˆ
Ù�1�[’>Ø&¤y°°a¸±nÓ'EÐ&FÐFVÐWˆJÜ—‘Ð?À4ÈÏÉÀwÀÓPÐQˆØ—k‘k "§%¡%Ó(×(ˆØ˜ÑØÐ'Ñ'ˆEØˆØ�uÑØ�M‰Mœ6Ÿ=™=Ð)BÀdÈ2Ï5É5È'ÀNÓSÐTÔUØ˜Ñ .¸Ñ"=Ø�M‰Mœ6Ÿ=™=Ð)SÐW[Ð\^×\aÑ\aÐ[bÐUcÓdÐeÔfØ�9‰9˜Ò à�u�g˜U 1 X¡; -Ð/RÐSU×S^ÑS^ÐR_Ð_`Ðac×akÑakÐ`lð m*Ø*4¨ð 6IðIð ð
 ˜4˜&‘ˆBð" �Rˆxˆð! �Y‰YÐ*Ò*Ø˜U˜GÐ#CÐDˆDØˆBð �Rˆxˆð �Y‰Y˜)Ò#Ø˜%˜Ð 2°1°X±;°-Ð?YÐZdÐYeÐfˆDØ-7¸5Ñ-@Ñ)ÐFWˆBÜ—=‘=  t¨B¯E©E¨7 ^Ó4Ð5°tÐ<ˆBð �Rˆxˆð �Y‰Y˜)Ò#Ø˜%˜Ð LÈQÈxÉ[ÈMÐYlÐmwÐlxÐyˆDÜ—=‘=Ð!2°d¸2¿5¹5¸'°NÓCÐDÀdÐKˆBð �Rˆxˆð	 ˜%˜Ð DÀQÀxÁ[ÀMÐQdÐeoÐdpð q5ð 5ð ô —=‘=Ð!:¸dÀ2Ç5Á5À'¸NÓKÐLÈdÐSˆBØ�RˆxˆðQ 6ùØ(ùð )ûs5   ƒK ¢J7£"K ÁJ:ÁCK Ä	J=Ä
F.K Ê:K Ê=K rs   T)Úargs)Úownerc              “  óú
  •‡‡‡K  — t        ‰«       | j                  j                  d«      xs dj                  «       }|s¤‰j	                  «       ƒ d {  –—† }|�, ‰|«      ƒ d {  –—† \  }}t        | d|z   |«      ƒ d {  –—†  y t        | t        «      ƒ d {  –—†  ‰j                  «       ƒ d {  –—† }|�+ ‰|«      ƒ d {  –—† \  }}t        | d|z   |«      ƒ d {  –—†  y 	 t        |«      \  }}}}}	t        ‰|«      ƒ d {  –—† Št        ‰|«      ƒ d {  –—† }‰j                  |j                  k(  rt        d«      ‚‰j	                  ‰j                  |j                  «      ƒ d {  –—† }|�, ‰|«      ƒ d {  –—† \  }}t        | d|z   |«      ƒ d {  –—†  y t!        ‰|«      ƒ d {  –—† }|�1|j"                  r|j$                  st        d|j&                  › d�«      ‚‰j(                  j+                  «       rt        d«      ‚t        | dt-        ‰j&                  «      › d�«      ƒ d {  –—† ŠdgŠˆˆˆfd„}	 ‰j(                  4 ƒd {  –—†  t/        ‰‰t1        «       |||t3        ‰‰j                  «      d|	j4                  ¬«	      ƒ d {  –—† }d d d «      ƒd {  –—†  j>                  r0‰jA                  dt-        |j>                  «      › �«      ƒ d {  –—†  y tC        ‰jE                  ‰j                  |j                  |jF                  |jH                  «      ƒ d {  –—† «      }d}|	jJ                  rW‰jM                  «       ƒ d {  –—† D �ch c]  }|j                  ’Œ c}|j                  hz  }tC        |‰j                  hz
  «      }|d u xs tO        tQ        |dd«      «      }tS        jT                  d«      }tW        | jX                  ‰||||	¬«      ‰jZ                  |<   t]        j^                  dd |› �«      t]        j^                  d!d"|› �«      gg}‰jA                  ta        |‰||‰jb                  |	||«      |¬#«      ƒ d {  –—†  y 7 �Œ7 �Œõ7 �ŒÝ7 �ŒÇ7 �Œ²7 �Œ£7 �Œ‹# t        $ rO}
t        |
› d�t        j                  ddt        «      j                  dd«      j                  d	d
«      z   «      ‚d }
~
ww xY w7 �ŒÂ7 �Œ±7 �Œb7 �ŒS7 �Œ;7 �Œ)7 �Œ©7 �ŒŒ7 �ŒM7 �Œ@# 1 ƒd {  –—†7  sw Y   �ŒQxY w# t6        j8                  $ rX}
t;        |
«      }t=        ‰‰||||	j4                  ¬«      ƒ d {  –—†7  }|€t        d‰j&                  › d|› d�«      ‚Y d }
~
�Œºd }
~
ww xY w7 �ŒŒ7 �ŒE7 �Œc c}w 7 �Œ&­w)$Nr*   rH   zUnfinished shift:

z0Latest finished shift - you can still undo it:

ú

z<[^>]+>z&lt;Ú<z&gt;Ú>zbThe source and the destination are the same channel. To rebuild one channel in order, use /repost.zSThere is an unfinished shift between these two channels. Finish or undo it first.

õ5   The bot needs the â€œPost messagesâ€� admin right in rt   z=Another long job (replace / repost / shift) is still running.õ   ðŸ”� Reading <b>u   </b>â€¦ç        c              “  ó  •K  — t        j                  «       ‰d   z
  dk  ry t        j                  «       ‰d<   	 ‰j                  dt        ‰j                  «      › d| j
                  › d�«      ƒ d {  –—†  y 7 Œ# t        $ r Y y w xY w­w)Nr   é   rÅ   z</b>: post id õ   â€¦)rM   rN   Úeditr%   rz   ÚscannedÚ	Exception)rŽ   Ú	last_editr”   r@   s    €€€r;   Úprogz'register.<locals>.h_shift.<locals>.prog7  s|   øè ø€ Ü�~‰~Ó )¨A¡,Ñ.°Ò2ØÜŸ>™>Ó+ˆI�a‰LðØ—i‘iÐ"2´3°s·y±y³>Ð2BÀ.ÐQR×QZÑQZÐP[Ð[^Ð _Ó`×`Ò`ùÜò Ùðüs:   ƒ6B	º8A: Á2A8Á3A: Á7B	Á8A: Á:	BÂB	ÂBÂB	T)Úprogressr°   r±   ÚsavedÚ	use_savedr3   )r‡   r3   zI can't read ú: zŒ
The bot has to be a member of the source channel (an admin is best; it only reads). My posts has no saved posts of it to copy from instead.r¦   r   Úchange_inforS   )r?   r@   rA   rB   rC   rE   u   â–¶ï¸� Start copyingzsfa:u   âœ–ï¸� Cancelzsfn:)Úbuttons)2r   Úpattern_matchr[   ÚstripÚ
open_shiftr   ÚUSAGEÚlast_finished_shiftrk   r]   r   rT   rU   Úreplacer   rª   r'   ÚadminÚpostrz   ÚlockÚlockedr%   r   r   r   r3   r   ÚRPCErrorr&   r!   ÚerrorrÊ   r^   Úshifted_idsri   rj   r1   Úlist_channelsr0   ÚgetattrÚsecretsÚ	token_hexr=   Ú	sender_idÚpendingr   r­   rš   Ú
edit_delay)Úeventrb   r²   rc   rº   rj   Úsrc_textÚdst_textri   rE   ÚerA   ÚrightsrÎ   rB   ÚwhyrC   r�   rP   Úknownr‘   ÚtokenrÍ   r”   r@   ÚcfgÚclientÚctxr¼   r½   s                         @@@€€€€€r;   Úh_shiftzregister.<locals>.h_shift  sï  ûè ø€ ô 	�cÔØ×"Ñ"×(Ñ(¨Ó+Ò1¨r×8Ñ8Ó:ˆÙØ—}‘}“×&ˆBØˆ~Ù!)¨"£×-‘��bÜ˜%Ð!8¸4Ñ!?ÀÓD×DÐDØÜ�eœUÓ#×#Ð#à×/Ñ/Ó1×1ˆDØÐÙ!)¨$£×/‘��bÜ˜%Ð!UÐX\Ñ!\Ð^`Óa×aÐaØð	rÜ5EÀcÓ5JÑ2ˆH�h  t¨Uô $ C¨Ó2×2ˆÜ# C¨Ó2×2ˆØ�6‰6�S—V‘VÒÜð  Aó  Bð  BØ—=‘= §¡¨¯©Ó0×0ˆØˆ>Ù% b›\×)‰HˆD�"Ü�eÐtÐw{Ñ{Ð}ó  A÷  Að  AØÜ! &¨#Ó.×.ˆØÐ v§|¢|¸¿ºÜÐSÐTW×T]ÑT]ÐS^Ð^_Ð`ÓaÐaØ�8‰8�?‰?ÔÜÐ[Ó\Ð\Ü˜Ð"2´3°s·y±y³>Ð2BÀ'Ð JÓK×KˆØ�Eˆ	ö	ð	Ø—x—x“xÜ(Ø˜C¤£¸4È%ÐY]Ü& r¨3¯6©6Ó2¸dÈUÏ^É^ô÷ �÷  —xð �:Š:Ø—)‘)˜g¤c¨$¯*©*£oÐ%6Ð7Ó8×8Ð8ØÜ˜BŸN™N¨3¯6©6°3·6±6¸4¿:¹:ÀtÇyÁyÓQ×QÓRˆØˆØ�;Š;Ø)+×)9Ñ)9Ó);×#;Ð#;Ó<Ñ#;˜a�Q—T“TÐ#;Ñ<ÀÇÁ¸xÑGˆEÜ˜ #§&¡& Ñ)Ó*ˆFØ˜t�^ÒQ¤t¬G°F¸MÈ4Ó,PÓ'Qˆ
Ü×!Ñ! !Ó$ˆÜ%¨5¯?©?ÀÈÐSWÐahÐpuÔvˆ�‰�EÑÜ�}‰}Ð3°t¸E¸7°^ÓDÄfÇmÁmÐTcÐgkÐlqÐkrÐesÓFtÐuÐvˆØ�i‰iœ	 $¨¨S°'¸3¿>¹>È5ÐRXÐZdÓeÐoqˆiÓr×rÑrðK 'ùà-ùØDùà#ùà1ùà/ùØaúô ò 	rÜ˜q˜c ˜J¬¯©°
¸BÄÓ)F×)NÑ)NÈvÐWZÓ)[×)cÑ)cÐdjÐloÓ)pÑpÓqÐqûð	rúà2ùØ2ùð 1ùà)ùð Aùà.ùð
 Lùð  ùðùð  ù—x—x’xûô
 �‰ò 	Ü˜a“.ˆCä+¨B°°U¸DÈSÐ[`×[iÑ[iÔj×jÐjˆDØˆ|ÜØ# C§I¡I ;¨b°°ð 6qð qóð õ ûð		úð 9ùàQùð $<ûÒ<ð 	sûsý  †AU;ÁQÁU;Á&QÁ'U;ÂQÂU;ÂQ!ÂU;Â2Q$Â3U;ÃQ'ÃU;ÃQ*Ã U;Ã&Q- Ã7U;ÄSÄU;ÄSÄAU;Å,SÅ-U;Å>SÅ?U;ÆSÆU;Æ.SÆ/BU;È1SÈ2U;ÉS< ÉSÉS< É>S&ÊS ÊS&ÊS< Ê#S#Ê$S< Ê(6U;ËU*ËA	U;Ì(U-Ì))U;ÍU0ÍU;ÍU3Í,C&U;ÑU8ÑU;ÑU;ÑU;Ñ!U;Ñ$U;Ñ'U;Ñ*U;Ñ-	SÑ6A
S Ó SÓU;ÓU;ÓU;ÓU;ÓU;ÓU;ÓU;ÓS< Ó S&Ó#S< Ó&S9Ó,S/Ó-S9Ó4S< Ó<U'Ô)U"Ô8T;Ô9#U"ÕU;Õ"U'Õ'U;Õ-U;Õ0U;Õ3U;Úsfnc              “  ó�   •K  — t        ‰| «       ‰j                  j                  |d   d «       t        | d«      ƒ d {  –—†  y 7 Œ­w)Nr   zCancelled - nothing was copied.)r   rç   Úpopr   )ré   Úpartsró   s     €r;   Ú	cb_cancelzregister.<locals>.cb_cancel]  s8   øè ø€ ä�c˜5Ô!Ø�‰�‰˜˜a™ $Ô'Ü# EÐ+LÓM×MÒMús   ƒ;A¾A¿Ac              “  ó   •‡ ‡‡‡‡‡‡K  — ‰j                  ‰«      ƒ d {  –—† Š‰j                  ‰j                  «      ƒ d {  –—† }|€t        d«      ‚‰xs t	        ‰ j
                  d d d ¬«      Šdd‰c‰_        ‰_        ‰_        ‰‰j                  d‰› �<   ‰j                  r‰j                  j                  nd ŠdgŠdt        ‰j                  «      › dt        |j                  «      › d	�Šˆ ˆˆˆˆˆfd
„}	 ‰j                  4 ƒd {  –—†  ‰j!                  ‰d«      ƒ d {  –—†  t#        ‰‰‰|‰ j
                  ‰j$                  |ˆfd„¬«      ƒ d {  –—† }d d d «      ƒd {  –—†  d‰_        j&                  rdn'|j(                  s|j*                  s|j,                  rdnd}‰j!                  ‰|«      ƒ d {  –—†  |j.                  r‰j1                  ‰d«      ƒ d {  –—†  ‰j                  ‰«      ƒ d {  –—† Š ‰‰«      ƒ d {  –—† \  }}g }	|j2                  r+|	j5                  |j6                  › d|j8                  › d�«       |j:                  r|	j5                  |j:                  › d�«       |j(                  rÆdj=                  d„ |j(                  d d D «       «      }
|	j5                  dt?        |j(                  «      › d|
› t?        |j(                  «      dkD  rdnd› d�«       tA        d„ |j(                  D «       «      r|	j5                  d«       tA        d„ |j(                  D «       «      r|	j5                  d«       |j*                  r(|	j5                  d t        |j*                  «      › d!�«       |	tC        |d¬"«      z  }	tE        ‰ ||	rd#d$j=                  |	«      z   ndz   |«      ƒ d {  –—†  y 7 �Œ�7 �Œ}7 �Œ¸7 �Œ¡7 �Œr7 �Œe# 1 ƒd {  –—†7  sw Y   �ŒvxY w# d‰_        w xY w7 �Œ37 �Œ7 �Œú7 �Œí7 ŒE­w)%Nú3The destination channel is not registered any more.)r?   r@   rA   rB   TFújob:rÆ   r�   rn   ro   c           	   “  óä  •K  — | j                   dv rt        j                  «       ‰d   z
  dk  ry t        j                  «       ‰d<   | j                  | j                  z   }‰	rd‰	› �nd}| j                   dk(  r-| j
                  �!d|› |› d�t        | j
                  d	¬
«      z   }n_| j                   dk(  rd|› |› dt        ‰j                  «      › d�}n1| j                   dk(  r	d|› |› d�}nd‰› d|› |› d�}|t        | «      z  }	 t        ‰|t        j                  dd‰› �«      gg«      ƒ d {  –—†  y 7 Œ# t        j                  $ r Y y t        $ r t         j#                  dd¬«       Y y w xY w­w)N)Úcopyr1   r   rS   Ú/rH   r1   u   âœ… Copied z posts.
z-Pointing links of your channels at the copies©rz   r2   u   ðŸ–¼ Copied z7 posts. Now copying the name, description and photo of rÉ   Úfinishu   ðŸ”— Copied u/    posts. Now pointing links at the new copiesâ€¦u   â�³ Shifting rÒ   u%    postsâ€¦
The source stays untouched.õ   â�¹ Stopúsfs:úprogress update failedT©Úexc_info)ÚphaserM   rN   Úcopied_unitsÚskipped_doneÚcrossr   r%   r«   r-   r   r   r­   r   ÚMessageNotModifiedErrorrÌ   ÚlogÚdebug)
ÚresÚdoneÚofÚbodyré   rj   Únamesr²   ÚsidÚtotals
       €€€€€€r;   rÎ   z(register.<locals>.run_copy.<locals>.progp  s…  øè ø€ Ø�y‰yÐ-Ñ-´$·.±.Ó2BÀTÈ!ÁWÑ2LÈqÒ2PØÜ—n‘nÓ&ˆD�‰GØ×#Ñ# c×&6Ñ&6Ñ6ˆDÙ %�1�U�G‘¨2ˆBØ�y‰y˜GÒ#¨¯	©	Ð(=Ø$ T F¨2¨$¨iÐ8¼=ÈÏÉð  [Jô  <Kñ  K‘Ø—‘˜iÒ'Ø% d V¨B¨4Ð/fÔgjÐkm×kwÑkwÓgxÐfyÐy|Ð}‘Ø—‘˜hÒ&Ø% d V¨B¨4Ð/^Ð_‘à& u g¨R°¨v°b°TÐ9_Ð`�Øœ¨Ó,Ñ,�ðCÜ+¨E°4¼6¿=¹=ÈÐW[Ð\_Ð[`ÐUaÓ;bÐ:cÐ9dÓe×eÒeùÜ×1Ñ1ò ÙÜò CÜ—	‘	Ð2¸T�	ÖBðCüsH   ƒDE0Ä)D6 Ä.D4Ä/D6 Ä3E0Ä4D6 Ä6E-Å	E0ÅE-Å*E0Å,E-Å-E0r¥   c                 ó   •— ‰ j                   S ©N©rG   ©Újobs   €r;   Ú<lambda>z,register.<locals>.run_copy.<locals>.<lambda>Š  s   ø€ Ðsv×s{Òs{r:   )r�   rÏ   Úshould_stopr£   Ú
incompleter¡   r¤   z" post(s) were copied by Telegram, z& were posted again with their buttons.zK post(s) needed their buttons set again after posting - they show them now.rm   c              3  óD   K  — | ]  \  }}d |› dt        |«      › �–— Œ y­w)Ú#Ú N)r%   )Ú.0ÚiÚns      r;   Ú	<genexpr>z-register.<locals>.run_copy.<locals>.<genexpr>š  s&   è ø€ ÐK¹N±D°A°q  1 # Q¤s¨1£v hÔ/¹Nùs   ‚ é   z post(s) failed</b> (rÉ   rH   ú).c              3  ó,   K  — | ]  \  }}|d k(  –— Œ y­w)ÚButtonsNotShownNr9   ©r   Ú_r"  s      r;   r#  z-register.<locals>.run_copy.<locals>.<genexpr>œ  s   è ø€ ÐA±j©d¨a°�1Ð)Õ)±jùó   ‚u�   ButtonsNotShown: Telegram did not show the buttons on the new post, so that copy was removed again. The original is untouched - use â€œTry the rest againâ€�.c              3  ó,   K  — | ]  \  }}|d k(  –— Œ y­w)ÚReplyParentMissingNr9   r(  s      r;   r#  z-register.<locals>.run_copy.<locals>.<genexpr>¡  s   è ø€ ÐD¹±°°A�1Ð,Õ,¹ùr*  z^ReplyParentMissing: that post answers a post whose copy failed; it follows when you try again.zStopped early because of rt   rr   rÁ   rv   )#Ú	get_shiftr§   r¨   r   r=   ræ   rF   rG   rJ   rç   rB   r{   r%   r«   rz   rÝ   Úset_shift_statusr"   rè   r£   ÚfailedÚabortedÚ	held_backÚhidden_stopÚset_markr  rZ   Ú	forwardedÚrebuiltÚrepairedr�   r^   Úanyr+   r   )ré   r  r  rA   rÎ   r  r¯   rc   rº   ÚnotesÚsamplerj   r  r²   r  rñ   rò   ró   r¼   r½   s   ```        @@@@€€€€€r;   Úrun_copyzregister.<locals>.run_copyd  sW  ÿè ø€ Ø—<‘< Ó$×$ˆØ—N‘N 2×#4Ñ#4Ó5×5ˆØˆ;ÜÐQÓRÐRØÒR”X 5§?¡?¸À$ÈTÔRˆØ.2°E¸3Ð+ˆŒ�S”X˜sœ|Ø$'ˆ�‰�d˜3˜%�LÑ!Ø"%§(¢(�—‘—’°ˆØˆuˆØ”c˜"Ÿ,™,Ó'Ð(¨´S¸¿¹³^Ð4DÀDÐIˆ÷	Cñ 	Cð,	 Ø—x—x“xØ×)Ñ)¨#¨yÓ9×9Ð9Ü%Ø˜B  C¨¯©ÀÇÁÐY]Ók{ô÷ �÷  —xð  ˆCŒKØ!Ÿkšk‘ÀÇÂÈsÏ{Ê{Ð^a×^kÒ^k±ÐrzˆØ×!Ñ! # vÓ.×.Ð.Ø�?Š?Ø—+‘+˜c :Ó.×.Ð.Ø—<‘< Ó$×$ˆÙ! "›×%‰ˆˆbØˆØ×ÒØ�L‰L˜CŸM™M˜?Ð*LÈSÏ[É[ÈMÐYð  Aô  BØ�<Š<Ø�L‰L˜CŸL™L˜>Ð)tÐuÔvØ�:Š:Ø—Y‘YÑK¸C¿J¹JÀrÈ¹NÓKÓKˆFØ�L‰L˜3œs 3§:¡:›Ð/Ð/DÀVÀHÔVYÐZ]×ZdÑZdÓVeÐhiÒViÉUÐoqÐLrÐrtÐuÔvÜÑA°c·j²jÓAÔAØ—‘ðPôô ÑD¸¿ºÓDÔDØ—‘Ð}Ô~Ø�;Š;Ø�L‰LÐ4´S¸¿¹Ó5EÐ4FÀaÐHÔIØ” ¨DÔ1Ñ1ˆÜ# E¨4ÑPU°6¸D¿I¹IÀeÓ<LÒ3LÐ[]Ñ+^Ð`bÓc×cÑcðC %ùØ5ùðB  ùØ9ùðùð  ù—x—x’xûð  ˆC�Kúà.ùà.ùØ$ùØ%ùð& 	dúsü   ŠO>ŸN< "O>ÁN?ÁB6O>Ã:O$ Ä
OÄO$ ÄOÄ$OÄ%1OÅOÅOÅO$ Å&OÅ'O$ Å+AO>Æ=O0Æ>%O>Ç#O3Ç$O>Ç<O6Ç=O>ÈO9ÈF)O>Î6O<Î7O>Î?O>ÏO$ ÏOÏOÏO$ ÏO!ÏOÏO!ÏO$ Ï$	O-Ï-O>Ï3O>Ï6O>Ï9O>Ï<O>Úsfac              “  óZ  •K  — t        ‰| «       ‰j                  j                  |d   «      }t        |t        «      r|j
                  | j                  k7  rt        d«      ‚|j                  s‰j                  j                  «       rt        d«      ‚‰j                  |j                  j                  |j                  j                  «      ƒ d {  –—† �t        d«      ‚t        ‰|j                  «      ƒ d {  –—† }|�;|j                   r|j"                  s#t        d|j                  j$                  › d�«      ‚‰j'                  |j                  j                  |j                  j(                  |j                  j$                  |j                  j*                  | j                  «      ƒ d {  –—†  t-        j.                  d«      }|j0                  }‰j3                  ||j                  |j                  j                  |j4                  |j6                  | j                  ¬«      ƒ d {  –—†  |j8                  j:                  r‰j=                  |d	«      ƒ d {  –—†  |j8                  j>                  r‰j=                  |d
«      ƒ d {  –—†  |j8                  j@                  r‰j=                  |d«      ƒ d {  –—†  |jB                  r‰j=                  |d«      ƒ d {  –—†  ‰j                  jE                  |d   d «        ‰	| ||«      ƒ d {  –—†  y 7 �ŒF7 �Œ 7 �Œo7 Œõ7 ŒÇ7 Œ™7 Œk7 ŒG7 Œ­w)Nr   z(That plan has expired. Run /shift again.úA long job is already running.z@There is already an unfinished shift between these two channels.rÄ   rt   r$  )r@   r¨   r°   r±   Úuser_idrŸ   r2   rR   Úfromdb)#r   rç   ÚgetÚ
isinstancer=   r?   ræ   r   rF   rÝ   rÞ   r×   r@   rª   rA   r'   rÛ   rÜ   rz   Úsave_channelÚaccess_hashÚusernamerä   rå   rB   Úcreate_shiftri   rj   rE   r1   r3  r2   r3   r…   r÷   )
ré   rø   r  rí   r  rŽ   rò   ró   r¼   r:  s
         €€€€r;   Úcb_startzregister.<locals>.cb_start¨  sb  øè ø€ ä�c˜5Ô!Ø�k‰k�o‰o˜e A™hÓ'ˆÜ˜#œxÔ(¨C¯H©H¸¿¹Ò,GÜÐFÓGÐGØ�;Š;˜#Ÿ(™(Ÿ/™/Ô+ÜÐ<Ó=Ð=Ø—‘˜sŸw™wŸz™z¨3¯7©7¯:©:Ó6×6ÐBÜÐ^Ó_Ð_Ü! &¨#¯'©'Ó2×2ˆØÐ v§|¢|¸¿ºÜÐSÐTW×T[ÑT[×TaÑTaÐSbÐbcÐdÓeÐeà�o‰o˜cŸg™gŸj™j¨#¯'©'×*=Ñ*=¸s¿w¹w¿}¹}ÈcÏgÉg×N^ÑN^Ð`e×`oÑ`oÓp×pÐpÜ×Ñ Ó"ˆØ�H‰HˆØ�o‰o˜c s§w¡w¸s¿w¹w¿z¹zÐTU×T[ÑT[Ðef×ekÑekÐuz÷  vEñ  vEˆoó  F÷  	Fð  	FØ�9‰9�?Š?Ø—+‘+˜c 8Ó,×,Ð,Ø�9‰9×ÒØ—+‘+˜c 9Ó-×-Ð-Ø�9‰9×ÒØ—+‘+˜c 9Ó-×-Ð-Ø�9Š9Ø—+‘+˜c 8Ó,×,Ð,Ø�‰�‰˜˜a™ $Ô'Ù�u˜c 3Ó'×'Ñ'ð' 7ùà2ùð 	qùð 	Føà,øà-øà-øà,øà'ús¤   ƒCL+ÃLÃ(L+Ã9LÃ:B3L+Æ-LÆ.A;L+È)LÈ*/L+ÉL!É/L+Ê	L#Ê
/L+Ê9L%Ê:%L+ËL'Ë 0L+ÌL)ÌL+ÌL+ÌL+ÌL+Ì!L+Ì#L+Ì%L+Ì'L+Ì)L+Úsfcc              “  ó  •K  — t        ‰| «       ‰j                  |d   «      ƒ d {  –—† }|�|j                  dvrt        d«      ‚‰j                  j                  «       rt        d«      ‚ ‰| |j                  «      ƒ d {  –—†  y 7 Œ`7 Œ­w)Nr   )r£   r  r¥   zThere is nothing to continue.r=  )r   r-  r¯   r   rÝ   rÞ   rª   )ré   rø   r²   ró   r¼   r:  s      €€€r;   Úcb_continuezregister.<locals>.cb_continueÅ  s|   øè ø€ ä�c˜5Ô!Ø—<‘<  a¡Ó)×)ˆØˆ:˜Ÿ™Ð*NÑNÜÐ;Ó<Ð<Ø�8‰8�?‰?ÔÜÐ<Ó=Ð=Ù�u˜bŸe™eÓ$×$Ñ$ð *øð
 	%ús"   ƒ$B§B¨ABÂB
ÂBÂ
BÚsfsc              “  ó  •K  — t        ‰| «       ‰j                  j                  d|d   › �«      }t        |t        «      r-|j
                  r!d|_        | j                  d«      ƒ d {  –—†  y | j                  d«      ƒ d {  –—†  y 7 Œ7 Œ­w)Nrü   r   Tu6   â�¹ Stopping after the post that is being worked onâ€¦zNothing is running.)r   rç   r@  rA  r=   rF   rG   Úrespond)ré   rø   r  ró   s      €r;   Úcb_stopzregister.<locals>.cb_stopÏ  su   øè ø€ ä�c˜5Ô!Ø�k‰k�o‰o  U¨1¡X JÐ/Ó0ˆÜ�cœ8Ô$¨¯ªØˆCŒHØ—-‘-Ð XÓY×YÑYà—-‘-Ð 5Ó6×6Ñ6ð Zøà6ús$   ƒA%BÁ(BÁ)BÂB
ÂBÂ
BÚsflc              “  ó  •‡ ‡
‡‡K  — t        ‰‰ «        ‰|«      ƒ d{  –—† \  Š}‰j                  dk7  rt        d«      ‚‰j                  j	                  «       rt        d«      ‚t        ‰ j                  dddd‰j                  ¬«      Š
‰
‰j                  d‰j                  › �<   t        «       dgc}Šˆ ˆˆfd	„}d}	 ‰j                  4 ƒd{  –—†  t        ‰ d
«      ƒ d{  –—†  t        ‰‰‰t        ‰«      |‰j                  |ˆ
fd„|¬«	      ƒ d{  –—†  ddd«      ƒd{  –—†  d‰
_        ‰j                  j)                  d‰j                  › �d«       t+        |dt-        |j.                  «      › �¬«      }|r|j1                  dt-        |«      › d�«       |s|j1                  d«        ‰‰«      ƒ d{  –—† \  }}	t        ‰ |dz   dj3                  |«      z   |	«      ƒ d{  –—†  y7 �ŒÏ7 �Œ"7 �Œ7 Œá7 ŒÓ# 1 ƒd{  –—†7  sw Y   ŒãxY w# t        $ r5}t        j!                  d«       t#        |«      j$                  }Y d}~�Œd}~ww xY w# d‰
_        ‰j                  j)                  d‰j                  › �d«       w xY w7 ŒÊ7 ŒŸ­w)zS-c once more: look through every connected channel for links to the source's posts.Nr¡   z/Links can be updated once everything is copied.r=  T)r?   r@   rA   rB   rF   rJ   rü   rÆ   c           	   “  óx  •K  — t        j                  «       ‰d   z
  dk  ry t        j                  «       ‰d<   	 t        ‰t        | d¬«      t	        j
                  dd‰j                  › �«      gg«      ƒ d {  –—†  y 7 Œ# t        j                  $ r Y y t        $ r t        j                  dd¬	«       Y y w xY w­w)
Nr   rS   zPointing links at the copiesr   r  r  r  Tr  )rM   rN   r   r   r   r­   rª   r   r  rÌ   r  r  )rP   ré   rj   r²   s    €€€r;   rÎ   z(register.<locals>.cb_links.<locals>.progç  s¶   øè ø€ Ü�~‰~Ó $ q¡'Ñ)¨AÒ-ØÜ—n‘nÓ&ˆD�‰GðCÜ+Øœ=¨Ð2PÔQÔU[×UbÑUbÐcmÐquÐvx×v{Ñv{Ðu|Ðo}ÓU~ÐTð  TAó÷ ò ùô ×1Ñ1ò ÙÜò CÜ—	‘	Ð2¸T�	ÖBðCüsF   ƒ6B:º>B  Á8A>Á9B  Á=B:Á>B  Â B7ÂB:ÂB7Â4B:Â6B7Â7B:u@   ðŸ”— Looking for links to the source's posts in your channelsâ€¦c                 ó   •— ‰ j                   S r  r  r  s   €r;   r  z,register.<locals>.cb_links.<locals>.<lambda>ú  s	   ø€ ¨¯ªr:   )r�   rÏ   r  Úresultz.pointing the links at the shifted posts failedFzthe copies in )r—   zLinks could not be updated (r%  u    ðŸ”— There is nothing to change.rÁ   rv   )r   r¯   r   rÝ   rÞ   r=   ræ   rª   rç   r   r   r   r$   rè   rÌ   r  Ú	exceptionÚtyper4   rF   r÷   r   r%   rz   rZ   r�   )ré   rø   rA   r
  rÎ   rà   rì   r8  rc   rº   r  rj   r²   rñ   rò   ró   r¼   Úloadr½   s   `         @@@€€€€€€r;   Úcb_linkszregister.<locals>.cb_linksÚ  s   üè ø€ ô 	�c˜5Ô!Ù˜U›×#‰ˆˆCØ�9‰9˜Ò ÜÐMÓNÐNØ�8‰8�?‰?ÔÜÐ<Ó=Ð=Ü˜EŸO™O°¸4ÀdÐTXÐce×chÑchÔiˆØ&)ˆ�‰�d˜2Ÿ5™5˜'�NÑ#Ü!“m c Uˆˆˆtö	Cð ˆð	2Ø—x—x“xÜ+¨EÐ3uÓv×vÐvÜ(Ø˜B ¤I¨b£M°3¸c¿n¹nÐW[Û 0¸ô÷ ð ÷  —xð  ˆCŒKØ�K‰K�O‰O˜d 2§5¡5 '˜N¨DÔ1Ü˜U¨>¼#¸c¿i¹i».Ð9IÐ)JÔKˆÙØ�L‰LÐ7¼¸E»
°|À2ÐFÔGÙØ�L‰LÐ;Ô<Ù! "›×%‰ˆˆbÜ# E¨4°&©=¸4¿9¹9ÀUÓ;KÑ+KÈRÓP×PÑPðU $ùð0  ùØvùðøð  ø—x—x‘xûô ò 	%Ü�M‰MÐJÔKÜ˜“G×$Ñ$ŽEûð	%ûð  ˆCŒKØ�K‰K�O‰O˜d 2§5¡5 '˜N¨DÕ1úð &øØPúsÑ   ‡J
ŸG. BJ
Â?H ÃG1ÃH ÃG;Ã#G4Ã$1G;ÄG7ÄG;ÄH Ä%G9Ä&H Ä*BJ
Æ;JÆ<,J
Ç(JÇ)J
Ç1H Ç4G;Ç7G;Ç9H Ç;HÈHÈHÈ	H È	IÈ*I	ÉI É	IÉI É2JÊJ
ÊJ
Úsfpc           	   “  ó  •K  — t        ‰	| «        ‰|«      ƒ d{  –—† \  }}d‰
j                  |j                  «      ƒ d{  –—† vrt        d«      ‚|j                  dvrt        d«      ‚‰	j
                  j                  «       rt        d«      ‚t        «       }‰	j
                  4 ƒd{  –—†  t        | dt        |j                  «      › d�«      ƒ d{  –—†  t        ‰‰
||| j                  |«      ƒ d{  –—†  ddd«      ƒd{  –—†  ‰
j                  |j                  «      ƒ d{  –—† xs |}|j                  � t!        |j                  |j"                  «      ng }|j$                  r(|j'                  d	t        |j$                  «      › d
�«        ‰|«      ƒ d{  –—† \  }}t        | |dz   dj)                  |«      z   |«      ƒ d{  –—†  y7 �Œ¹7 �Œ•7 �Œ/7 �Œ7 Œç7 ŒÙ# 1 ƒd{  –—†7  sw Y   ŒéxY w7 ŒÍ7 ŒY7 Œ.­w)z>-all once more: the name, description and photo of the source.Nr2   z%This shift was not started with -all.)r¡   r£   r  z(There is nothing to copy it to any more.r=  u0   ðŸ–¼ Copying the name, description and photo of rÉ   z5The name, description and photo could not be copied (r%  rÁ   rv   )r   r®   rª   r   r¯   rÝ   rÞ   r   r   r%   r«   r#   ræ   r§   r¨   r2   r   rz   Úprofile_errorrZ   r�   )ré   rø   r²   rA   Úholderr8  rc   rº   rò   ró   r¼   rU  r½   s           €€€€€r;   Ú
cb_profilezregister.<locals>.cb_profile
  sª  øè ø€ ô 	�c˜5Ô!Ù˜U›×#‰ˆˆCØ "§+¡+¨b¯e©eÓ"4×4Ñ4ÜÐCÓDÐDØ�9‰9Ð?Ñ?ÜÐFÓGÐGØ�8‰8�?‰?ÔÜÐ<Ó=Ð=Ü“ˆØ—8—8“8Ü'¨Ð1aÔbeÐfh×frÑfrÓbsÐatÐtwÐ/xÓy×yÐyÜ ¨¨B°°U·_±_ÀfÓM×MÐM÷ —8ð —N‘N 2×#4Ñ#4Ó5×5Ò<¸ˆØ<B¿N¹NÐ<V”˜fŸn™n¨c¯i©iÔ8Ð\^ˆØ×ÒØ�L‰LÐPÔQTÐU[×UiÑUiÓQjÐPkÐkmÐnÔoÙ! "›×%‰ˆˆbÜ# E¨4°&©=¸4¿9¹9ÀUÓ;KÑ+KÈRÓP×PÑPð! $ùØ4ùð ùØyùØMøð ø—8—8‘8úð 6øð &øØPús¿   ƒG?›Gœ&G?ÁGÁA(G?Â+GÂ,G?Â/'G$ÃGÃ!G$Ã8G Ã9G$Ã=G?ÄG"Ä	"G?Ä+G9Ä,A5G?Æ!G;Æ",G?ÇG=ÇG?ÇG?ÇG?ÇG$Ç G$Ç"G?Ç$G6Ç*G-Ç+G6Ç2G?Ç;G?Ç=G?c              “  óÎ   •K  — ‰j                  | d   «      ƒ d {  –—† }|€t        d«      ‚‰j                  |j                  «      ƒ d {  –—† }|€t        d«      ‚||fS 7 ŒE7 Œ­w)Nr   z!I don't know that shift any more.rû   )r-  r   r§   r¨   )rø   r²   rA   r¼   s      €r;   rU  zregister.<locals>.load!  si   øè ø€ Ø—<‘<  a¡Ó)×)ˆØˆ:ÜÐ?Ó@Ð@Ø—N‘N 2×#4Ñ#4Ó5×5ˆØˆ;ÜÐQÓRÐRØ�3ˆwˆð *øð 6ús!   ƒA%›A!œ/A%ÁA#ÁA%Á#A%Úsfbc              “  ó�   •K  —  ‰|«      ƒ d {  –—† \  }} ‰|«      ƒ d {  –—† \  }}t        | ||«      ƒ d {  –—†  y 7 Œ07 Œ7 Œ	­wr  )r   )ré   rø   r²   r)  rc   rº   rU  r½   s         €€r;   Úcb_backzregister.<locals>.cb_back*  sF   øè ø€ á˜5“k×!‰ˆˆAÙ! "›×%‰ˆˆbÜ# E¨4°Ó4×4Ñ4ð "øØ%øØ4ús/   ƒA�A �A¢A£AºA»AÁAÁAÚsfuc              “  óØ  •K  — t        ‰| «        ‰|«      ƒ d {  –—† \  }}‰j                  |j                  «      ƒ d {  –—† }|d   st        d«      ‚t	        | d|d   › dt        |j                  «      › dt        |j                  «      › d�t        j                  dd|j                  › �«      t        j                  d	d
|j                  › �«      gg«      ƒ d {  –—†  y 7 ŒÈ7 Œ¤7 Œ	­w)NÚnew_leftzThere is nothing to remove.u   â†©ï¸� <b>Remove the z copied message(s) from z?</b>
The posts in z are not touched.u   â†©ï¸� Yes, remove the copiesúsfuy:ÚBackzsfb:)
r   r©   rª   r   r   r%   rz   r«   r   r­   )ré   rø   r²   rA   rP   ró   r¼   rU  s        €€€r;   Úcb_undo_askzregister.<locals>.cb_undo_ask0  sã   øè ø€ ä�c˜5Ô!Ù˜U›×#‰ˆˆCØ—/‘/ "§%¡%Ó(×(ˆØ�Š}ÜÐ9Ó:Ð:Ü#ØØ# A j¡M ?Ð2JÌ3ÈsÏyÉyË>ÐJZð [Ü §¡Ó-Ð.Ð.?ðAä�m‰mÐ;¸uÀRÇUÁUÀG¸_ÓMÌvÏ}É}Ð]cÐgkÐln×lqÑlqÐkrÐesÓOtÐuÐvó	
÷ 	
ñ 	
ð	 $øØ(øð	
ús4   ƒC*›C$œ%C*ÁC&ÁBC*ÃC(ÃC*Ã&C*Ã(C*Úsfuyc              “  ó¨  •‡ ‡K  — t        ‰‰ «        ‰|«      ƒ d {  –—† \  }}‰j                  j                  «       rt        d«      ‚‰j                  �#‰j                  j                  |«      ƒ d {  –—† nd\  }}t        «       dgc}Šˆ ˆfd„}	 ‰j                  4 ƒd {  –—†  	 t        ‰‰|t        |«      |‰j                  ||¬«      ƒ d {  –—†  t        ‰‰||d|¬	«      ƒ d {  –—† }d d d «      ƒd {  –—†  |�|j                  «       ƒ d {  –—†  	 t!        |d¬
«      }	|	rddj#                  |	«      z   nd}
j$                  dk(  rk|j&                  s_‰j)                  |j*                  d«      ƒ d {  –—†  t-        ‰ d|j.                  › dt1        |j2                  «      › d|
› �«      ƒ d {  –—†  y t1        t5        ‰j                  |j&                  |j6                  |j8                  ¬«      «      }t-        ‰ d|j.                  › d|j$                  › d|› |
› �t;        j<                  dd|j*                  › �«      gg«      ƒ d {  –—†  y 7 �Œ57 �Œá7 �Œµ7 �Œ‰# t        $ r  t        j                  d«       d|_        Y �Œ¯w xY w7 �ŒŸ7 �Œ’# 1 ƒd {  –—†7  sw Y   �Œ£xY w7 �Œ‘# |�|j                  «       ƒ d {  –—†7   w w xY w7 �ŒP7 �Œ7 Œƒ­w)Nr=  )NNrÆ   c              “  ó  •K  — t        j                  «       ‰d   z
  dk  ry t        j                  «       ‰d<   	 t        ‰t        | d¬«      «      ƒ d {  –—†  y 7 Œ# t        $ r t
        j                  dd¬«       Y y w xY w­w)Nr   rS   z)Pointing links back at the source's postsr   r  Tr  )rM   rN   r   r   rÌ   r  r  )rP   ré   rj   s    €€r;   rÎ   z'register.<locals>.cb_undo.<locals>.progG  sq   øè ø€ Ü�~‰~Ó $ q¡'Ñ)¨AÒ-ØÜ—n‘nÓ&ˆD�‰GðCÜ+¨E´=ÀÐJuÔ3vÓw×wÒwùÜò CÜ—	‘	Ð2¸T�	ÖBðCüs:   ƒ6BºA ÁAÁA ÁBÁA Á A?Á<BÁ>A?Á?B)r�   rÏ   rR  z4pointing the links back at the source's posts failedTg      à?)r�   Úfallback)Úbackrv   rH   r   r¢   u   â†©ï¸� Done. z  copied message(s) removed from z; the source was not touched.)Ú	bot_errorÚfallback_errorÚtriedu   âš ï¸� Removed rm   z copy/copies are still there. u   ðŸ”� Try againrc  )r   rÝ   rÞ   r   ÚuserbotÚfallback_forr   r   r$   rè   rÌ   r  rS  r£   r    Úcloser   r�   Ú	remainingrà   r.  rª   r   Údeletedr%   rz   r)   rl  Útried_userbotr   r­   )ré   rø   r²   rA   ri  Údeleterrj  rÎ   r  Ú
link_notesÚ	link_textrî   rj   rñ   rò   ró   r¼   rU  s   `           @€€€€€r;   Úcb_undozregister.<locals>.cb_undo>  s³  úè ø€ ä�c˜5Ô!Ù˜U›×#‰ˆˆCØ�8‰8�?‰?ÔÜÐ<Ó=Ð=ØCFÇ;Á;ÐCZ #§+¡+×":Ñ":¸3Ó"?×?Ð?Ð`lÑˆ�'Ü “] S Eˆ
ˆˆdõ	Cð
	&Ø—x—x“xð(Ü2°6¸2¸rÄ9ÈRÃ=ÐRUÐ]`×]kÑ]kÐvzð  DHô  I÷  Ið  Iô 0°¸¸CÀÈ3ÐYaÔb×b�÷  —xð Ð"Ø—m‘m“o×%Ñ%Ü! $¨TÔ2ˆ
Ù6@�T˜DŸI™I jÓ1Ò1Àbˆ	Ø�=‰=˜AÒ c§i¢iØ×%Ñ% b§e¡eÐ-=Ó>×>Ð>Ü'ØØ §¡˜}Ð,LÌSÐQT×QZÑQZË^ÐL\Ð\yð  {Dð  zEð  Fó÷ ñ ô
 Ô)¨#¯+©+ÀÇÁÐ[^×[mÑ[mÐux÷  vGñ  vGô  Hó  IˆCÜ'ØØ! #§+¡+ ¨b°·±°Ð?]Ð^aÐ]bÐclÐbmÐnÜ—-‘-Ð 0°E¸"¿%¹%¸°/ÓBÐCÐDó÷ ñ ðI $ùð @ùð  ùð IúÜ ò (Ü—M‘MÐ"XÔYØ#'�D—Lð(úð cùð  ù—x—x’xúð &úð Ð"Ø—m‘m“o×%Ò%ð #úð
 ?ùðùðús  …K�IžAKÁ4IÁ5KÂJ) Â#IÂ$J) Â'JÂ))IÃIÃIÃJÃ+J
Ã,JÃ0J) Ã;JÃ<J) Ä KÄJ&ÄA$KÅ:K
Å;9KÆ4KÆ5BKÉKÉKÉKÉJ) ÉIÉ%JÊJÊJÊJÊJ) ÊJ#ÊJÊJ#ÊJ) Ê&KÊ)KÊ?KË KËKËKËKr  )r  rI   r  zOptional[ShiftJob]ÚreturnÚNone)rò   r¼   rñ   Úonr   r   r   )ró   rô   rù   rF  rI  rM  rV  r[  r_  re  rw  rñ   rò   r¼   rU  r:  r½   s   `          @@@@@@r;   Úregisterr{  ß   sp  þ€ Ø—j‘j #§&¡&¨#¯'©'€O€FˆB�ô*ðZ ‡Y�YŒs�7 Ô&Ó'Ü
ˆ3�dÔ÷Isó ó (ðIsôV ˆ3�ÓóNó ðN÷Bdò BdôH ˆ3�Óö(ó ð(ô8 ˆ3�Óõ%ó ð%ô ˆ3�Óó7ó ð7ô ˆ3�Ó÷-Qð -Qó ð-Qô^ ˆ3�Ó÷Qó ðQô,ô ˆ3�Óô5ó ð5ô
 ˆ3�Óõ
ó ð
ô ˆ3�Ó÷*ó ñ*r:   )rb   rI   rx  Útuple)Nr   T)rŽ   r   r@   r
   rA   r
   rC   r>   r�   rK   rE   zOptional[ShiftFlags]r�   r>   r‘   r0   rx  rI   )ró   r   rx  ry  )Fr7   Ú
__future__r   ÚloggingrT   rä   rM   Údataclassesr   r   Útypingr   Útelethonr   r   Ú
channelrefr
   r   Úcommonr   r   r   r   r   r   r   r   r   Ú
crosslinksr   r   r   r   r   Úprofile_copyr   Úrepost_enginer   r   r   r   r   Úshift_enginer    r!   r"   r#   r$   Útgutilr%   r&   r'   r(   rn  r)   Úrepostr+   r,   r-   Ú	getLoggerr4   r  rØ   r/   r=   ÚcompilerX   rk   rš   r{  r9   r:   r;   Ú<module>rŒ     s"  ðÙ lÝ "ã Û 	Û Û ß (Ý ç #ç 4ß p× pÕ pß oÕ oÝ (ß ^Õ ^ß gÕ gß <Ó <Ý )ß EÑ Eà€g×Ñ˜Ó!€ðKð ð0 ÷ð ó ðð ÷;ð ;ó ð;ð ˆ"�*‰*ÐFÓ
G€ó!0ðJ ptØ(,ðkØðkØ"ðkØ)3ðkØ>AðkØJOðkØXlðkàðkà!%ðkð 	ókô\Jr:   