def reaction(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat user = update.effective_user message = update.effective_message if args: var = args[0].lower() if user_can_changeinfo(chat, user, bot.id) is False: message.reply_text(tld(chat.id, "admin_no_changeinfo_perm")) return "" elif var == "false": sql.set_command_reaction(chat.id, False) update.effective_message.reply_text( tld(chat.id, "admin_disable_reaction")) elif var == "true": sql.set_command_reaction(chat.id, True) update.effective_message.reply_text( tld(chat.id, "admin_enable_reaction")) else: update.effective_message.reply_text(tld(chat.id, "admin_err_wrong_arg"), parse_mode=ParseMode.MARKDOWN) else: status = sql.command_reaction(chat.id) update.effective_message.reply_text(tld( chat.id, "admin_reaction_status").format( 'enabled' if status is True else 'disabled'), parse_mode=ParseMode.MARKDOWN)
def reaction(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: var = args[0] print(var) if var == "False": sql.set_command_reaction(chat.id, False) update.effective_message.reply_text( "Disabled response to user-triggered admin commands.") elif var == "True": sql.set_command_reaction(chat.id, True) update.effective_message.reply_text( "Enabled response to user-triggered admin commands.") else: update.effective_message.reply_text("Please enter True or False!", parse_mode=ParseMode.MARKDOWN) else: status = sql.command_reaction(chat.id) update.effective_message.reply_text( "Response for user-triggered admin commands is currently " f"`{'enabled' if status == True else 'disabled'}`!", parse_mode=ParseMode.MARKDOWN)
def reaction(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat if len(args) >= 1: var = args[0] print(var) if var == "False": sql.set_command_reaction(chat.id, False) update.effective_message.reply_text( tld(chat.id, "admin_disable_reaction")) elif var == "True": sql.set_command_reaction(chat.id, True) update.effective_message.reply_text( tld(chat.id, "admin_enable_reaction")) else: update.effective_message.reply_text(tld(chat.id, "admin_err_wrong_arg"), parse_mode=ParseMode.MARKDOWN) else: status = sql.command_reaction(chat.id) update.effective_message.reply_text(tld( chat.id, "admin_reaction_status").format('enabled' if status is True else 'disabled'), parse_mode=ParseMode.MARKDOWN)