def check_bot_button(bot: Bot, update: Update): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] query = update.callback_query # type: Optional[CallbackQuery] getalluser = sql.get_chat_userlist(chat.id) if user.id in getalluser: query.answer(text=tld(chat.id, 'welcome_mute_btn_unmuted')) # Unmute user bot.restrict_chat_member(chat.id, user.id, can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, can_add_web_page_previews=True) sql.rm_from_userlist(chat.id, user.id) else: try: query.answer(text=tld(chat.id, 'welcome_mute_btn_old_user')) except Exception: print("Nut")
def verify_welcome(update, context, chat_id): user_id = update.effective_user.id is_clicked = sql.get_chat_userlist(chat_id) if user_id not in list(is_clicked): send_message( update.effective_message, tl( update.effective_message, "Anda sedang tidak dalam mode verifikasi, jika anda sedang di bisukan, anda dapat meminta tolong pada admin di grup yang bersangkutan" )) return elif user_id in list(is_clicked) and is_clicked[user_id] == True: send_message( update.effective_message, tl( update.effective_message, "Anda sedang tidak dalam mode verifikasi, jika anda sedang di bisukan, anda dapat meminta tolong pada admin di grup yang bersangkutan" )) return verify_code = [ "🙏", "👈", "👉", "👇", "👆", "❤️", "🅰️", "🅱️", "0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟" ] print(len(verify_code)) real_btn = random.choice(verify_code) verify_code.remove(real_btn) verbox = (random.randint(1, 3), random.randint(1, 3)) buttons = [] linebox = [] for x in range(3): x += 1 if verbox[1] == x: ver1 = True else: ver1 = False for y in range(3): y += 1 if verbox[0] == y and ver1: verify_emoji = real_btn linebox.append( InlineKeyboardButton( text=verify_emoji, callback_data="verify_me(y|{}|{})".format( user_id, chat_id))) else: verify_emoji = random.choice(verify_code) linebox.append( InlineKeyboardButton( text=verify_emoji, callback_data="verify_me(n|{}|{})".format( user_id, chat_id))) verify_code.remove(verify_emoji) buttons.append(linebox) linebox = [] context.bot.send_photo(user_id, photo=verify_code_images[real_btn], caption=tl( update.effective_message, "Tolong pilih emoji yang sama dibawah ini:"), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup(buttons))