예제 #1
0
def get_main_keyboard(user):
    """Get the main keyboard for the current user."""
    buttons = [[
        InlineKeyboardButton(text="⚙️ Settings",
                             callback_data=build_data("settings_open"))
    ]]
    if user.admin:
        buttons.append([
            InlineKeyboardButton(
                text="⚙️ Admin Settings",
                callback_data=build_data("admin_settings_open"),
            )
        ])

    buttons.append([
        InlineKeyboardButton(text="? Tag random stickers ?",
                             callback_data=build_data("tag_random"))
    ])
    buttons.append([
        InlineKeyboardButton(text="🤔 Help",
                             callback_data=build_data("help_open"))
    ])

    keyboard = InlineKeyboardMarkup(buttons)
    return keyboard
예제 #2
0
def get_help_keyboard(categories, current_category):
    """Get the done keyboard for options during poll creation."""
    rows = []
    current_row = []
    while len(categories) > 0:
        category = categories.pop(0)
        payload = build_data("switch_help", action=category)
        text = category
        if category == current_category:
            text = f"[ {category} ]"
        button = InlineKeyboardButton(text, callback_data=payload)

        if len(current_row) < 3:
            current_row.append(button)
        else:
            rows.append(current_row)
            current_row = [button]

    rows.append(current_row)

    main_payload = build_data("main_menu")
    rows.append(
        [InlineKeyboardButton(text="Back", callback_data=main_payload)])

    return InlineKeyboardMarkup(rows)
예제 #3
0
def get_user_delete_history_confirmation_keyboard():
    """Ask the user if they really want to delete the history."""
    buttons = [
        [InlineKeyboardButton(text="⚠️ Permanently delete history ⚠️",
                              callback_data=build_data("user_delete_history"))],
        [InlineKeyboardButton(text="back",
                              callback_data=build_data("settings_open"))],
    ]

    return InlineKeyboardMarkup(buttons)
예제 #4
0
def get_settings_keyboard(user):
    """Get the inline keyboard for settings."""
    international_payload = build_user_data("user_toggle_international", user)
    deluxe_payload = build_user_data("user_toggle_deluxe", user)
    nsfw_payload = build_user_data("user_toggle_nsfw", user)
    furry_payload = build_user_data("user_toggle_furry", user)
    notification_payload = build_data("user_toggle_notifications")
    delete_history_payload = build_data("user_delete_history_confirmation")
    main_payload = build_data("main_menu")

    if user.notifications:
        notification_text = "📩 Disable notifications"
    else:
        notification_text = "📩 Enable notifications"

    if user.international:
        international_text = "🌐 English-only sticker"
    else:
        international_text = "🌐 Include non-english stickers"

    if user.deluxe:
        deluxe_text = "🌟 Include non-deluxe sticker"
    else:
        deluxe_text = "🌟 Only show deluxe sticker"

    if user.nsfw:
        nsfw_text = "❌ Hide nsfw"
    else:
        nsfw_text = "💦 Include nsfw by default"

    if user.furry:
        furry_text = "Hide furry"
    else:
        furry_text = "Include furry by default"

    buttons = [
        [
            InlineKeyboardButton(text=notification_text,
                                 callback_data=notification_payload)
        ],
        [
            InlineKeyboardButton(text=international_text,
                                 callback_data=international_payload)
        ],
        [InlineKeyboardButton(text=deluxe_text, callback_data=deluxe_payload)],
        [InlineKeyboardButton(text=nsfw_text, callback_data=nsfw_payload)],
        [InlineKeyboardButton(text=furry_text, callback_data=furry_payload)],
        [
            InlineKeyboardButton(text="⚠️ Delete history ⚠️",
                                 callback_data=delete_history_payload)
        ],
        [InlineKeyboardButton(text="Back", callback_data=main_payload)],
    ]

    return InlineKeyboardMarkup(buttons)
예제 #5
0
def get_admin_settings_keyboard(user):
    """Get the inline keyboard for admin settings."""
    main_payload = build_data("main_menu")

    buttons = [
        [
            InlineKeyboardButton(text="Stats",
                                 callback_data=build_data("admin_stats"))
        ],
        [
            InlineKeyboardButton(text="Cleanup",
                                 callback_data=build_data("admin_cleanup"))
        ],
        [
            InlineKeyboardButton(text="Plot",
                                 callback_data=build_data("admin_plot"))
        ],
        [
            InlineKeyboardButton(text="Refresh all sticker",
                                 callback_data=build_data("admin_refresh"))
        ],
        [
            InlineKeyboardButton(
                text="Refresh all sticker + OCR",
                callback_data=build_data("admin_refresh_ocr"),
            )
        ],
        [InlineKeyboardButton(text="Back", callback_data=main_payload)],
    ]

    return InlineKeyboardMarkup(buttons)
예제 #6
0
def get_donation_keyboard():
    """Get the donation keyboard."""
    patreon_url = f"https://patreon.com/nukesor"
    paypal_url = f"https://paypal.me/arnebeer/1"
    main_payload = build_data("main_menu")

    buttons = [
        [InlineKeyboardButton(text="Patreon", url=patreon_url)],
        [InlineKeyboardButton(text="Paypal", url=paypal_url)],
        [InlineKeyboardButton(text="Back", callback_data=main_payload)],
    ]

    return InlineKeyboardMarkup(buttons)