Exemplo n.º 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(
                    'Welcome clean service is : off')
            elif (var == "yes" or var == "on"):
                sql.set_clean_service(chat.id, True)
                update.effective_message.reply_text(
                    'Welcome clean service is : on')
            else:
                update.effective_message.reply_text(
                    "Invalid option", parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text("Usage is on/yes or off/no",
                                                parse_mode=ParseMode.MARKDOWN)
    else:
        curr = sql.clean_service(chat.id)
        if curr:
            update.effective_message.reply_text(
                'Welcome clean service is : on', parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text(
                'Welcome clean service is : off',
                parse_mode=ParseMode.MARKDOWN)
Exemplo n.º 2
0
def cleanservice(update: Update, context: CallbackContext) -> str:
    args = context.args
    chat = update.effective_chat  # type: Optional[Chat]
    if chat.type == chat.PRIVATE:
        curr = sql.clean_service(chat.id)
        if curr:
            update.effective_message.reply_text(
                "Welcome clean service is : on", parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text(
                "Welcome clean service is : off",
                parse_mode=ParseMode.MARKDOWN)

    elif len(args) >= 1:
        var = args[0]
        if var in ("no", "off"):
            sql.set_clean_service(chat.id, False)
            update.effective_message.reply_text(
                "Welcome clean service is : off")
        elif var in ("yes", "on"):
            sql.set_clean_service(chat.id, True)
            update.effective_message.reply_text(
                "Welcome clean service is : on")
        else:
            update.effective_message.reply_text("Invalid option",
                                                parse_mode=ParseMode.MARKDOWN)
    else:
        update.effective_message.reply_text("Usage is on/yes or off/no",
                                            parse_mode=ParseMode.MARKDOWN)
Exemplo n.º 3
0
def cleanservice(update, context):
    chat = update.effective_chat
    args = context.args
    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(
                    "Turned off service messages cleaning.")
            elif var == "yes" or var == "on":
                sql.set_clean_service(chat.id, True)
                update.effective_message.reply_text(
                    "Turned on service messages cleaning!")
            else:
                update.effective_message.reply_text(
                    "Invalid option", parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text("Usage is on/yes or off/no",
                                                parse_mode=ParseMode.MARKDOWN)
    else:
        curr = sql.clean_service(chat.id)
        if curr:
            update.effective_message.reply_text(
                "Welcome clean service is : on", parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text(
                "Welcome clean service is : off",
                parse_mode=ParseMode.MARKDOWN)
Exemplo n.º 4
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)
Exemplo n.º 5
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]
            print(var)
            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:
        update.effective_message.reply_text("Please enter yes or no in your group!", parse_mode=ParseMode.MARKDOWN)
Exemplo n.º 6
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]
            print(var)
            if (var == "no" or var == "off"):
                sql.set_clean_service(chat.id, False)
                update.effective_message.reply_text("Ich lasse Servicenachrichten stehen.")
            elif(var == "yes" or var == "on"):
                sql.set_clean_service(chat.id, True)
                update.effective_message.reply_text("Ich werde Servicenachrichten löschen")
            else:
                update.effective_message.reply_text("Bitte gib 'yes' oder 'no' ein!", parse_mode=ParseMode.MARKDOWN)
        else:
            update.effective_message.reply_text("Bitte gib 'yes' oder 'no' ein!", parse_mode=ParseMode.MARKDOWN)
    else:
        update.effective_message.reply_text("Bitte gib 'yes' oder 'no' in deiner Gruppe ein!", parse_mode=ParseMode.MARKDOWN)