def __user_info__(user_id): if user_id in [777000, 1087968824]: return """Groups count: <code>N/A</code>""" if user_id == dispatcher.bot.id: return """Groups count: <code>N/A</code>""" num_chats = sql.get_user_num_chats(user_id) return f"""Groups count: <code>{num_chats}</code>"""
def __user_info__(user_id): if user_id in [777000, 1087968824]: return """╘══「 Groups count: <code>???</code> 」""" if user_id == dispatcher.bot.id: return """I've seen them in... Wow. Are they stalking me? They're in all the same places I am... oh. It's me.""" num_chats = sql.get_user_num_chats(user_id) return """I've seen them in <code>{}</code> chats in total.""".format( num_chats)
def __user_info__(user_id, chat_id): if user_id == dispatcher.bot.id: return tld( chat_id, "I've seen them in... Wow. Are they stalking me? They're in all the same places I am... oh. It's me." ) num_chats = sql.get_user_num_chats(user_id) return tld( chat_id, "I've seen them in <code>{}</code> chats in total.").format(num_chats)
def info(bot: Bot, update: Update, args: List[str]): message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("Saya tidak dapat mengekstrak pengguna dari ini.") return else: return text = (f"<b>Karakteristik:</b>\n" f"ID: <code>{user.id}</code>\n" f"Nama depan: {html.escape(user.first_name)}") if user.last_name: text += f"\nNama Belakang: {html.escape(user.last_name)}" if user.username: text += f"\nNama pengguna: @{html.escape(user.username)}" text += f"\nTautan pengguna permanen: {mention_html(user.id, 'link')}" try: spamwtc = sw.get_ban(int(user.id)) if spamwtc: text += "\n\n<b>Orang ini dilarang di Spamwatch!</b>" text += f"\nAlasan: <pre>{spamwtc.reason}</pre>" text += "\nAppeal at @SpamWatchSupport" else: pass except: pass # don't crash if api is down somehow... Nation_level_present = False num_chats = sql.get_user_num_chats(user.id) text += f"\nJumlah obrolan: <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == "administrator": result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result["custom_title"] text += f"\nPengguna ini memiliki title <b>{custom_title}</b> disini." except BadRequest: pass if user.id == OWNER_ID: text += f'\nOrang ini adalah pemilik saya' Nation_level_present = True elif user.id in DEV_USERS: text += f'\nThis Person is a part of Eagle Union' Nation_level_present = True elif user.id in SUDO_USERS: text += f'\nThe Nation level of this person is Royal' Nation_level_present = True elif user.id in SUPPORT_USERS: text += f'\nThe Nation level of this person is Sakura' Nation_level_present = True elif user.id in SARDEGNA_USERS: text += f'\nThe Nation level of this person is Sardegna' Nation_level_present = True elif user.id in WHITELIST_USERS: text += f'\nThe Nation level of this person is Neptunia' Nation_level_present = True if Nation_level_present: text += ' [<a href="https://t.me/{}?start=nations">?</a>]'.format( bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info if INFOPIC: try: profile = bot.get_user_profile_photos(user.id).photos[0][-1] _file = bot.get_file(profile["file_id"]) _file.download(f"{user.id}.png") message.reply_document(document=open(f"{user.id}.png", "rb"), caption=(text), parse_mode=ParseMode.HTML, disable_web_page_preview=True) os.remove(f"{user.id}.png") # Incase user don't have profile pic, send normal text except IndexError: message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True) else: message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """I've seen them in... Wow. Are they stalking me? They're in all the same places I am... oh. It's me.""" num_chats = sql.get_user_num_chats(user_id) return """I've seen them in {} chats in total.""".format(num_chats)
def inlineinfo(query: str, update: Update, context: CallbackContext) -> None: """Handle the inline query.""" bot = context.bot query = update.inline_query.query log.info(query) user_id = update.effective_user.id try: search = query.split(" ", 1)[1] except IndexError: search = user_id try: user = bot.get_chat(int(search)) except (BadRequest, ValueError): user = bot.get_chat(user_id) chat = update.effective_chat sql.update_user(user.id, user.username) text = (f"<b>Information:</b>\n" f"• ID: <code>{user.id}</code>\n" f"• First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\n• Last Name: {html.escape(user.last_name)}" if user.username: text += f"\n• Username: @{html.escape(user.username)}" text += f"\n• Permanent user link: {mention_html(user.id, 'link')}" nation_level_present = False if user.id == OWNER_ID: text += f"\n\nThis person is my owner" nation_level_present = True elif user.id in DEV_USERS: text += f"\n\nThis Person is a part of Eagle Union" nation_level_present = True elif user.id in SUDO_USERS: text += f"\n\nThe Nation level of this person is Royal" nation_level_present = True elif user.id in SUPPORT_USERS: text += f"\n\nThe Nation level of this person is Sakura" nation_level_present = True elif user.id in SARDEGNA_USERS: text += f"\n\nThe Nation level of this person is Sardegna" nation_level_present = True elif user.id in WHITELIST_USERS: text += f"\n\nThe Nation level of this person is Neptunia" nation_level_present = True if nation_level_present: text += ' [<a href="https://t.me/{}?start=nations">?</a>]'.format( bot.username) try: spamwtc = sw.get_ban(int(user.id)) if spamwtc: text += "<b>\n\n• SpamWatched:\n</b> Yes" text += f"\n• Reason: <pre>{spamwtc.reason}</pre>" text += "\n• Appeal at @SpamWatchSupport" else: text += "<b>\n\n• SpamWatched:</b> No" except: pass # don't crash if api is down somehow... apst = requests.get( f'https://api.intellivoid.net/spamprotection/v1/lookup?query={context.bot.username}' ) api_status = apst.status_code if (api_status == 200): try: status = client.raw_output(int(user.id)) # ptid = status["results"]["private_telegram_id"] op = status["results"]["attributes"]["is_operator"] ag = status["results"]["attributes"]["is_agent"] wl = status["results"]["attributes"]["is_whitelisted"] ps = status["results"]["attributes"]["is_potential_spammer"] sp = status["results"]["spam_prediction"]["spam_prediction"] hamp = status["results"]["spam_prediction"]["ham_prediction"] blc = status["results"]["attributes"]["is_blacklisted"] if blc: blres = status["results"]["attributes"]["blacklist_reason"] else: blres = None text += "\n\n<b>SpamProtection:</b>" # text += f"<b>\n• Private Telegram ID:</b> <code>{ptid}</code>\n" text += f"<b>\n• Operator:</b> <code>{op}</code>\n" text += f"<b>• Agent:</b> <code>{ag}</code>\n" text += f"<b>• Whitelisted:</b> <code>{wl}</code>\n" text += f"<b>• Spam/Ham Prediction:</b> <code>{round((sp/hamp*100), 3)}%</code>\n" text += f"<b>• Potential Spammer:</b> <code>{ps}</code>\n" text += f"<b>• Blacklisted:</b> <code>{blc}</code>\n" text += f"<b>• Blacklist Reason:</b> <code>{blres}</code>\n" except HostDownError: text += "\n\n<b>SpamProtection:</b>" text += "\nCan't connect to Intellivoid SpamProtection API\n" else: text += "\n\n<b>SpamProtection:</b>" text += f"\n<code>API RETURNED: {api_status}</code>\n" num_chats = sql.get_user_num_chats(user.id) text += f"\n• Chat count: <code>{num_chats}</code>" kb = InlineKeyboardMarkup([ [ InlineKeyboardButton( text="Report Error", url=f"https://t.me/YorktownEagleUnion", ), InlineKeyboardButton( text="Search again", switch_inline_query_current_chat=".info ", ), ], ]) results = [ InlineQueryResultArticle( id=str(uuid4()), title=f"User info of {html.escape(user.first_name)}", input_message_content=InputTextMessageContent( text, parse_mode=ParseMode.HTML, disable_web_page_preview=True), reply_markup=kb), ] update.inline_query.answer(results, cache_time=5)
def info(bot: Bot, update: Update, args: List[str]): message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return text = ( f"<b>➖➖➖➖➖➖➖➖➖➖\n「 User Info」 ℹ\n➖➖➖➖➖➖➖➖➖➖\n</b>\n" f"🆔️ ID ☞ <code>{user.id}</code>\n\n" f"✔️ <b>First Name</b> ☞ <code>{html.escape(user.first_name)}</code>") if user.last_name: text += f"\n✔️ <b>Last Name</b> ☞ <code>{html.escape(user.last_name)}</code>" if user.username: text += f"\n✔️ <b>Username</b> ☞ @{html.escape(user.username)}" text += f"\n✔️ <b>User Link</b> ☞ {mention_html(user.id, 'link')}" num_chats = sql.get_user_num_chats(user.id) text += f"\n\n✔️ <b>Chat Count</b> ☞ <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == 'administrator': result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result['custom_title'] text += f"\n\nThis user holds the title <b>{custom_title}</b> here.\n" except BadRequest: pass disaster_level_present = False if user.id == OWNER_ID: text += "\n🔰The Disaster level of this person is 'Hero'." disaster_level_present = True elif user.id in DEV_USERS: text += "\n💠This member is one of 'Legend'." disaster_level_present = True elif user.id in SUDO_USERS: text += "\n♓The Disaster level of this person is 'Dragon'." disaster_level_present = True elif user.id in SUPPORT_USERS: text += "\n🌟The Disaster level of this person is 'HACKER'." disaster_level_present = True elif user.id in TIGER_USERS: text += "\n💓The Disaster level of this person is 'Tiger'." disaster_level_present = True elif user.id in WHITELIST_USERS: text += "\n⚡The Disaster level of this person is 'Wolf'." disaster_level_present = True if disaster_level_present: text += ' [<a href="http://t.me/{}?start=disasters">CLick Here</a>]'.format( bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info update.effective_message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def info(update: Update, context: CallbackContext): bot = context.bot args = context.args message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or ( len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]) ) ): message.reply_text("I can't extract a user from this.") return else: return text = ( f"<b>General:</b>\n" f"ID: <code>{user.id}</code>\n" f"First Name: {html.escape(user.first_name)}" ) if user.last_name: text += f"\nLast Name: {html.escape(user.last_name)}" if user.username: text += f"\nUsername: @{html.escape(user.username)}" text += f"\nPermanent user link: {mention_html(user.id, 'link')}" try: spamwtc = sw.get_ban(int(user.id)) if spamwtc: text += "<b>\n\nSpamWatch:\n</b>" text += "<b>This person is banned in Spamwatch!</b>" text += f"\nReason: <pre>{spamwtc.reason}</pre>" text += "\nAppeal at @SpamWatchSupport" else: text += "<b>\n\nSpamWatch:</b>\n Not banned" except: pass # don't crash if api is down somehow... apst = requests.get(f'https://api.intellivoid.net/spamprotection/v1/lookup?query={context.bot.username}') api_status = apst.status_code if (api_status == 200): try: status = client.raw_output(int(user.id)) ptid = status["results"]["private_telegram_id"] op = status["results"]["attributes"]["is_operator"] ag = status["results"]["attributes"]["is_agent"] wl = status["results"]["attributes"]["is_whitelisted"] ps = status["results"]["attributes"]["is_potential_spammer"] sp = status["results"]["spam_prediction"]["spam_prediction"] hamp = status["results"]["spam_prediction"]["ham_prediction"] blc = status["results"]["attributes"]["is_blacklisted"] if blc: blres = status["results"]["attributes"]["blacklist_reason"] else: blres = None text += "\n\n<b>SpamProtection:</b>" text += f"<b>\nPrivate Telegram ID:</b> <code>{ptid}</code>\n" text += f"<b>Operator:</b> <code>{op}</code>\n" text += f"<b>Agent:</b> <code>{ag}</code>\n" text += f"<b>Whitelisted:</b> <code>{wl}</code>\n" text += f"<b>Spam Prediction:</b> <code>{sp}</code>\n" text += f"<b>Ham Prediction:</b> <code>{hamp}</code>\n" text += f"<b>Potential Spammer:</b> <code>{ps}</code>\n" text += f"<b>Blacklisted:</b> <code>{blc}</code>\n" text += f"<b>Blacklist Reason:</b> <code>{blres}</code>\n" except HostDownError: text += "\n\n<b>SpamProtection:</b>" text += "\nCan't connect to Intellivoid SpamProtection API\n" else: text += "\n\n<b>SpamProtection:</b>" text += f"\n<code>API RETURNED: {api_status}</code>\n" Nation_level_present = False num_chats = sql.get_user_num_chats(user.id) text += f"\nChat count: <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == "administrator": result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result["custom_title"] text += f"\nThis user holds the title <b>{custom_title}</b> here." except BadRequest: pass if user.id == OWNER_ID: text += f"\nThis person is my owner" Nation_level_present = True elif user.id in DEV_USERS: text += f"\nThis Person is a part of Eagle Union" Nation_level_present = True elif user.id in SUDO_USERS: text += f"\nThe Nation level of this person is Royal" Nation_level_present = True elif user.id in SUPPORT_USERS: text += f"\nThe Nation level of this person is Sakura" Nation_level_present = True elif user.id in SARDEGNA_USERS: text += f"\nThe Nation level of this person is Sardegna" Nation_level_present = True elif user.id in WHITELIST_USERS: text += f"\nThe Nation level of this person is Neptunia" Nation_level_present = True if Nation_level_present: text += ' [<a href="https://t.me/{}?start=nations">?</a>]'.format(bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info if INFOPIC: try: profile = bot.get_user_profile_photos(user.id).photos[0][-1] _file = bot.get_file(profile["file_id"]) _file.download(f"{user.id}.png") message.reply_document( document=open(f"{user.id}.png", "rb"), caption=(text), parse_mode=ParseMode.HTML, ) os.remove(f"{user.id}.png") # Incase user don't have profile pic, send normal text except IndexError: message.reply_text( text, parse_mode=ParseMode.HTML, disable_web_page_preview=True ) else: message.reply_text( text, parse_mode=ParseMode.HTML, disable_web_page_preview=True )
def info(bot: Bot, update: Update, args: List[str]): message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return text = (f"<b>User Information:</b>\n" f"🆔: <code>{user.id}</code>\n" f"👤<b>Name:</b> {html.escape(user.first_name)}") if user.last_name: text += f"\n🚹<b>Last Name:</b> {html.escape(user.last_name)}" if user.username: text += f"\n<b>♻️Username:</b> @{html.escape(user.username)}" text += f"\n☣️<b>Permanent user link:</b> {mention_html(user.id, 'link🚪')}" num_chats = sql.get_user_num_chats(user.id) text += f"\n🌐<b>Chat count:</b> <code>{num_chats}</code>" text += "\n<b>🎭Number of profile pics:</b> {}".format( bot.get_user_profile_photos(user.id).total_count) text += "\n<b>Support Channel</b> : @mAI_bOTs" try: user_member = chat.get_member(user.id) if user_member.status == 'administrator': result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result['custom_title'] text += f"\n🛡This user holds the title⚜️ <b>{custom_title}</b> here." except BadRequest: pass if user.id == OWNER_ID: text += "\n🚶🏻♂️Uff,This person is my Owner🤴\nI would never do anything against him!." elif user.id == 861055237: text += "\n🚴♂️Pling,This person is my Creator/developer🤷♂️\nI would never do anything against him!." elif user.id in SUDO_USERS: text += "\n🚴♂️Pling,This person is one of my sudo users! " \ "Nearly as powerful as my owner🕊so watch it.." elif user.id in SUPPORT_USERS: text += "\n🚴♂️Pling,This person is one of my support users! " \ "Not quite a sudo user, but can still gban you off the map." elif user.id in WHITELIST_USERS: text += "\n🚴♂️Pling,This person has been whitelisted! " \ "That means I'm not allowed to ban/kick them." elif user.id == bot.id: text += "\n💃Lol🧞♂️It's Me😉" text += "\n" text += "\nCAS banned: " result = cas.banchecker(user.id) text += str(result) for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info try: profile = bot.get_user_profile_photos(user.id).photos[0][-1] bot.sendChatAction(chat.id, "upload_photo") bot.send_photo(chat.id, photo=profile, caption=(text), parse_mode=ParseMode.HTML, disable_web_page_preview=True) except IndexError: update.effective_message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def info(update: Update, context: CallbackContext): bot = context.bot args = context.args message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return text = (f"<b>General:</b>\n" f"ID: <code>{user.id}</code>\n" f"First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\nLast Name: {html.escape(user.last_name)}" if user.username: text += f"\nUsername: @{html.escape(user.username)}" text += f"\nPermanent user link: {mention_html(user.id, 'link')}" try: spamwtc = sw.get_ban(int(user.id)) if spamwtc: text += "<b>\n\nSpamWatch:\n</b>" text += "<b>This person is banned in Spamwatch!</b>" text += f"\nReason: <pre>{spamwtc.reason}</pre>" text += "\nAppeal at @SpamWatchSupport" else: text += "<b>\n\nSpamWatch:</b>\n Not banned" except: pass # don't crash if api is down somehow... Nation_level_present = False num_chats = sql.get_user_num_chats(user.id) text += f"\nChat count: <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == "administrator": result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result["custom_title"] text += f"\nThis user holds the title <b>{custom_title}</b> here." except BadRequest: pass if user.id == OWNER_ID: text += f"\nThis person is my master" Nation_level_present = True elif user.id in DEV_USERS: text += f"\nThis Person is a part of Yuii Chan Club" Nation_level_present = True elif user.id in SUDO_USERS: text += f"\nThis person is a sudo user" Nation_level_present = True elif user.id in SUPPORT_USERS: text += f"\nThis person is one of my support user" Nation_level_present = True elif user.id in TIGER_USERS: text += f"\nThis person is a tiger user" Nation_level_present = True elif user.id in WHITELIST_USERS: text += f"\nThis person is a whitelist user" Nation_level_present = True if Nation_level_present: text += ' [<a href="https://t.me/yuiichansupport/3655">?</a>]'.format( bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info if INFOPIC: try: profile = bot.get_user_profile_photos(user.id).photos[0][-1] _file = bot.get_file(profile["file_id"]) _file.download(f"{user.id}.png") message.reply_document( document=open(f"{user.id}.png", "rb"), caption=(text), parse_mode=ParseMode.HTML, ) os.remove(f"{user.id}.png") # Incase user don't have profile pic, send normal text except IndexError: message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True) else: message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """Widziałem ich w... Łał. Czy oni mnie stalkują? Są w tych samych miejscach, w których jestem... och. To ja.""" num_chats = sql.get_user_num_chats(user_id) return """Widziałem ich w <code>{}</code> czatach ogółem.""".format( num_chats)
def info(bot: Bot, update: Update, args: List[str]): message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return text = (f"<b>Characteristics:</b>\n" f"ID: <code>{user.id}</code>\n" f"First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\nLast Name: {html.escape(user.last_name)}" if user.username: text += f"\nUsername: @{html.escape(user.username)}" text += f"\nPermanent user link: {mention_html(user.id, 'link')}" num_chats = sql.get_user_num_chats(user.id) text += f"\nChat count: <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == 'administrator': result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result['custom_title'] text += f"\nThis user holds the title <b>{custom_title}</b> here." except BadRequest: pass Nation_level_present = False if user.id == OWNER_ID: text += "\nThe Union level of this person is 'God'." Nation_level_present = True elif user.id in DEV_USERS: text += "\nThis member is one of 'Dev Union'." Nation_level_present = True elif user.id in SUDO_USERS: text += "\nThe Union level of this person is 'Sudo'." Nation_level_present = True elif user.id in SUPPORT_USERS: text += "\nThe Union level of this person is 'Support'." Nation_level_present = True elif user.id in SARDEGNA_USERS: text += "\nThe Union level of this person is 'Sardegna'." Nation_level_present = True elif user.id in WHITELIST_USERS: text += "\nThe Union level of this person is 'Immunity'." Nation_level_present = True if Nation_level_present: text += ' [<a href="http://t.me/{}?start=nations">?</a>]'.format( bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info update.effective_message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """Onları ... Haa. Beni takip ediyorlar mı? Onlar benimle aynı yerdeler ... Yahu. Bu benim.""" num_chats = sql.get_user_num_chats(user_id) return """Onları toplamda <code>{}</code> sohbetlerinde gördüm.""".format( num_chats)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """Ye bhenchod sare milke pagal bana rhe h madrchod ke bacche.😁""" num_chats = sql.get_user_num_chats(user_id) return """I've seen them in <code>{}</code> chats in total.""".format( num_chats)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """L'ho visto in.. wow. In tutte le chat! Ah.. sono io!.""" num_chats = sql.get_user_num_chats(user_id) return """L'ho visto in <code>{}</code> chats in totale.""".format( num_chats)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """The best out there.. Its me.""" num_chats = sql.get_user_num_chats(user_id) return """ Common Chats : {} """.format(num_chats)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """Onları gördüm ... Vay canına. Beni takip ediyorlar mı? Ben heryerdeyim.. Evet. Bu benim.""" num_chats = sql.get_user_num_chats(user_id) return """Onu toplam <code>{}</code> grupta görüyorum.""".format(num_chats)
def info(bot: Bot, update: Update, args: List[str]): message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return text = (f"<b>Tentang Pengguna:</b>\n" f"🆔️ID: <code>{user.id}</code>\n" f"👤Nama depan: {html.escape(user.first_name)}") if user.last_name: text += f"\n👤Nama belakang: {html.escape(user.last_name)}" if user.username: text += f"\n👤Nama pengguna: @{html.escape(user.username)}" text += f"\n👤Link profil: {mention_html(user.id, 'link')}" num_chats = sql.get_user_num_chats(user.id) text += f"\n🌍Grup terhitung: <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == 'administrator': result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result['custom_title'] text += f"\nThis user holds the title <b>{custom_title}</b> here." except BadRequest: pass disaster_level_present = False if user.id == OWNER_ID: text += "\n😎Orang ini adalah 'BOSS SAYA'." disaster_level_present = True elif user.id in DEV_USERS: text += "\n🤘🏼Orang ini adalah 'BOSS SAYA'." disaster_level_present = True elif user.id in SUDO_USERS: text += "\n🔥Level orang ini sebagai 'Tangan Kanan'." disaster_level_present = True elif user.id in SUPPORT_USERS: text += "\n🔥Level orang ini setara 'Hacker'." disaster_level_present = True elif user.id in TIGER_USERS: text += "\n🔥Level orang ini setara 'Sahabat'." disaster_level_present = True elif user.id in WHITELIST_USERS: text += "\n🔥Level orang ini setara 'Teman'." disaster_level_present = True if disaster_level_present: text += ' [<a href="http://t.me/{}?start=disasters">?</a>]'.format( bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info update.effective_message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def info(update: Update, context: CallbackContext): # sourcery no-metrics bot = context.bot args = context.args message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return text = (f"<b>General:</b>\n" f"ID: <code>{user.id}</code>\n" f"First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\nLast Name: {html.escape(user.last_name)}" if user.username: text += f"\nUsername: @{html.escape(user.username)}" text += f"\nPermanent user link: {mention_html(user.id, 'link')}" try: spamwtc = sw.get_ban(int(user.id)) if spamwtc: text += "<b>\n\nSpamWatch:\n</b>" text += "<b>This person is banned in Spamwatch!</b>" text += f"\nReason: <pre>{spamwtc.reason}</pre>" text += "\nAppeal at @SpamWatchSupport" else: text += "<b>\n\nSpamWatch:</b>\n Not banned" except: pass # don't crash if api is down somehow... Nation_level_present = False num_chats = sql.get_user_num_chats(user.id) text += f"\n<b>Chat count</b>: <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == "administrator": result = bot.get_chat_member(chat.id, user.id) if result.custom_title: text += f"\nThis user holds the title <b>{result.custom_title}</b> here." except BadRequest: pass if user.id == OWNER_ID: text += '\nThis person is my owner' Nation_level_present = True elif user.id in DEV_USERS: text += '\nThis Person is a part of Eagle Union' Nation_level_present = True elif user.id in SUDO_USERS: text += '\nThe Nation level of this person is Royal' Nation_level_present = True elif user.id in SUPPORT_USERS: text += '\nThe Nation level of this person is Sakura' Nation_level_present = True elif user.id in SARDEGNA_USERS: text += '\nThe Nation level of this person is Sardegna' Nation_level_present = True elif user.id in WHITELIST_USERS: text += '\nThe Nation level of this person is Neptunia' Nation_level_present = True if Nation_level_present: text += ' [<a href="https://t.me/{}?start=nations">?</a>]'.format( bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info if INFOPIC: try: profile = bot.get_user_profile_photos(user.id).photos[0][-1] _file = bot.get_file(profile["file_id"]) _file = _file.download(out=BytesIO()) _file.seek(0) message.reply_document( document=_file, caption=(text), parse_mode=ParseMode.HTML, ) # Incase user don't have profile pic, send normal text except IndexError: message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True) else: message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """Ich sehe sie in... Wow. Stalken die mich? Die sind alle überall, wo ich bin... oh. das bin ja ich^^.""" num_chats = sql.get_user_num_chats(user_id) return """Ich habe sie gesehen in <code>{}</code> Chats insgesamt.""".format(num_chats)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """لقد رأيتهم في ... واو. هل يطاردونني؟ انهم في كل نفس الأماكن أنا ... أوه. هذا أنا.""" num_chats = sql.get_user_num_chats(user_id) return """لقد رأيتهم في <code>{}</code> الدردشات الإجمالية.""".format( num_chats)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """Vau bu gözəl kimdi?... Oh bu mənəm😍.""" num_chats = sql.get_user_num_chats(user_id) return """Mən onu <code>{}</code> ədəd qrupda görmüşəm.""".format(num_chats)
def info(update: Update, context: CallbackContext): bot, args = context.bot, context.args message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return del_msg = message.reply_text("searching info data of user....",parse_mode=ParseMode.HTML) text = (f"<b>• General :-</b>\n\n" f"∘ ID: <code>{user.id}</code>\n" f"∘ First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\n∘ Last Name: {html.escape(user.last_name)}" if user.username: text += f"\n∘ Username: @{html.escape(user.username)}" isafk = is_afk(user.id) try: text += "\n\n∘ Currently AFK: " if user.id == bot.id: text += "<code>???</code>" else: text += str(isafk) except: pass try: if user.id == bot.id: num_chats = "???" else: num_chats = get_user_num_chats(user.id) text += f"\n∘ Mutual Chats: <code>{num_chats}</code> " except BadRequest: pass try: status = status = bot.get_chat_member(chat.id, user.id).status if status: if status in "left": text += "\n∘ Chat Status: <em>Not Here!</em>" elif status == "member": text += "\n∘ Chat Status: <em>Is Here!</em>" elif status in "administrator": text += "\n∘ Chat Status: <em>Admin!</em>" elif status in "creator": text += "\n∘ Chat Status: <em>Creator!</em>" except BadRequest: pass try: user_member = chat.get_member(user.id) if user_member.status == 'administrator': result = requests.post(f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}") result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result['custom_title'] text += f"\n∘ Admin Title: <code>{custom_title}</code> \n" except BadRequest: pass if user.id ==1286562476: text += "\n🚶🏻♂️Uff,This person is sudo \n HE IS is the cutie!." if user.id == OWNER_ID: text += "\nThis person is my Owner\nI would never do anything against him!." elif user.id in DEV_USERS: text += "\nThis person is my dev\nI would never do anything against him!." elif user.id in SUDO_USERS: text += "\nThis person is one of my sudo users! " \ "Nearly as powerful as my owner🕊so watch it.." elif user.id in SUPPORT_USERS: text += "\nThis person is one of my support users! " \ " He can gban you off the map." elif user.id in WHITELIST_USERS: text += "\nThis person has been whitelisted! " \ "That means I'm not allowed to ban/kick them." elif user.id == bot.id: text+= "\n\nI've Seen Them In... Wow. Are They Stalking Me? They're In All The Same Places I Am... Oh. It's Me.\n" text +="\n" text += "\nCAS banned: " result = cas.banchecker(user.id) text += str(result) for mod in USER_INFO: if mod.__mod_name__ == "info": continue for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info try: profile = bot.get_user_profile_photos(user.id).photos[0][-1] _file = bot.get_file(profile["file_id"]) _file.download(f"{user.id}.png") message.reply_document( document=open(f"{user.id}.png", "rb"), caption=(text), parse_mode=ParseMode.HTML, disable_web_page_preview=True) except IndexError: message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True) finally: del_msg.delete()
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """ഞാൻ അവരെ കണ്ട ... അവർ എന്നെ പിന്തുടരുന്നുണ്ടോ? അവർ ഒരേ സ്ഥലങ്ങളിലാണുള്ളത് ... ഓ. ഇത് ഞാനാണ്.""" num_chats = sql.get_user_num_chats(user_id) return """<code>{}</code> ചാറ്റുകളിൽ ഇയാളെ ഞാൻ കണ്ടിട്ടുണ്ട്.""".format( num_chats)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """I've seen them in... Wow. Are they stalking me? They're in all the same places I am... oh. It's me.""" num_chats = sql.get_user_num_chats(user_id) return """<code>{}</code> ചാറ്റുകളിൽ ഇയാളെ ഞാൻ കണ്ടിട്ടുണ്ട്..""".format(num_chats)
def inlineinfo(query: str, update: Update, context: CallbackContext) -> None: """Handle the inline query.""" bot = context.bot query = update.inline_query.query log.info(query) user_id = update.effective_user.id try: search = query.split(" ", 1)[1] except IndexError: search = user_id try: user = bot.get_chat(int(search)) except (BadRequest, ValueError): user = bot.get_chat(user_id) chat = update.effective_chat sql.update_user(user.id, user.username) text = (f"<b>General:</b>\n" f"ID: <code>{user.id}</code>\n" f"First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\nLast Name: {html.escape(user.last_name)}" if user.username: text += f"\nUsername: @{html.escape(user.username)}" text += f"\nPermanent user link: {mention_html(user.id, 'link')}" try: spamwtc = sw.get_ban(int(user.id)) if spamwtc: text += "<b>\n\nSpamWatch:\n</b>" text += "<b>This person is banned in Spamwatch!</b>" text += f"\nReason: <pre>{spamwtc.reason}</pre>" text += "\nAppeal at @SpamWatchSupport" else: text += "<b>\n\nSpamWatch:</b>\n Not banned" except: pass # don't crash if api is down somehow... try: status = client.raw_output(int(user.id)) ptid = status["results"]["private_telegram_id"] op = status["results"]["attributes"]["is_operator"] ag = status["results"]["attributes"]["is_agent"] wl = status["results"]["attributes"]["is_whitelisted"] ps = status["results"]["attributes"]["is_potential_spammer"] sp = status["results"]["spam_prediction"]["spam_prediction"] hamp = status["results"]["spam_prediction"]["ham_prediction"] blc = status["results"]["attributes"]["is_blacklisted"] if blc: blres = status["results"]["attributes"]["blacklist_reason"] else: blres = None text += "\n\n<b>SpamProtection:</b>" text += f"<b>\nPrivate Telegram ID:</b> <code>{ptid}</code>\n" text += f"<b>Operator:</b> <code>{op}</code>\n" text += f"<b>Agent:</b> <code>{ag}</code>\n" text += f"<b>Whitelisted:</b> <code>{wl}</code>\n" text += f"<b>Spam Prediction:</b> <code>{sp}</code>\n" text += f"<b>Ham Prediction:</b> <code>{hamp}</code>\n" text += f"<b>Potential Spammer:</b> <code>{ps}</code>\n" text += f"<b>Blacklisted:</b> <code>{blc}</code>\n" text += f"<b>Blacklist Reason:</b> <code>{blres}</code>\n" except HostDownError: text += "\n\n<b>SpamProtection:</b>" text += "\nCan't connect to Intellivoid SpamProtection API\n" nation_level_present = False num_chats = sql.get_user_num_chats(user.id) text += f"\nChat count: <code>{num_chats}</code>" if user.id == OWNER_ID: text += f"\nThis person is my owner" nation_level_present = True elif user.id in DEV_USERS: text += f"\nThis Person is a part of Eagle Union" nation_level_present = True elif user.id in SUDO_USERS: text += f"\nThe Nation level of this person is Royal" nation_level_present = True elif user.id in SUPPORT_USERS: text += f"\nThe Nation level of this person is Sakura" nation_level_present = True elif user.id in SARDEGNA_USERS: text += f"\nThe Nation level of this person is Sardegna" nation_level_present = True elif user.id in WHITELIST_USERS: text += f"\nThe Nation level of this person is Neptunia" nation_level_present = True if nation_level_present: text += ' [<a href="https://t.me/{}?start=nations">?</a>]'.format( bot.username) results = [ InlineQueryResultArticle( id=str(uuid4()), title=f"User info of {html.escape(user.first_name)}", input_message_content=InputTextMessageContent( text, parse_mode=ParseMode.HTML, disable_web_page_preview=True), ), ] update.inline_query.answer(results, cache_time=5)
def info(bot: Bot, update: Update, args: List[str]): message = update.effective_message chat = update.effective_chat user_id = extract_user(update.effective_message, args) if user_id: user = bot.get_chat(user_id) elif not message.reply_to_message and not args: user = message.from_user elif not message.reply_to_message and ( not args or (len(args) >= 1 and not args[0].startswith("@") and not args[0].isdigit() and not message.parse_entities([MessageEntity.TEXT_MENTION]))): message.reply_text("I can't extract a user from this.") return else: return text = (f"<b>user information:</b>\n" f"🆔️ID: <code>{user.id}</code>\n" f"👤First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\n👤Last Name: {html.escape(user.last_name)}" if user.username: text += f"\n👤Username: @{html.escape(user.username)}" text += f"\n👤Permanent user link: {mention_html(user.id, 'link')}" num_chats = sql.get_user_num_chats(user.id) text += f"\n🌍Chat count: <code>{num_chats}</code>" try: user_member = chat.get_member(user.id) if user_member.status == 'administrator': result = requests.post( f"https://api.telegram.org/bot{TOKEN}/getChatMember?chat_id={chat.id}&user_id={user.id}" ) result = result.json()["result"] if "custom_title" in result.keys(): custom_title = result['custom_title'] text += f"\nThis user holds the title <b>{custom_title}</b> here." except BadRequest: pass disaster_level_present = False if user.id == OWNER_ID: text += "\n 🔥THE SKILL OF THIS PERSON IS '⚡ 𝗥𝗔𝗜𝗗𝗘𝗥 ⚡'." disaster_level_present = True elif user.id in DEV_USERS: text += "\n🔥THIS PERSON HAVE POWER OF '🗡 𝗦𝗪𝗢𝗥𝗗 𝗠𝗔𝗦𝗧𝗘𝗥 🗡'." disaster_level_present = True elif user.id in SUDO_USERS: text += "\n🔥The Disaster level of this person is 'Dragon'." disaster_level_present = True elif user.id in SUPPORT_USERS: text += "\n🔥The Disaster level of this person is 'HACKER'." disaster_level_present = True elif user.id in TIGER_USERS: text += "\n🔥The Disaster level of this person is 'Tiger'." disaster_level_present = True elif user.id in WHITELIST_USERS: text += "\n🔥The Disaster level of this person is 'Wolf'." disaster_level_present = True if disaster_level_present: text += ' [<a href="http://t.me/{}?start=disasters">?</a>]'.format( bot.username) text += "\n" for mod in USER_INFO: if mod.__mod_name__ == "Users": continue try: mod_info = mod.__user_info__(user.id) except TypeError: mod_info = mod.__user_info__(user.id, chat.id) if mod_info: text += "\n" + mod_info update.effective_message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """I'm in <code>{}</code> chats.""".format(sql.num_chats()) num_chats = sql.get_user_num_chats(user_id) return "" #"I've seen them in <code>{}</code> chats in total.""".format(num_chats)
def inlineinfo(query: str, update: Update, context: CallbackContext) -> None: """Handle the inline query.""" bot = context.bot query = update.inline_query.query log.info(query) user_id = update.effective_user.id try: search = query.split(" ", 1)[1] except IndexError: search = user_id try: user = bot.get_chat(int(search)) except (BadRequest, ValueError): user = bot.get_chat(user_id) chat = update.effective_chat sql.update_user(user.id, user.username) text = (f"<b>Information:</b>\n" f"• ID: <code>{user.id}</code>\n" f"• First Name: {html.escape(user.first_name)}") if user.last_name: text += f"\n• Last Name: {html.escape(user.last_name)}" if user.username: text += f"\n• Username: @{html.escape(user.username)}" text += f"\n• Permanent user link: {mention_html(user.id, 'link')}" nation_level_present = False if user.id == OWNER_ID: text += f"\n\nThis person is my owner" nation_level_present = True elif user.id in DEV_USERS: text += f"\n\nThis Person is a part of Eagle Union" nation_level_present = True elif user.id in SUDO_USERS: text += f"\n\nThe Nation level of this person is Royal" nation_level_present = True elif user.id in SUPPORT_USERS: text += f"\n\nThe Nation level of this person is Sakura" nation_level_present = True elif user.id in SARDEGNA_USERS: text += f"\n\nThe Nation level of this person is Sardegna" nation_level_present = True elif user.id in WHITELIST_USERS: text += f"\n\nThe Nation level of this person is Neptunia" nation_level_present = True if nation_level_present: text += ' [<a href="https://t.me/{}?start=nations">?</a>]'.format( bot.username) try: spamwtc = sw.get_ban(int(user.id)) if spamwtc: text += "<b>\n\n• SpamWatched:\n</b> Yes" text += f"\n• Reason: <pre>{spamwtc.reason}</pre>" text += "\n• Appeal at @SpamWatchSupport" else: text += "<b>\n\n• SpamWatched:</b> No" except: pass # don't crash if api is down somehow... num_chats = sql.get_user_num_chats(user.id) text += f"\n• <b>Chat count</b>: <code>{num_chats}</code>" kb = InlineKeyboardMarkup([ [ InlineKeyboardButton( text="Report Error", url=f"https://t.me/YorktownEagleUnion", ), InlineKeyboardButton( text="Search again", switch_inline_query_current_chat=".info ", ), ], ]) results = [ InlineQueryResultArticle( id=str(uuid4()), title=f"User info of {html.escape(user.first_name)}", input_message_content=InputTextMessageContent( text, parse_mode=ParseMode.HTML, disable_web_page_preview=True), reply_markup=kb), ] update.inline_query.answer(results, cache_time=5)
def __user_info__(user_id): if user_id == dispatcher.bot.id: return """전 그를 본 적이 있어요... 와. 그는 저를 스토킹 하고 있는 거에요? 그는 제가 있는 모든 채팅방에 있네요.... 오, 그건 저예요.""" num_chats = sql.get_user_num_chats(user_id) return """<code>{}</code> 개의 채팅방에서 봤어요.""".format(num_chats)