@@ -132,6 +132,7 @@ def __init__(self):
132132 self .is_file = False
133133 self .bot_trans = False
134134 self .user_trans = False
135+ self .is_rss = False
135136 self .progress = True
136137 self .ffmpeg_cmds = None
137138 self .chat_thread_id = None
@@ -450,6 +451,9 @@ async def before_start(self):
450451 except Exception :
451452 chat = None
452453 if chat is None :
454+ LOGGER .warning (
455+ "Account of user session can't find the the destination chat!"
456+ )
453457 self .user_transmission = False
454458 self .hybrid_leech = False
455459 else :
@@ -462,14 +466,23 @@ async def before_start(self):
462466 ]:
463467 self .user_transmission = False
464468 self .hybrid_leech = False
465- else :
466- member = await chat .get_member (uploader_id )
469+ elif chat . is_admin :
470+ member = await chat .get_member (TgClient . user . me . id )
467471 if (
468472 not member .privileges .can_manage_chat
469473 or not member .privileges .can_delete_messages
470474 ):
471475 self .user_transmission = False
472476 self .hybrid_leech = False
477+ LOGGER .warning (
478+ "Enable manage chat and delete messages to account of the user session from administration settings!"
479+ )
480+ else :
481+ LOGGER .warning (
482+ "Promote the account of the user session to admin in the chat to get the benefit of user transmission!"
483+ )
484+ self .user_transmission = False
485+ self .hybrid_leech = False
473486
474487 if not self .user_transmission or self .hybrid_leech :
475488 try :
@@ -482,23 +495,28 @@ async def before_start(self):
482495 else :
483496 raise ValueError ("Chat not found!" )
484497 else :
485- uploader_id = self .client .me .id
486498 if chat .type .name in [
487499 "SUPERGROUP" ,
488500 "CHANNEL" ,
489501 "GROUP" ,
490502 "FORUM" ,
491503 ]:
492- member = await chat .get_member (uploader_id )
493- if (
494- not member .privileges .can_manage_chat
495- or not member .privileges .can_delete_messages
496- ):
497- if not self .user_transmission :
498- raise ValueError (
499- "You don't have enough privileges in this chat!" ,
500- )
501- self .hybrid_leech = False
504+ if not chat .is_admin :
505+ raise ValueError (
506+ "Bot is not admin in the destination chat!"
507+ )
508+ else :
509+ member = await chat .get_member (self .client .me .id )
510+ if (
511+ not member .privileges .can_manage_chat
512+ or not member .privileges .can_delete_messages
513+ ):
514+ if not self .user_transmission :
515+ raise ValueError (
516+ "You don't have enough privileges in this chat! Enable manage chat and delete messages for this bot!"
517+ )
518+ else :
519+ self .hybrid_leech = False
502520 else :
503521 try :
504522 await self .client .send_chat_action (
@@ -632,6 +650,7 @@ def get_cleaned_value(value, default, allowed=None, to_lower=False):
632650
633651 async def get_tag (self , text : list ):
634652 if len (text ) > 1 and text [1 ].startswith ("Tag: " ):
653+ self .is_rss = True
635654 user_info = text [1 ].split ("Tag: " )
636655 if len (user_info ) >= 3 :
637656 id_ = user_info [- 1 ]
@@ -1014,6 +1033,8 @@ def perform_substitution(name, substitutions):
10141033 for substitution in substitutions :
10151034 sen = False
10161035 pattern = substitution [0 ]
1036+ if pattern .startswith ('"' ) and pattern .endswith ('"' ):
1037+ pattern = pattern .strip ('"' )
10171038 if len (substitution ) > 1 :
10181039 if len (substitution ) > 2 :
10191040 sen = substitution [2 ] == "s"
@@ -1026,7 +1047,7 @@ def perform_substitution(name, substitutions):
10261047 res = ""
10271048 try :
10281049 name = sub (
1029- rf" { pattern } " ,
1050+ pattern ,
10301051 res ,
10311052 name ,
10321053 flags = IGNORECASE if sen else 0 ,
0 commit comments