コード例 #1
0
def set_about_bio(update: Update, context: CallbackContext):
    message = update.effective_message
    sender_id = update.effective_user.id
    bot = context.bot

    if message.reply_to_message:
        repl_message = message.reply_to_message
        user_id = repl_message.from_user.id

        if user_id == message.from_user.id:
            message.reply_text(
                "Ha, you can't set your own bio! You're at the mercy of others here...",
            )
            return

        if user_id in [777000, 1087968824] and sender_id not in DEV_USERS:
            message.reply_text("You are not authorised")
            return

        if user_id == bot.id and sender_id not in DEV_USERS:
            message.reply_text(
                "Erm... yeah, I only trust Heroes Association to set my bio.",
            )
            return

        text = message.text
        bio = text.split(
            None,
            1,
        )  # use python's maxsplit to only remove the cmd, hence keeping newlines.

        if len(bio) == 2:
            if len(bio[1]) < MAX_MESSAGE_LENGTH // 4:
                sql.set_user_bio(user_id, bio[1])
                message.reply_text(
                    "Updated {}'s bio!".format(
                        repl_message.from_user.first_name), )
            else:
                message.reply_text(
                    "Bio needs to be under {} characters! You tried to set {}."
                    .format(
                        MAX_MESSAGE_LENGTH // 4,
                        len(bio[1]),
                    ), )
    else:
        message.reply_text("Reply to someone to set their bio!")
コード例 #2
0
def set_about_bio(update: Update, context: CallbackContext):
    message = update.effective_message
    sender_id = update.effective_user.id
    bot = context.bot

    if message.reply_to_message:
        repl_message = message.reply_to_message
        user_id = repl_message.from_user.id

        if user_id == message.from_user.id:
            message.reply_text(
                "Hah, anda tidak bisa menambahkan biografi anda sendiri! Suruh orang lain disini melakukan itu..."
            )
            return

        if user_id in [777000, 1087968824] and sender_id not in DEV_USERS:
            message.reply_text("You are not authorised")
            return

        if user_id == bot.id and sender_id not in DEV_USERS:
            message.reply_text(
                "Hah... yeah, hanya Dewa yang bisa mengatur bio Saya!")
            return

        text = message.text
        bio = text.split(
            None, 1
        )  # use python's maxsplit to only remove the cmd, hence keeping newlines.

        if len(bio) == 2:
            if len(bio[1]) < MAX_MESSAGE_LENGTH // 4:
                sql.set_user_bio(user_id, bio[1])
                message.reply_text("Updated {}'s bio!".format(
                    repl_message.from_user.first_name))
            else:
                message.reply_text(
                    "Bio needs to be under {} characters! You tried to set {}."
                    .format(MAX_MESSAGE_LENGTH // 4, len(bio[1])))
    else:
        message.reply_text("Reply to someone to set their bio!")
コード例 #3
0
ファイル: userinfo.py プロジェクト: SkueletorTlg/Hexzy
def set_about_bio(update: Update, context: CallbackContext):
    message = update.effective_message
    sender_id = update.effective_user.id
    bot = context.bot

    if message.reply_to_message:
        repl_message = message.reply_to_message
        user_id = repl_message.from_user.id

        if user_id == message.from_user.id:
            message.reply_text(
                "¡No puedes establecer tu propia biografía! Estás a merced de los demás aquí..."
            )
            return

        if user_id in [777000, 1087968824] and sender_id not in DEV_USERS:
            message.reply_text("No estás autorizado")
            return

        if user_id == bot.id and sender_id not in DEV_USERS:
            message.reply_text(
                "Emm... sí, solo confío en la Asociación de Héroes para establecer mi biografía.")
            return

        text = message.text
        bio = text.split(
            None, 1
        )  # use python's maxsplit to only remove the cmd, hence keeping newlines.

        if len(bio) == 2:
            if len(bio[1]) < MAX_MESSAGE_LENGTH // 4:
                sql.set_user_bio(user_id, bio[1])
                message.reply_text("¡Se actualizó la biografía de {}!".format(
                    repl_message.from_user.first_name))
            else:
                message.reply_text(
                    "¡La biografía debe tener menos de {} caracteres! Intentaste configurar {}."
                    .format(MAX_MESSAGE_LENGTH // 4, len(bio[1])))
    else:
        message.reply_text("Reply to someone to set their bio!")
コード例 #4
0
def set_about_bio(update: Update, context: CallbackContext):
    message = update.effective_message
    sender_id = update.effective_user.id
    bot = context.bot

    if message.reply_to_message:
        repl_message = message.reply_to_message
        user_id = repl_message.from_user.id

        if user_id == message.from_user.id:
            message.reply_text(
                "Ha, öz bioqrafını təyin edə bilməzsən! Burada başqalarının mərhəmətindəsən ..."
            )
            return

        if user_id in [777000, 1087968824] and sender_id not in DEV_USERS:
            message.reply_text("Səlahiyyətli deyilsiniz")
            return

        if user_id == bot.id and sender_id not in DEV_USERS:
            message.reply_text(
                "Bəli ... bəli, yalnız biomuzu qurmaq üçün Qəhrəmanlar Dərnəyinə etibar edirəm.")
            return

        text = message.text
        bio = text.split(
            None, 1
        )  # use python's maxsplit to only remove the cmd, hence keeping newlines.

        if len(bio) == 2:
            if len(bio[1]) < MAX_MESSAGE_LENGTH // 4:
                sql.set_user_bio(user_id, bio[1])
                message.reply_text("Updated {}'s bio!".format(
                    repl_message.from_user.first_name))
            else:
                message.reply_text(
                    "Bio needs to be under {} characters! You tried to set {}."
                    .format(MAX_MESSAGE_LENGTH // 4, len(bio[1])))
    else:
        message.reply_text("Bio-nu təyin etmək üçün kiməsə cavab verin!")
コード例 #5
0
ファイル: userinfo.py プロジェクト: Gazakhzada13/TTBBot
def set_about_bio(update: Update, context: CallbackContext):
    message = update.effective_message
    sender_id = update.effective_user.id
    bot = context.bot

    if message.reply_to_message:
        repl_message = message.reply_to_message
        user_id = repl_message.from_user.id

        if user_id == message.from_user.id:
            message.reply_text(
                "Özün haqqında bir şey yaza bilmərsən. Bunu başqası eliyə bilər..."
            )
            return

        if user_id in [777000, 1087968824] and sender_id not in DEV_USERS:
            message.reply_text("yo")
            return

        if user_id == bot.id and sender_id not in DEV_USERS:
            message.reply_text(
                "hmm. Yox sən mənim haqqımda bir şey yaza bilmərsən.")
            return

        text = message.text
        bio = text.split(
            None, 1
        )  # use python's maxsplit to only remove the cmd, hence keeping newlines.

        if len(bio) == 2:
            if len(bio[1]) < MAX_MESSAGE_LENGTH // 4:
                sql.set_user_bio(user_id, bio[1])
                message.reply_text("{} istifadəçisinin biosu güncəlləndi!".format(
                    repl_message.from_user.first_name))
            else:
                message.reply_text(
                    "Bio {} simvoldan az olmalıdır! Sən {} simvoldan istifadə eləmisən."
                    .format(MAX_MESSAGE_LENGTH // 4, len(bio[1])))
    else:
        message.reply_text("Kiminsə mesajına yanıt ver!")
コード例 #6
0
def set_about_bio(bot: Bot, update: Update):
    message = update.effective_message
    sender_id = update.effective_user.id

    if message.reply_to_message:
        repl_message = message.reply_to_message
        user_id = repl_message.from_user.id

        if user_id == message.from_user.id:
            message.reply_text(
                "Ha, kendi biyografini kuramazsın! Burada başkalarının merhametindesin..."
            )
            return

        if user_id == bot.id and sender_id not in SUDO_USERS and sender_id not in DEV_USERS:
            message.reply_text(
                "Eee ... evet, sadece sudo kullanıcılarına veya geliştiricilerine biyografimi ayarlamak için güveniyorum."
            )
            return

        text = message.text
        bio = text.split(
            None, 1
        )  # use python's maxsplit to only remove the cmd, hence keeping newlines.

        if len(bio) == 2:
            if len(bio[1]) < MAX_MESSAGE_LENGTH // 4:
                sql.set_user_bio(user_id, bio[1])
                message.reply_text("Updated {}'s bio!".format(
                    repl_message.from_user.first_name))
            else:
                message.reply_text(
                    "Bir biyografinin {} karakterlerin altında olması gerekir! Ayarlamaya çalıştın {}."
                    .format(MAX_MESSAGE_LENGTH // 4, len(bio[1])))
    else:
        message.reply_text(
            "Biyografisini ayarlamak için birinin mesajını yanıtlayın!")
コード例 #7
0
ファイル: userinfo.py プロジェクト: toxic-dev0/SaitamaRobot
def set_about_bio(bot: Bot, update: Update):
    message = update.effective_message
    sender_id = update.effective_user.id

    if message.reply_to_message:
        repl_message = message.reply_to_message
        user_id = repl_message.from_user.id

        if user_id == message.from_user.id:
            message.reply_text(
                "Ha, you can't set your own bio! You're at the mercy of others here..."
            )
            return

        if user_id == bot.id and sender_id not in SUDO_USERS and sender_id not in DEV_USERS:
            message.reply_text(
                "Erm... yeah, I only trust sudo users or developers to set my bio."
            )
            return

        text = message.text
        bio = text.split(
            None, 1
        )  # use python's maxsplit to only remove the cmd, hence keeping newlines.

        if len(bio) == 2:
            if len(bio[1]) < MAX_MESSAGE_LENGTH // 4:
                sql.set_user_bio(user_id, bio[1])
                message.reply_text("Updated {}'s bio!".format(
                    repl_message.from_user.first_name))
            else:
                message.reply_text(
                    "A bio needs to be under {} characters! You tried to set {}."
                    .format(MAX_MESSAGE_LENGTH // 4, len(bio[1])))
    else:
        message.reply_text("Reply to someone's message to set their bio!")