Пример #1
0
def allow_connections(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"):
                sql.set_allow_connect_to_chat(chat.id, False)
                update.effective_message.reply_text(tld(chat.id, "Disabled connections to this chat for users"))
            elif(var == "yes"):
                sql.set_allow_connect_to_chat(chat.id, True)
                update.effective_message.reply_text(tld(chat.id, "Enabled connections to this chat for users"))
            else:
                update.effective_message.reply_text(tld(chat.id, "Please enter on/yes/off/no in group!"))
        else:
            update.effective_message.reply_text(tld(chat.id, "Please enter on/yes/off/no in group!"))
    else:
        update.effective_message.reply_text(tld(chat.id, "Please enter on/yes/off/no in group!"))
Пример #2
0
def allow_connections(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_allow_connect_to_chat(chat.id, False)
                update.effective_message.reply_text(
                    tld(chat.id, "connection_disable"))
            elif var == "yes" or var == "on":
                sql.set_allow_connect_to_chat(chat.id, True)
                update.effective_message.reply_text(
                    tld(chat.id, "connection_enable"))
            else:
                update.effective_message.reply_text(
                    tld(chat.id, "connection_err_wrong_arg"))
        else:
            update.effective_message.reply_text(
                tld(chat.id, "connection_err_wrong_arg"))
    else:
        update.effective_message.reply_text(
            tld(chat.id, "connection_err_wrong_arg"))