
    Ch                     2    d dl m Z  d dlZd Zd ZddZd Zy)    )tqdmNc                 L   | j                  |      }| j                  |      }|s(| j                  j                  dt	        |      z         y|j                  d      }| j                  r.dj                  ||      }| j                  j                  |       n!| j                  dj                  ||             | j                  |d      ry| j                  d      s| j                  d   rC| j                  j                  d	       | j                  r| j                  j                  d
       y| j                  d       | j                  j!                  |      }|dk(  r%| j                  j#                  d       | j$                  s7| j                  r*| j                  j                  d       d| j                  d<   y| j&                  d   ra| j                  rU| j                  j                  d       | j                  j                  d       d| j&                  d<   d| j                  d<   y| j                  j                  d| j(                  z         d| j&                  d<   t+        j,                  | j(                         y|r| j                  r.dj                  ||      }| j                  j                  |       n$d}| j                  |j                  ||      d       | j.                  j1                  |       | j2                  dxx   dz  cc<   || j4                  v r| j4                  j7                  |       | j$                  r9| j&                  d   r*| j                  j                  d       d| j&                  d<   yy| j                  j                  d       y)NzCan't get user_id=%s infoFusernamez0Going to unfollow `user_id` {} with username {}.z6===> Going to unfollow `user_id`: {} with username: {}T)unfollowing	unfollowsz!YOUR `UNFOLLOW` ACTION IS BLOCKEDz>blocked_actions_protection ACTIVE. Skipping `unfollow` action.unfollowfeedback_requiredz(`Unfollow` action has been BLOCKED...!!!zTActivating blocked actions                         protection for `Unfollow` action.zEThis is the second blocked                         `Unfollow` action.zK`Unfollow` action is going to sleep                         for %s seconds.z(Unfollowed `user_id` {} with username {}z-===> Unfollowed, `user_id`: {}, user_name: {}yellow   z(`Unfollow` action is no longer sleeping.Out of unfollows for today.)convert_to_user_idget_user_infologgerinfostrgetlog_follow_unfollowformatconsole_print
check_userreached_limitblocked_actionswarningblocked_actions_protectiondelayapir   errorblocked_actions_sleepsleeping_actionsblocked_actions_sleep_delaytimesleepunfollowed_fileappendtotal	followingremove)selfuser_id	user_infor   msg_rs         d/var/www/html/Telegram-Engagement-Pod-/env/lib/python3.12/site-packages/instabot/bot/bot_unfollow.pyr   r      s:   %%g.G""7+I4s7|CD}}Z(H@GGX
 	DKK	
 wD1k*,KK CD..##W 

:XXw'$$KKHI--22KK''; 9=D((50 + ))+677KK'', KK''; :?D))+68<D((5  KK$$)::;
 :>D))+6JJt??@''@GGX   %E""3::gx#@(K  ''0JJ{#q(#$..(%%g.))d.C.CK.P  !KL5:%%k2  	67    c                    g }| j                   j                  dj                  t        |                   t	        t        t        |            }t        t	        |      t	        | j                        z
        }t        |      t        |      k7  r3| j                   j                  dj                  t        |                   t        |d      D ];  }| j                  |      r| j                          |j                  |      }||d  } n | j                   j                  dj                  | j                  d                |S )NzGoing to unfollow {} users.z,After filtration by whitelist {} users left.zProcessed users)descz DONE: Total unfollowed {} users.r   )r   r   r   lensetmapr   list	whitelistr   r   error_delayindexr%   )r(   user_idsbroken_itemsfiltered_user_idsr)   is         r-   unfollow_usersr<   ^   s   LKK299#h-HI3sH%&HS]S-@@A
X.:AA%&	

 )0AB}}W%!''0A,QR0L C 	KK7>>tzz+?VWXr.   c                    | j                   j                  d       | j                  dd       t        | j                        t        | j
                        z
  | j                  j                  z
  }t        |      }t        |d |       D ]A  }| j                  d      r| j                   j                  d        n| j                  |       C | j                  dd       y )NzUnfollowing non-followers.z* ===> Start unfollowing non-followers <===redr   r   z' ===> Unfollow non-followers done! <===)r   r   r   r2   r&   	followersfriends_filer4   r   r   r   )r(   n_to_unfollowsnon_followersr)   s       r-   unfollow_non_followersrC   s   s    KK12CUK'#dnn*==@Q@Q@U@UUM'Mo~67k*KK:;g	 8
 	@%Hr.   c                 :    | j                  | j                         y N)r<   r&   )r(   s    r-   unfollow_everyonerF      s    'r.   rE   )r   r!   r   r<   rC   rF    r.   r-   <module>rH      s"     Vr*
I(r.   