def group_setting(update: Update, context: CallbackContext): chat_id = update.effective_chat.id lang = database.get_language_chat(chat_id) if not helpers.is_admin(context.bot, update.effective_user.id, update.effective_chat): update.effective_message.reply_text( get_string(lang, "no_admin_settings")) return user_id = update.effective_user.id user_lang = database.get_language_player(user_id) pm = database.get_pm_player(user_id) context.user_data["lang"] = user_lang database.insert_group_title(chat_id, update.effective_chat.title, update.effective_chat.link) if pm: try: # yes, its not a string, I don't change the functions name for this you f****r chat_link = helpers.chat_link(update.effective_chat.title, update.effective_chat.link) buttons = group_settings_helpers.group_settings_buttons( get_string(user_lang, "group_setting_buttons"), chat_id) context.bot.send_message( user_id, get_string(user_lang, "group_setting_text").format(chat_link), reply_markup=InlineKeyboardMarkup(buttons), parse_mode=ParseMode.HTML, disable_web_page_preview=True) # this means the bot was blocked wtf except Unauthorized: update.effective_message.reply_text( get_string(lang, "admin_blocked_bot")) database.insert_player_pm(user_id, False) else: button = [[ InlineKeyboardButton( get_string(lang, "no_pm_settings_button"), url=f"https://t.me/thechameleonbot?start=settings_{chat_id}") ]] update.effective_message.reply_text( get_string(lang, "no_pm_settings"), reply_markup=InlineKeyboardMarkup(button))
def nextgame_command(update: Update, context: CallbackContext): user_id = update.effective_user.id chat_id = update.effective_chat.id pm = database.get_pm_player(user_id) new = database.insert_group_nextgame(chat_id, user_id) if "lang" not in context.chat_data: context.chat_data["lang"] = database.get_language_chat(chat_id) lang = context.chat_data["lang"] chat_link = helpers.chat_link(update.effective_chat.title, update.effective_chat.link) database.insert_group_title(chat_id, update.effective_chat.title, update.effective_chat.link) if pm: try: if new: context.bot.send_message( user_id, get_string(lang, "nextgame_added").format(chat_link), parse_mode=ParseMode.HTML, disable_web_page_preview=True) else: context.bot.send_message( user_id, get_string(lang, "nextgame_removed").format(chat_link), parse_mode=ParseMode.HTML, disable_web_page_preview=True) except Unauthorized: update.effective_message.reply_text( get_string(lang, "nextgame_block")) database.insert_player_pm(user_id, False) else: button = [[ InlineKeyboardButton( get_string(lang, "no_pm_settings_button"), url=f"https://t.me/thechameleonbot?start=nextgame_{chat_id}") ]] update.effective_message.reply_text( get_string(lang, "nextgame_pm"), reply_markup=InlineKeyboardMarkup(button))