def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] conn = connected(bot, update, chat, user.id) if not conn == False: chatD = dispatcher.bot.getChat(conn) else: if chat.type == "private": exit(1) else: chatD = update.effective_chat if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chatD.id, enable_cmd): update.effective_message.reply_text( tld(chat.id, "Enabled the use of `{}` in *{}*").format( enable_cmd, chatD.title), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( tld(chat.id, "Is that even disabled?")) else: update.effective_message.reply_text( tld(chat.id, "What should I enable?"))
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text("Enabled the use of '`{cmd}`' in *{chat}*".format(cmd=enable_cmd, chat=chat.title), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("Is that even disabled?") else: update.effective_message.reply_text("What should I enable?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( tld(chat.id, "disable_enable_success").format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( tld(chat.id, "disable_already_enabled")) else: update.effective_message.reply_text( tld(chat.id, "disable_err_no_cmd"))