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 set_flood(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat user = update.effective_user message = update.effective_message if user_can_changeinfo(chat, user, bot.id) is False: message.reply_text(tld(chat.id, "admin_no_changeinfo_perm")) return "" if len(args) >= 1: val = args[0].lower() if val in ("off", "no", "0"): sql.set_flood(chat.id, 0) message.reply_text(tld(chat.id, "flood_set_off")) elif val.isdigit(): amount = int(val) if amount <= 0: sql.set_flood(chat.id, 0) message.reply_text(tld(chat.id, "flood_set_off")) return tld(chat.id, "flood_logger_set_off").format( html.escape(chat.title), mention_html(user.id, user.first_name)) elif amount < 3: message.reply_text(tld(chat.id, "flood_err_num")) return "" else: sql.set_flood(chat.id, amount) message.reply_text(tld(chat.id, "flood_set").format(amount)) return tld(chat.id, "flood_logger_set_on").format( html.escape(chat.title), mention_html(user.id, user.first_name), amount) else: message.reply_text(tld(chat.id, "flood_err_args")) return ""