@@ -379,21 +379,37 @@ async def before_start(self):
379379 except :
380380 chat = None
381381 if chat is None :
382+ LOGGER .warning (
383+ "Account of user session can't find the the destination chat!"
384+ )
382385 self .user_transmission = False
383386 self .hybrid_leech = False
384387 else :
385- uploader_id = TgClient .user .me .id
386- if chat .type .name not in ["SUPERGROUP" , "CHANNEL" , "GROUP" ]:
388+ if chat .type .name not in [
389+ "SUPERGROUP" ,
390+ "CHANNEL" ,
391+ "GROUP" ,
392+ "FORUM" ,
393+ ]:
387394 self .user_transmission = False
388395 self .hybrid_leech = False
389- else :
390- member = await chat .get_member (uploader_id )
396+ elif chat . is_admin :
397+ member = await chat .get_member (TgClient . user . me . id )
391398 if (
392399 not member .privileges .can_manage_chat
393400 or not member .privileges .can_delete_messages
394401 ):
395402 self .user_transmission = False
396403 self .hybrid_leech = False
404+ LOGGER .warning (
405+ "Enable manage chat and delete messages to account of the user session from administration settings!"
406+ )
407+ else :
408+ LOGGER .warning (
409+ "Promote the account of the user session to admin in the chat to get the benefit of user transmission!"
410+ )
411+ self .user_transmission = False
412+ self .hybrid_leech = False
397413
398414 if not self .user_transmission or self .hybrid_leech :
399415 try :
@@ -406,19 +422,28 @@ async def before_start(self):
406422 else :
407423 raise ValueError ("Chat not found!" )
408424 else :
409- uploader_id = self .client .me .id
410- if chat .type .name in ["SUPERGROUP" , "CHANNEL" , "GROUP" ]:
411- member = await chat .get_member (uploader_id )
412- if (
413- not member .privileges .can_manage_chat
414- or not member .privileges .can_delete_messages
415- ):
416- if not self .user_transmission :
417- raise ValueError (
418- "You don't have enough privileges in this chat!"
419- )
420- else :
421- self .hybrid_leech = False
425+ if chat .type .name in [
426+ "SUPERGROUP" ,
427+ "CHANNEL" ,
428+ "GROUP" ,
429+ "FORUM" ,
430+ ]:
431+ if not chat .is_admin :
432+ raise ValueError (
433+ "Bot is not admin in the destination chat!"
434+ )
435+ else :
436+ member = await chat .get_member (self .client .me .id )
437+ if (
438+ not member .privileges .can_manage_chat
439+ or not member .privileges .can_delete_messages
440+ ):
441+ if not self .user_transmission :
442+ raise ValueError (
443+ "You don't have enough privileges in this chat! Enable manage chat and delete messages for this bot!"
444+ )
445+ else :
446+ self .hybrid_leech = False
422447 else :
423448 try :
424449 await self .client .send_chat_action (
0 commit comments