How to use the mdformat.action_hint 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 / botproperties.py View on Github external
def set_text_property(bot, update, chat_data, property_name, to_edit=None):
    uid = util.uid_from_update(update)
    user = User.from_update(update)
    if check_suggestion_limit(bot, update, user):
        return

    if to_edit:
        text = (
            util.escape_markdown(getattr(to_edit, property_name)) + "\n\n" if getattr(to_edit,
                                                                                      property_name) else '')
        text += mdformat.action_hint(
            messages.SET_BOTPROPERTY.format(
                property_name,
                util.escape_markdown(to_edit.username),
                CLEAR_QUERY
            ))
        if property_name == 'description':
            text += ', markdown enabled.'
        update.effective_message.reply_text(text, reply_markup=ForceReply(selective=True),
                                            parse_mode=ParseMode.MARKDOWN)
        chat_data['edit_bot'] = to_edit
    elif update.message:
        value = None
        text = update.message.text

        to_edit = chat_data.get('edit_bot', None)
github JosXa / BotListBot / botlistbot / components / broadcasts.py View on Github external
)
                user_data['broadcast']['mode'] = 'replying'
        # answer and clean
        msg = bot.send_message(cid, "k")
        _delete_multiple_delayed(bot, cid, delayed=[msg.message_id], immediately=[update.message.message_id])

    to_text = "  _to_  "
    text += "Send me the text to broadcast to @BotListChat.\n"
    text += "_You can use the following words and they will replaced:_\n\n"

    text += '\n'.join(['"{}"{}{}'.format(k, to_text, v) for k, v in BROADCAST_REPLACEMENTS.items()])

    # TODO Build text mentioning replacements
    # text += '\n@' + str(update.effective_user.username) + to_text + user.markdown_short

    bot.formatter.send_or_edit(uid, mdformat.action_hint(text), mid)
    return BotStates.BROADCASTING
github JosXa / BotListBot / botlistbot / lib / markdownformatter.py View on Github external
def send_action_hint(self, chat_id, text: str, **kwargs):
        if text[-1] == '.':
            text = text[0:-1]
        return self.bot.sendMessage(
            chat_id,
            action_hint(text),
            **self._set_defaults(kwargs))
github JosXa / BotListBot / botlistbot / components / admin.py View on Github external
def prepare_transmission(bot, update, chat_data):
    chat_id = util.uid_from_update(update)
    pending_update(bot, update)
    text = mdformat.action_hint("Notify subscribers about this update?")
    reply_markup = InlineKeyboardMarkup(
        [
            [
                InlineKeyboardButton(
                    "☑ Notifications",
                    callback_data=util.callback_for_action(
                        CallbackActions.SEND_BOTLIST, {"silent": False}
                    ),
                ),
                InlineKeyboardButton(
                    "Silent",
                    callback_data=util.callback_for_action(
                        CallbackActions.SEND_BOTLIST, {"silent": True}
                    ),
                ),
            ],
github JosXa / BotListBot / botlistbot / components / basic.py View on Github external
def main_menu(bot, update):
    chat_id = update.effective_chat.id
    is_admin = chat_id in settings.MODERATORS
    reply_markup = (
        ReplyKeyboardMarkup(
            main_menu_buttons(is_admin), resize_keyboard=True, one_time_keyboard=True
        )
        if util.is_private_message(update)
        else ReplyKeyboardRemove()
    )

    bot.sendMessage(
        chat_id,
        mdformat.action_hint("What would you like to do?"),
        reply_markup=reply_markup,
    )

mdformat

CommonMark compliant Markdown formatter

MIT
Latest version published 22 days ago

Package Health Score

81 / 100
Full package analysis

Similar packages