def lang(message): arr = extract_args(message).split(' ', 1) util = arr[0].lower() arg = arr[1].lower() if util == "trt": scraper = f'{get_translation("scraper1")}' global TRT_LANG if arg in LANGUAGES: TRT_LANG = arg LANG = LANGUAGES[arg] else: edit(message, get_translation("scraperTrt", ['`', LANGUAGES])) return elif util == "tts": scraper = f'{get_translation("scraper2")}' global TTS_LANG if arg in tts_langs(): TTS_LANG = arg LANG = tts_langs()[arg] else: edit(message, get_translation("scraperTts", ['`', tts_langs()])) return edit(message, get_translation("scraperResult", ['`', scraper, LANG.title()])) send_log(get_translation("scraperLog", ['`', scraper, LANG.title()]))
def type_afk_is_not_true(message): if TEMP_SETTINGS['IS_AFK']: TEMP_SETTINGS['IS_AFK'] = False reply(message, f'**{get_translation("afkEnd")}**') sleep(2) send_log( get_translation( 'afkMessages', [ '`', '**', str(len(TEMP_SETTINGS['AFK_USERS'])), str(TEMP_SETTINGS['COUNT_MSG']), ], )) for i in TEMP_SETTINGS['AFK_USERS']: name = app.get_chat(i) name0 = str(name.first_name) send_log( get_translation( 'afkMentionUsers', [ '**', name0, str(i), '`', str(TEMP_SETTINGS['AFK_USERS'][i]) ], )) TEMP_SETTINGS['COUNT_MSG'] = 0 TEMP_SETTINGS['AFK_USERS'] = {} if 'AFK_REASON' in TEMP_SETTINGS: del TEMP_SETTINGS['AFK_REASON'] raise ContinuePropagation
def purge(client, message): msg = message.reply_to_message if msg: itermsg = list(range(msg.id, message.id)) else: edit(message, f'`{get_translation("purgeUsage")}`') return count = 0 for i in itermsg: try: count = count + 1 client.delete_messages(chat_id=message.chat.id, message_ids=i, revoke=True) except FloodWait as e: sleep(e.x) except Exception as e: edit(message, get_translation('purgeError', ['`', '**', e])) return done = reply(message, get_translation('purgeResult', ['**', '`', str(count)])) send_log(get_translation('purgeLog', ['**', '`', str(count)])) sleep(2) message.delete() done.delete()
def save_note(message): try: from sedenecem.sql.notes_sql import add_note except AttributeError: edit(message, f'`{get_translation("nonSqlMode")}`') return args = extract_args(message, markdown=True).split(' ', 1) if len(args) < 1 or len(args[0]) < 1: edit(message, f'`{get_translation("wrongCommand")}`') return keyword = args[0] string = args[1] if len(args) > 1 else '' msg = message.reply_to_message msg_id = None if len(string) < 1: if msg: if msg.text: string = msg.text.markdown else: string = None msg_o = forward(msg, LOG_ID) if not msg_o: edit(message, f'`{get_translation("noteError")}`') return msg_id = msg_o.id send_log(get_translation('notesLog', ['`', message.chat.id, keyword])) else: edit(message, f'`{get_translation("wrongCommand")}`') if add_note(str(message.chat.id), keyword, string, msg_id) is False: edit(message, get_translation('notesUpdated', ['`', keyword])) else: edit(message, get_translation('notesAdded', ['`', keyword]))
def ddgo(message): query = extract_args(message) if len(query) < 1: edit(message, f'`{get_translation("wrongCommand")}`') return req = get( f'https://duckduckgo.com/lite?q={query}', headers={ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64)' 'AppleWebKit/537.36 (KHTML, like Gecko)' 'Chrome/81.0.4044.138 Safari/537.36', 'Content-Type': 'text/html', }, ) soup = BeautifulSoup(req.text, 'html.parser') res1 = soup.findAll('table', {'border': 0}) res1 = res1[-1].findAll('tr') match = do_ddsearch(res1) edit( message, get_translation('googleResult', ['**', '`', query, match]), preview=False, ) send_log(get_translation('ddgoLog', [query]))
def add_filter(message): try: from sedenecem.sql.filters_sql import add_filter except BaseException: edit(message, f'`{get_translation("nonSqlMode")}`') return args = extract_args(message, markdown=True).split(' ', 1) if len(args) < 1 or len(args[0]) < 1: edit(message, f'`{get_translation("wrongCommand")}`') return keyword = args[0] string = args[1] if len(args) > 1 else '' msg = message.reply_to_message msg_id = None if len(string) < 1: if msg: if msg.text: string = msg.text.markdown else: string = None msg_o = forward(msg, LOG_ID) if not msg_o: edit(message, f'`{get_translation("filterError")}`') return msg_id = msg_o.message_id send_log(get_translation('filterLog', ['`', message.chat.id, keyword])) else: edit(message, f'`{get_translation("wrongCommand")}`') if add_filter(str(message.chat.id), keyword, string, msg_id): edit(message, get_translation('filterAdded', ['**', '`', keyword])) else: edit(message, get_translation('filterUpdated', ['**', '`', keyword]))
def wiki(message): args = extract_args(message) if len(args) < 1: edit(message, f'`{get_translation("wrongCommand")}`') return set_lang(SEDEN_LANG) try: summary(args) except DisambiguationError as error: edit(message, get_translation('wikiError', [error])) return except PageError as pageerror: edit(message, get_translation('wikiError2', [pageerror])) return result = summary(args) if len(result) >= 4096: file = open('wiki.txt', 'w+') file.write(result) file.close() reply_doc( message, 'wiki.txt', caption=f'`{get_translation("outputTooLarge")}`', delete_after_send=True, ) edit(message, get_translation('sedenQuery', ['**', '`', args, result])) send_log(get_translation('wikiLog', ['`', args]))
def approvepm(client, message): try: from sedenecem.sql.pm_permit_sql import approve except BaseException: edit(message, f'`{get_translation("nonSqlMode")}`') return if message.reply_to_message: reply = message.reply_to_message replied_user = reply.from_user if replied_user.is_self: edit(message, f'`{get_translation("cannotApproveMyself")}`') return aname = replied_user.id name0 = str(replied_user.first_name) uid = replied_user.id else: aname = message.chat if not aname.type == 'private': edit(message, f'`{get_translation("pmApproveError")}`') return name0 = aname.first_name uid = aname.id try: approve(uid) for message in _find_unapproved_msg(client, message.chat.id): message.delete() except IntegrityError: edit(message, f'`{get_translation("pmApproveError2")}`') return edit(message, get_translation("pmApproveSuccess", [name0, uid, '`'])) send_log(get_translation("pmApproveLog", [name0, uid]))
def lang(message): arr = extract_args(message).split(' ', 1) if len(arr) != 2: edit(message, f'`{get_translation("wrongCommand")}`') return util = arr[0].lower() arg = arr[1].lower() if util == 'trt': scraper = get_translation('scraper1') global TRT_LANG if arg in LANGUAGES: TRT_LANG = arg LANG = LANGUAGES[arg] else: edit(message, get_translation('scraperTrt', ['`', LANGUAGES])) return elif util == 'tts': scraper = get_translation('scraper2') global TTS_LANG if arg in tts_langs(): TTS_LANG = arg LANG = tts_langs()[arg] else: edit(message, get_translation('scraperTts', ['`', tts_langs()])) return edit(message, get_translation('scraperResult', ['`', scraper, LANG.title()])) send_log(get_translation('scraperLog', ['`', scraper, LANG.title()]))
def trt(message): translator = Translator() textx = message.reply_to_message trt = extract_args(message) if trt: pass elif textx: trt = textx.text else: edit(message, f'{get_translation("trtUsage")}') return try: reply_text = translator.translate(deEmojify(trt), dest=TRT_LANG) except ValueError: edit(message, f'{get_translation("trtError")}') return source_lan = LANGUAGES[f'{reply_text.src.lower()}'] transl_lan = LANGUAGES[f'{reply_text.dest.lower()}'] reply_text = '{}\n\n{}'.format( get_translation( 'transHeader', ['**', '`', source_lan.title(), transl_lan.title()]), reply_text.text) edit(message, reply_text) send_log(get_translation( 'trtLog', [source_lan.title(), transl_lan.title()]))
def disapprovepm(message): try: from sedenecem.sql.pm_permit_sql import dissprove except BaseException: edit(message, f'`{get_translation("nonSqlMode")}`') return if message.reply_to_message: reply = message.reply_to_message replied_user = reply.from_user if replied_user.is_self: edit(message, f'`{get_translation("cannotDisapproveMyself")}`') return aname = replied_user.id name0 = str(replied_user.first_name) uid = replied_user.id else: aname = message.chat if not aname.type == 'private': edit(message, f'`{get_translation("pmApproveError")}`') return name0 = aname.first_name uid = aname.id dissprove(uid) edit(message, get_translation("pmDisapprove", [name0, uid, '`'])) send_log(get_translation("pmDisapprove", [name0, uid, '`']))
def wiki(message): match = extract_args(message) if len(match) < 1: edit(message, f'`{get_translation("wrongCommand")}`') return set_lang(SEDEN_LANG) match = extract_args(message) try: summary(match) except DisambiguationError as error: edit(message, get_translation('wikiError', [error])) return except PageError as pageerror: edit(message, get_translation('wikiError2', [pageerror])) return result = summary(match) if len(result) >= 4096: file = open('wiki.txt', 'w+') file.write(result) file.close() reply_doc(message, 'wiki.txt', caption=f'`{get_translation("outputTooLarge")}`') if path.exists('wiki.txt'): remove('wiki.txt') return edit(message, get_translation('sedenQuery', ['**', '`', match, result])) send_log(get_translation('wikiLog', ['`', match]))
def tts(message): textx = message.reply_to_message ttsx = extract_args(message) if ttsx: pass elif textx: ttsx = textx.text else: edit(message, f'`{get_translation("ttsUsage")}`') return try: gTTS(ttsx, lang=TTS_LANG) except AssertionError: edit(message, f'`{get_translation("ttsBlank")}`') return except ValueError: edit(message, f'`{get_translation("ttsNoSupport")}`') return except RuntimeError: edit(message, f'{get_translation("ttsError")}') return tts = gTTS(ttsx, lang=TTS_LANG) tts.save('h.mp3') with open('h.mp3', 'rb') as audio: linelist = list(audio) linecount = len(linelist) if linecount == 1: tts = gTTS(ttsx, lang=TTS_LANG) tts.save('h.mp3') with open('h.mp3', 'r'): reply_voice(message, 'h.mp3', delete_orig=True) remove('h.mp3') send_log(get_translation('ttsLog'))
def delayspam(message): # Copyright (c) @ReversedPosix | 2020-2021 delayspam = extract_args(message) arr = delayspam.split() if len(arr) < 3 or not arr[0].isdigit() or not arr[1].isdigit(): edit(message, f'`{get_translation("spamWrong")}`') return delay = int(arr[0]) count = int(arr[1]) spam_message = delayspam.replace(arr[0], '', 1) spam_message = spam_message.replace(arr[1], '', 1).strip() message.delete() if not spam_allowed(): return delaySpamEvent = Event() for i in range(0, count): if i != 0: delaySpamEvent.wait(delay) reply(message, spam_message) limit = increment_spam_count() if not limit: break send_log(get_translation('delayspamLog'))
def blockpm(client, message): if message.reply_to_message: reply = message.reply_to_message replied_user = reply.from_user if replied_user.is_self: edit(message, f'`{get_translation("cannotBlockMyself")}`') return aname = replied_user.id name0 = str(replied_user.first_name) uid = replied_user.id else: aname = message.chat if not aname.type == 'private': edit(message, f'`{get_translation("pmApproveError")}`') return name0 = aname.first_name uid = aname.id client.block_user(uid) edit(message, f'`{get_translation("pmBlocked")}`') try: from sedenecem.sql.pm_permit_sql import dissprove dissprove(uid) except BaseException: pass send_log(get_translation('pmBlockedLog', [name0, uid]))
def delayspam(message): """Copyright (c) @ReversedPosix | 2020""" delayspam = extract_args(message) arr = delayspam.split() if len(arr) < 3 or not arr[0].isdigit() or not arr[1].isdigit(): edit(message, f'`{get_translation("spamWrong")}`') return gecikme = int(arr[0]) miktar = int(arr[1]) spam_message = delayspam.replace(arr[0], '', 1) spam_message = spam_message.replace(arr[1], '', 1).strip() message.delete() if not spam_allowed(): return delaySpamEvent = Event() for i in range(0, miktar): if i != 0: delaySpamEvent.wait(gecikme) message.reply(spam_message) count = increment_spam_count() if not count: break send_log(f'{get_translation("delayspamLog")}')
def auto_accept(client, message): self_user = me[0] if message.chat.id not in [self_user.id, 777000]: try: from sedenecem.sql.pm_permit_sql import approve, is_approved except BaseException: return False chat = message.chat if is_approved(chat.id): return True for msg in client.get_history(chat.id, limit=3): if chat.id in PM_LAST_MSG and msg.text != PM_LAST_MSG[ chat.id] and msg.from_user.is_self: try: del PM_COUNT[chat.id] del PM_LAST_MSG[chat.id] except BaseException: pass try: approve(chat.id) for message in _find_unapproved_msg(client, chat.id): message.delete() send_log( get_translation("pmAutoAccept", [chat.first_name, chat.id])) return True except BaseException: pass return False
def permitpm(client, message): if message.from_user and message.from_user.is_self: message.continue_propagation() if not PM_AUTO_BAN: message.continue_propagation() else: if auto_accept(client, message): return self_user = me[0] if message.chat.id not in [self_user.id, 777000]: try: from sedenecem.sql.pm_permit_sql import is_approved except BaseException: pass apprv = is_approved(message.chat.id) notifsoff = is_muted(-1) if not apprv and message.text != UNAPPROVED_MSG: if message.chat.id in PM_LAST_MSG: prevmsg = PM_LAST_MSG[message.chat.id] if message.text != prevmsg: for message in _find_unapproved_msg( client, message.chat.id): message.delete() if PM_COUNT[message.chat.id] < (PM_MSG_COUNT - 1): ret = reply(message, UNAPPROVED_MSG) PM_LAST_MSG[message.chat.id] = ret.text else: ret = reply(message, UNAPPROVED_MSG) if ret.text: PM_LAST_MSG[message.chat.id] = ret.text if notifsoff: client.read_history(message.chat.id) if message.chat.id not in PM_COUNT: PM_COUNT[message.chat.id] = 1 else: PM_COUNT[message.chat.id] = PM_COUNT[message.chat.id] + 1 if PM_COUNT[message.chat.id] > (PM_MSG_COUNT - 1): reply(message, f'`{get_translation("pmpermitBlock")}`') try: del PM_COUNT[message.chat.id] del PM_LAST_MSG[message.chat.id] except BaseException: pass client.block_user(message.chat.id) send_log( get_translation( 'pmpermitLog', [message.chat.first_name, message.chat.id])) message.continue_propagation()
def promote_user(client, message): args = extract_args(message) reply = message.reply_to_message rank = None edit(message, f'`{get_translation("promoteProcess")}`') if reply: try: user_id = reply.from_user.id user = client.get_users(user_id) rank = args except Exception: return edit(message, f'`{get_translation("banFailUser")}`') elif ' ' not in args: try: user = client.get_users(args) except Exception: return edit(message, f'`{get_translation("banFailUser")}`') elif args: try: arr = args.split(' ', 1) user = client.get_users(arr[0]) rank = arr[1] except Exception: return edit(message, f'`{get_translation("banFailUser")}`') else: return edit(message, f'`{get_translation("banFailUser")}`') try: chat_id = message.chat.id client.promote_chat_member( chat_id, user.id, can_change_info=True, can_delete_messages=True, can_restrict_members=True, can_invite_users=True, can_pin_messages=True, can_promote_members=True, ) if rank is not None: if len(rank) > 16: rank = rank[:16] client.set_administrator_title(chat_id, user.id, rank) edit( message, get_translation('promoteResult', ['**', user.first_name, user.id, '`']), ) sleep(1) send_log( get_translation( 'promoteLog', [user.first_name, user.id, message.chat.title, '`', chat_id], ) ) except Exception as e: edit(message, get_translation('banError', ['`', '**', e])) return
def promote_user(client, message): args = extract_args(message) reply = message.reply_to_message rank = None edit(message, f'`{get_translation("promoteProcess")}`') find_user = extract_user(message) if len(find_user) < 1: return edit(message, f'`{get_translation("banFailUser")}`') if reply: if args: rank = args else: rank = '' else: text = args.split(' ', 1) if len(text) > 1: rank = text[1] else: rank = '' for user in find_user: try: chat = message.chat chat.promote_member( user.id, privileges=ChatPrivileges( can_manage_chat=True, can_delete_messages=True, can_manage_video_chats=True, can_restrict_members=True, can_change_info=True, can_invite_users=True, can_pin_messages=True, can_promote_members=True, ), ) if rank is not None: if len(rank) > 16: rank = rank[:16] client.set_administrator_title(chat.id, user.id, rank) edit( message, get_translation('promoteResult', ['**', user.first_name, user.id, '`']), ) sleep(1) send_log( get_translation( 'promoteLog', [user.first_name, user.id, chat.title, '`', chat.id], )) except Exception as e: edit(message, get_translation('banError', ['`', '**', e])) return
def gban_check(client, message): if sql.is_gbanned(message.from_user.id): try: user_id = message.from_user.id chat_id = message.chat.id client.kick_chat_member(chat_id, user_id) except BaseException as e: send_log(get_translation('banError', ['`', '**', e])) message.continue_propagation()
def ban_user(message): reply = message.reply_to_message edit(message, f'`{get_translation("banProcess")}`') find_user = extract_user(message) if len(find_user) < 1: return edit(message, f'`{get_translation("banFailUser")}`') reason = get_reason(message) try: replied_user = reply.from_user if replied_user.is_self: return edit(message, f'`{get_translation("cannotBanMyself")}`') except BaseException: pass for user in find_user: if user.id in BRAIN: return edit( message, get_translation('brainError', ['`', '**', user.first_name, user.id]), ) try: chat = message.chat chat.ban_member(user.id) edit( message, get_translation( 'banResult', [ '**', user.first_name, user.id, '`', reason if reason else '' ], ), ) sleep(1) send_log( get_translation( 'banLog', [ user.first_name, user.id, chat.title, '`', chat.id, reason if reason else '', ], )) except UserAdminInvalid: edit(message, f'`{get_translation("banAdminError")}`') except BaseException as e: edit(message, get_translation('banError', ['`', '**', e])) return
def kick_user(client, message): args = extract_args(message) reply = message.reply_to_message edit(message, f'`{get_translation("kickProcess")}`') if args: try: user = client.get_users(args) except Exception: edit(message, f'`{get_translation("banFailUser")}`') return elif reply: user_id = reply.from_user.id user = client.get_users(user_id) else: edit(message, f'`{get_translation("banFailUser")}`') return try: replied_user = reply.from_user if replied_user.is_self: return edit(message, f'`{get_translation("cannotKickMyself")}`') except BaseException: pass if user.id in BRAIN: return edit( message, get_translation('brainError', ['`', '**', user.first_name, user.id]), ) try: chat_id = message.chat.id client.kick_chat_member(chat_id, user.id) client.unban_chat_member(chat_id, user.id) edit( message, get_translation('kickResult', ['**', user.first_name, user.id, '`']), ) sleep(1) send_log( get_translation( 'kickLog', [ user.first_name, user.id, message.chat.title, '`', message.chat.id, ], )) except Exception as e: edit(message, get_translation('banError', ['`', '**', e])) return
def gmute_user(client, message): reply = message.reply_to_message edit(message, f'`{get_translation("muteProcess")}`') find_user = extract_user(message) if len(find_user) < 1: return edit(message, f'`{get_translation("banFailUser")}`') reason = get_reason(message) try: replied_user = reply.from_user if replied_user.is_self: return edit(message, f'`{get_translation("cannotMuteMyself")}`') except BaseException: pass for user in find_user: if user.id in BRAIN: return edit( message, get_translation('brainError', ['`', '**', user.first_name, user.id]), ) try: if sql2.is_gmuted(user.id): return edit(message, f'`{get_translation("alreadyMuted")}`') sql2.gmute(user.id) edit( message, get_translation( 'gmuteResult', [ '**', user.first_name, user.id, '`', reason if reason else '' ], ), ) try: common_chats = client.get_common_chats(user.id) for i in common_chats: i.restrict_member(user.id, permissions=ChatPermissions()) except BaseException: pass sleep(1) send_log( get_translation( 'gmuteLog', [user.first_name, user.id, '`', reason if reason else ''], )) except Exception as e: edit(message, get_translation('banError', ['`', '**', e])) return
def delete(client, message): msg_src = message.reply_to_message if msg_src: if msg_src.from_user.id: try: client.delete_messages(message.chat.id, msg_src.id) message.delete() send_log(f'`{get_translation("delResultLog")}`') except BaseException: send_log(f'`{get_translation("delErrorLog")}`') else: edit(message, f'`{get_translation("wrongCommand")}`')
def set_afk(message): args = extract_args(message) if len(args) > 0: TEMP_SETTINGS['AFK_REASON'] = args edit( message, get_translation( 'afkStartReason', [ '**', '`', TEMP_SETTINGS['AFK_REASON']])) else: edit(message, f'**{get_translation("afkStart")}**') send_log(get_translation('afkLog')) TEMP_SETTINGS['IS_AFK'] = True raise StopPropagation
def gban_user(client, message): args = extract_args(message) reply = message.reply_to_message edit(message, f'`{get_translation("banProcess")}`') if args: try: user = client.get_users(args) except Exception: edit(message, f'`{get_translation("banFailUser")}`') return elif reply: user_id = reply.from_user.id user = client.get_users(user_id) else: edit(message, f'`{get_translation("banFailUser")}`') return try: replied_user = reply.from_user if replied_user.is_self: return edit(message, f'`{get_translation("cannotBanMyself")}`') except BaseException: pass if user.id in BRAIN: return edit( message, get_translation('brainError', ['`', '**', user.first_name, user.id]), ) try: if sql.is_gbanned(user.id): return edit(message, f'`{get_translation("alreadyBanned")}`') sql.gban(user.id) edit( message, get_translation('gbanResult', ['**', user.first_name, user.id, '`']), ) try: common_chats = client.get_common_chats(user.id) for i in common_chats: i.kick_member(user.id) except BaseException: pass sleep(1) send_log(get_translation('gbanLog', [user.first_name, user.id])) except Exception as e: edit(message, get_translation('banError', ['`', '**', e])) return
def mute_user(client, message): args = extract_args(message) reply = message.reply_to_message edit(message, f'`{get_translation("muteProcess")}`') if len(args): try: user = client.get_users(args) except Exception: edit(message, f'`{get_translation("banFailUser")}`') return elif reply: user_id = reply.from_user.id user = client.get_users(user_id) else: edit(message, f'`{get_translation("banFailUser")}`') return try: replied_user = reply.from_user if replied_user.is_self: return edit(message, f'`{get_translation("cannotMuteMyself")}`') except BaseException: pass if user.id in BRAIN: return edit( message, get_translation('brainError', ['`', '**', user.first_name, user.id]), ) try: chat_id = message.chat.id if sql.is_muted(chat_id, user.id): return sql.mute(chat_id, user.id) edit( message, get_translation('muteResult', ['**', user.first_name, user.id, '`']), ) sleep(1) send_log( get_translation( 'muteLog', [user.first_name, user.id, message.chat.title, '`', chat_id], )) except Exception as e: edit(message, get_translation('banError', ['`', '**', e])) return
def zombie_accounts(client, message): args = extract_args(message).lower() chat_id = message.chat.id count = 0 msg = f'`{get_translation("zombiesNoAccount")}`' if args != 'clean': edit(message, f'`{get_translation("zombiesFind")}`') for i in client.iter_chat_members(chat_id): if i.user.is_deleted: count += 1 sleep(1) if count > 0: msg = get_translation('zombiesFound', ['**', '`', count]) return edit(message, msg) if not is_admin(message): edit(message, f'`{get_translation("adminUsage")}`') return message.continue_propagation() edit(message, f'`{get_translation("zombiesRemove")}`') count = 0 users = 0 for i in client.iter_chat_members(chat_id): if i.user.is_deleted: try: client.kick_chat_member(chat_id, i.user.id) except UserAdminInvalid: count -= 1 users += 1 except BaseException: return edit(message, f'`{get_translation("zombiesError")}`') client.unban_chat_member(chat_id, i.user.id) count += 1 if count > 0: msg = get_translation('zombiesResult', ['**', '`', count]) if users > 0: msg = get_translation('zombiesResult2', ['**', '`', count, users]) edit(message, msg) sleep(2) message.delete() send_log( get_translation('zombiesLog', ['**', '`', count, message.chat.title, chat_id]) )
def unblockpm(client, message): if message.reply_to_message: reply = message.reply_to_message replied_user = reply.from_user if replied_user.is_self: edit(message, f'`{get_translation("cannotUnblockMyself")}`') return name0 = str(replied_user.first_name) uid = replied_user.id client.unblock_user(uid) edit(message, f'`{get_translation("pmUnblocked")}`') send_log(get_translation('pmUnblockedLog', [name0, replied_user.id])) else: edit(message, f'`{get_translation("pmUnblockedUsage")}`')