mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-25 00:27:46 +01:00
Updated Code snippets (markdown)
parent
9307987a32
commit
0370dddffd
1 changed files with 3 additions and 3 deletions
|
@ -87,7 +87,7 @@ await bot.send_message(chat_id=chat_id, text="I'm sorry Dave I'm afraid I can't
|
||||||
---
|
---
|
||||||
#### Reply to a message
|
#### Reply to a message
|
||||||
|
|
||||||
This is a shortcut to `bot.send_message` with same defaults. Read more about it [in the docs](https://docs.python-telegram-bot.org/en/latest/telegram.message.html#telegram.Message.reply_text).
|
This is a shortcut to `bot.send_message` with same defaults. Read more about it [in the docs](https://docs.python-telegram-bot.org/telegram.message.html#telegram.Message.reply_text).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
await update.message.reply_text("I'm sorry Dave I'm afraid I can't do that.")
|
await update.message.reply_text("I'm sorry Dave I'm afraid I can't do that.")
|
||||||
|
@ -123,7 +123,7 @@ To catch the incoming message with the location/contact, use `MessageHandler` wi
|
||||||
---
|
---
|
||||||
### Message Formatting (bold, italic, code, ...)
|
### Message Formatting (bold, italic, code, ...)
|
||||||
|
|
||||||
Telegram supports some formatting options for text. All the details about what is supported can be found [here](https://core.telegram.org/bots/api#formatting-options). Please keep in mind that you will have to escape the special characters as detailed in the documentation. PTB also offers a [helper function](https://docs.python-telegram-bot.org/en/latest/telegram.helpers.html#telegram.helpers.escape_markdown) for escaping of Markdown text. For escaping of HTML text, you can use [`html.escape`](https://docs.python.org/3/library/html.html?#html.escape) from the standard library.
|
Telegram supports some formatting options for text. All the details about what is supported can be found [here](https://core.telegram.org/bots/api#formatting-options). Please keep in mind that you will have to escape the special characters as detailed in the documentation. PTB also offers a [helper function](https://docs.python-telegram-bot.org/telegram.helpers.html#telegram.helpers.escape_markdown) for escaping of Markdown text. For escaping of HTML text, you can use [`html.escape`](https://docs.python.org/3/library/html.html?#html.escape) from the standard library.
|
||||||
|
|
||||||
You can format text with every API method/type that has a `parse_mode` parameter. In addition to editing your text as described in the link above, pass one of the parse modes available through [`telegram.constants.ParseMode`](https://python-telegram-bot.readthedocs.io/telegram.constants.html#telegram.constants.ParseMode) to the `parse_mode` parameter. Since the `5.0` update of the Bot API (version `13.1+` of PTB), you can alternatively pass a list of [`telegram.MessageEntities`](https://python-telegram-bot.readthedocs.io/telegram.messageentity.html) to the `entities` parameter.
|
You can format text with every API method/type that has a `parse_mode` parameter. In addition to editing your text as described in the link above, pass one of the parse modes available through [`telegram.constants.ParseMode`](https://python-telegram-bot.readthedocs.io/telegram.constants.html#telegram.constants.ParseMode) to the `parse_mode` parameter. Since the `5.0` update of the Bot API (version `13.1+` of PTB), you can alternatively pass a list of [`telegram.MessageEntities`](https://python-telegram-bot.readthedocs.io/telegram.messageentity.html) to the `entities` parameter.
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ You can use the `header_buttons` and `footer_buttons` lists to put buttons in th
|
||||||
|
|
||||||
![Output](http://i.imgur.com/susvvR7.png)
|
![Output](http://i.imgur.com/susvvR7.png)
|
||||||
|
|
||||||
Replace the `...` in below snippet by an appropriate argument, as indicated in the [InlineKeyboardButton documentation](https://python-telegram-bot.readthedocs.io/en/latest/telegram.inlinekeyboardbutton.html). If you want to use `KeyboardButtons`, use `ReplyKeyboardMarkup` instead of `InlineKeyboardMarkup`.
|
Replace the `...` in below snippet by an appropriate argument, as indicated in the [InlineKeyboardButton documentation](https:/docs.python-telegram-bot.org/telegram.inlinekeyboardbutton.html). If you want to use `KeyboardButtons`, use `ReplyKeyboardMarkup` instead of `InlineKeyboardMarkup`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
button_list = [
|
button_list = [
|
||||||
|
|
Loading…
Reference in a new issue