コード例 #1
0
def set_about_me(update: Update, context: CallbackContext):
    message = update.effective_message
    user_id = message.from_user.id
    if user_id in [777000, 1087968824]:
        message.reply_text("Error! Unauthorized")
        return
    bot = context.bot
    if message.reply_to_message:
        repl_message = message.reply_to_message
        repl_user_id = repl_message.from_user.id
        if repl_user_id in [bot.id, 777000, 1087968824] and (user_id
                                                             in DEV_USERS):
            user_id = repl_user_id
    text = message.text
    info = text.split(None, 1)
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            if user_id in [777000, 1087968824]:
                message.reply_text("Authorized...Information updated!")
            elif user_id == bot.id:
                message.reply_text(
                    "I have updated my info with the one you provided!")
            else:
                message.reply_text("Information updated!")
        else:
            message.reply_text(
                "The info needs to be under {} characters! You have {}.".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #2
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message
    user_id = message.from_user.id
    if user_id in (777000, 1087968824):
        message.reply_text("Jangan atur info untuk bot Telegram!")
        return
    if message.reply_to_message:
        repl_message = message.reply_to_message
        repl_user_id = repl_message.from_user.id
        if repl_user_id == bot.id and (user_id in SUDO_USERS
                                       or user_id in DEV_USERS):
            user_id = repl_user_id

    text = message.text
    info = text.split(None, 1)

    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            if user_id == bot.id:
                message.reply_text("Memperbarui info saya!")
            else:
                message.reply_text("Memperbarui info Anda!")
        else:
            message.reply_text(
                "Info harus kurang dari {} karakter! Kamu punya {}.".format(
                    MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #3
0
def set_about_me(update: Update, context: CallbackContext):
    bot = context.bot
    message = update.effective_message
    user_id = message.from_user.id
    if user_id in (777000, 1087968824):
        message.reply_text("Don't set info for Telegram bots!")
        return
    if message.reply_to_message:
        repl_message = message.reply_to_message
        repl_user_id = repl_message.from_user.id
        if repl_user_id == bot.id and (user_id in SUDO_USERS
                                       or user_id in DEV_USERS):
            user_id = repl_user_id

    text = message.text
    info = text.split(None, 1)

    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            if user_id == bot.id:
                message.reply_text("Updated my info!")
            else:
                message.reply_text("Updated your info!")
        else:
            message.reply_text(
                "The info needs to be under {} characters! You have {}.".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #4
0
def set_about_me(bot: Bot, update: Update):

    message = update.effective_message
    user_id = message.from_user.id
    if message.reply_to_message:
        repl_message = message.reply_to_message
        repl_user_id = repl_message.from_user.id
        if repl_user_id == bot.id and (user_id in SUDO_USERS
                                       or user_id in DEV_USERS):
            user_id = repl_user_id

    text = message.text
    info = text.split(None, 1)

    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            if user_id == bot.id:
                message.reply_text("Updated my info!")
            else:
                message.reply_text("Updated your info!")
        else:
            message.reply_text(
                "The info needs to be under {} characters! You have {}.".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #5
0
ファイル: userinfo.py プロジェクト: Sunda001/SaitamaRobot
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    if message.reply_to_message:
        repl_message = message.reply_to_message
        repl_user_id = repl_message.from_user.id
        if repl_user_id == bot.id and (user_id in SUDO_USERS
                                       or user_id in DEV_USERS):
            user_id = repl_user_id

    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            if user_id == bot.id:
                message.reply_text("Updated my info!")
            else:
                message.reply_text("Updated your info!")
        else:
            message.reply_text(
                "The info needs to be under {} characters! You have {}.".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #6
0
def set_about_me(bot, update):
    message = update.effective_message
    user_id = message.from_user.id
    text = message.text
    info = text.split(None, 1)  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        sql.set_user_me_info(user_id, info[1])
        update.effective_message.reply_text("Updated your info!")
コード例 #7
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(None, 1)  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Atualizei sua info!")
        else:
            message.reply_text(
                "Sua info tem que ter menos de {} caracteres! Você digitou {}.".format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #8
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(None, 1)  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("اطلاعاتتون آبدیت شد!")
        else:
            message.reply_text(
                "اطلاعات شما باید کمتر از {} کاراکتر باشه . کاراکتر های شما{}".format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #9
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(None, 1)  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Your information has been recorded successfully")
        else:
            message.reply_text(
                " About You{} To be confined to letters ".format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #10
0
ファイル: userinfo.py プロジェクト: anandhu-dev/mynewbot
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(None, 1)  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("താങ്കളുടെ വിവരങ്ങൾ വിജയകരമായി രേഖപ്പെടുത്തിയിരിക്കുന്നു ")
        else:
            message.reply_text(
                "Your info needs to be under {} characters! You have {}.".format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #11
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Bilgileriniz başarıyla kaydedildi")
        else:
            message.reply_text(" Hakkında{} Harflerle sınırlı kalmak ".format(
                MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #12
0
ファイル: userinfo.py プロジェクト: mfazin/Marie-Arabic
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("تم تسجيل معلوماتك بنجاح")
        else:
            message.reply_text(" عنك {} أن تكون محصورة على الحروف ".format(
                MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #13
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("ඔබේ තොරතුරු සාර්ථකව පටිගත කර ඇත")
        else:
            message.reply_text(" ඔයා ගැන{} අකුරු වලට සීමා වීම ".format(
                MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #14
0
ファイル: userinfo.py プロジェクト: mracar07/tgbot
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Bilgilerinizi güncellendi!")
        else:
            message.reply_text(
                "Bilgilerinizin {} karakterin altında olması gerekiyor! şuan {} karaktere sahipsiniz."
                .format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #15
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Informazioni utente aggiornate!")
        else:
            message.reply_text(
                "La tua bio deve avere meno di {} caratteri! Tu hai {}.".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #16
0
def set_about_me(update: Update, context: CallbackContext):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Updated your info!")
        else:
            message.reply_text(
                "Your info needs to be under {} characters! You have {}.".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #17
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("info 을(를) 업데이트했어요!")
        else:
            message.reply_text(
                "me 의 글자 수는 {} 자 아래여야 해요! 그러나 당신은 {} 자를 입력했어요.".format(
                    MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #18
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Twoje informacje zostały pomyślnie zapisane")
        else:
            message.reply_text(
                "O tobie powinien ograniczać się do {} liter".format(
                    MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #19
0
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text(
                "താങ്കളുടെ വിവരങ്ങൾ വിജയകരമായി രേഖപ്പെടുത്തിയിരിക്കുന്നു ")
        else:
            message.reply_text(
                "താങ്കളെ കുറിച്ചുള്ള വിവരണം {} അക്ഷരങ്ങളിൽ ഒതുക്കേണ്ടതാണ് ".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
コード例 #20
0
ファイル: userinfo.py プロジェクト: MrSammy0/nancybot
def set_about_me(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    user_id = message.from_user.id
    if user_id in (777000, 1087968824):
        message.reply_text("Don't set info for Telegram bots!")
        return
    text = message.text
    info = text.split(
        None, 1
    )  # use python's maxsplit to only remove the cmd, hence keeping newlines.
    if len(info) == 2:
        if len(info[1]) < MAX_MESSAGE_LENGTH // 4:
            sql.set_user_me_info(user_id, info[1])
            message.reply_text("Updated your info!")
        else:
            message.reply_text(
                "Your info needs to be under {} characters! You have {}.".
                format(MAX_MESSAGE_LENGTH // 4, len(info[1])))