Пример #1
0
def cleanservice(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    if chat.type != chat.PRIVATE:
        if len(args) >= 1:
            var = args[0]
            if (var == "no" or var == "off"):
                sql.set_clean_service(chat.id, False)
                update.effective_message.reply_text(
                    "I'll leave service messages")
            elif (var == "yes" or var == "on"):
                sql.set_clean_service(chat.id, True)
                update.effective_message.reply_text(
                    "I will clean service messages")
            else:
                update.effective_message.reply_text(
                    "Please enter yes or no!", parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text("Please enter yes or no!",
                                                parse_mode=ParseMode.MARKDOWN)
    else:
        curr = sql.clean_service(chat.id)
        if curr:
            update.effective_message.reply_text(
                "I will now clean `x joined the group` message!",
                parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text(
                "I will no longer clean `x joined the group` message!",
                parse_mode=ParseMode.MARKDOWN)
Пример #2
0
def cleanservice(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    if chat.type != chat.PRIVATE:
        if len(args) >= 1:
            var = args[0]
            if (var == "no" or var == "off"):
                sql.set_clean_service(chat.id, False)
                update.effective_message.reply_text(
                    tld(chat.id, 'welcome_clean_service_off'))
            elif (var == "yes" or var == "on"):
                sql.set_clean_service(chat.id, True)
                update.effective_message.reply_text(
                    tld(chat.id, 'welcome_clean_service_on'))
            else:
                update.effective_message.reply_text(
                    tld(chat.id, 'common_invalid_arg'),
                    parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text(tld(chat.id,
                                                    'common_invalid_arg'),
                                                parse_mode=ParseMode.MARKDOWN)
    else:
        curr = sql.clean_service(chat.id)
        if curr:
            update.effective_message.reply_text(tld(
                chat.id, 'welcome_clean_service_on'),
                                                parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text(tld(
                chat.id, 'welcome_clean_service_off'),
                                                parse_mode=ParseMode.MARKDOWN)