How to use the mdformat.number_as_emoji function in mdformat

To help you get started, we’ve selected a few mdformat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JosXa / BotListBot / botlistbot / components / basic.py View on Github external
def thank_you_markup(count=0):
    assert isinstance(count, int)
    count_caption = "" if count == 0 else mdformat.number_as_emoji(count)
    button = InlineKeyboardButton(
        "{} {}".format(messages.rand_thank_you_slang(), count_caption),
        callback_data=util.callback_for_action(
            const.CallbackActions.COUNT_THANK_YOU, {"count": count + 1}
        ),
    )
    return InlineKeyboardMarkup([[button]])
github JosXa / BotListBot / botlistbot / components / admin.py View on Github external
n_suggestions = len(Suggestion.select_all())
    n_pending = len(Bot.select_pending_update())

    second_row = list()
    if n_unapproved > 0:
        second_row.append(
            KeyboardButton(
                captions.APPROVE_BOTS
                + " {}🆕".format(mdformat.number_as_emoji(n_unapproved))
            )
        )
    if n_suggestions > 0:
        second_row.append(
            KeyboardButton(
                captions.APPROVE_SUGGESTIONS
                + " {}⁉️".format(mdformat.number_as_emoji(n_suggestions))
            )
        )

    buttons = [
        [KeyboardButton(captions.EXIT), KeyboardButton(captions.REFRESH)],
        [
            KeyboardButton(captions.FIND_OFFLINE),
            KeyboardButton(captions.SEND_CONFIG_FILES),
        ],
    ]

    update_row = list()
    if n_pending > 0:
        update_row.append(
            KeyboardButton(
                captions.PENDING_UPDATE
github JosXa / BotListBot / botlistbot / components / admin.py View on Github external
buttons = [
        [KeyboardButton(captions.EXIT), KeyboardButton(captions.REFRESH)],
        [
            KeyboardButton(captions.FIND_OFFLINE),
            KeyboardButton(captions.SEND_CONFIG_FILES),
        ],
    ]

    update_row = list()
    if n_pending > 0:
        update_row.append(
            KeyboardButton(
                captions.PENDING_UPDATE
                + " {}{}".format(
                    mdformat.number_as_emoji(n_pending),
                    captions.SUGGESTION_PENDING_EMOJI,
                )
            )
        )
    if send_botlist_button:
        update_row.append(KeyboardButton(captions.SEND_BOTLIST))
    if logs_button:
        update_row.append(KeyboardButton(captions.SEND_ACTIVITY_LOGS))

    if len(update_row) > 0:
        buttons.insert(1, update_row)
    if len(second_row) > 0:
        buttons.insert(1, second_row)

    return buttons
github JosXa / BotListBot / botlistbot / components / admin.py View on Github external
def _admin_buttons(send_botlist_button=False, logs_button=False):
    n_unapproved = len(Bot.select().where(Bot.approved == False, Bot.disabled == False))
    n_suggestions = len(Suggestion.select_all())
    n_pending = len(Bot.select_pending_update())

    second_row = list()
    if n_unapproved > 0:
        second_row.append(
            KeyboardButton(
                captions.APPROVE_BOTS
                + " {}🆕".format(mdformat.number_as_emoji(n_unapproved))
            )
        )
    if n_suggestions > 0:
        second_row.append(
            KeyboardButton(
                captions.APPROVE_SUGGESTIONS
                + " {}⁉️".format(mdformat.number_as_emoji(n_suggestions))
            )
        )

    buttons = [
        [KeyboardButton(captions.EXIT), KeyboardButton(captions.REFRESH)],
        [
            KeyboardButton(captions.FIND_OFFLINE),
            KeyboardButton(captions.SEND_CONFIG_FILES),
        ],

mdformat

CommonMark compliant Markdown formatter

MIT
Latest version published 6 days ago

Package Health Score

78 / 100
Full package analysis

Similar packages