Fix typos

Aditya Yadav 2024-01-11 15:36:32 +00:00
parent 8102e29e17
commit 020bdd1fd4

@ -1,8 +1,8 @@
The `telegram` package contains PTBs Python implementation of the classes and methods defined in the [Bot API](https://core.telegram.org/bots/api).
This implementation is manually updated whenever Telegram releases a new version of the API.
Due to the nature of this open-source library, the implementation work usually takes some time, dependin on how much changed.
Due to the nature of this open-source library, the implementation work usually takes some time, depending on how much changed.
However, users of PTB might want to immediately use the new functionality provided by Telegram.
PTB therefore provides mechanism that make exactly this possible, i.e. accesing information from the Bot API that has no native PTB implementation yet.
PTB therefore provides mechanism that make exactly this possible, i.e. accessing information from the Bot API that has no native PTB implementation yet.
Below, we will describe the mechanisms in detail.
> [!Warning]
@ -35,7 +35,7 @@ async def callback(update, context):
application.add_handler(TypeHandler(Update, callback))
```
Of course you can also ipmlement your own subclass of [`BaseHandler`](https://docs.python-telegram-bot.org/en/stable/telegram.ext.basehandler.html) that checks for the presence of the key `user_online_status_updated` in `update.api_kwargs`. See also [[this page|Types-of-Handlers]].
Of course you can also implement your own subclass of [`BaseHandler`](https://docs.python-telegram-bot.org/en/stable/telegram.ext.basehandler.html) that checks for the presence of the key `user_online_status_updated` in `update.api_kwargs`. See also [[this page|Types-of-Handlers]].
## Sending Objects
@ -43,7 +43,7 @@ The Bot API also receives objects from you, namely as input arguments for the di
If Telegram adds new fields to objects that you send as input to Telegram, the corresponding arguments in PTBs classes will be missing.
However, any additional data that is not yet covered by the native Python attributes can be passed via the argument [`api_kwargs`](https://docs.python-telegram-bot.org/en/stable/telegram.telegramobject.html#telegram.TelegramObject.params.api_kwargs) of `TelegramObject` (note that `TelegramObject` is the base class of (almost) all other classes in the `telegram` package).
For example, imagine that Telegram adds a new field called `emoji` to the `BotCommand` class such that this emoji is shown somwhere in the chat when the command is selected by the user. Then passing the argument via `BotCommand("command", "description", emoji="💥")` is possible only after PTB was updated. However, you can already do
For example, imagine that Telegram adds a new field called `emoji` to the `BotCommand` class such that this emoji is shown somewhere in the chat when the command is selected by the user. Then passing the argument via `BotCommand("command", "description", emoji="💥")` is possible only after PTB was updated. However, you can already do
```python
BotCommand("command", "description", api_kwargs={"emoji": "💥"})
@ -70,8 +70,8 @@ and PTB will pass the data along to Telegram.
## New Parameters
All bot methots have a number of parameters defined by Telegram.
If Telegram adds new parameters to mothods that you can specify, the corresponding arguments in PTBs the methods of `telegram.Bot` (and the corresponding shortcuts) will be missing.
All bot methods have a number of parameters defined by Telegram.
If Telegram adds new parameters to methods that you can specify, the corresponding arguments in PTBs the methods of `telegram.Bot` (and the corresponding shortcuts) will be missing.
However, any additional data that is not yet covered by the native Python arguments can be passed via the argument [`api_kwargs`](https://docs.python-telegram-bot.org/en/stable/telegram.bot.html#telegram.Bot.send_message.params.api_kwargs) of the respective method.
For example, imagine that Telegram adds a new parameter called `delete_after` to the `send_message` method such that the message is deleted automatically after the specified time. Then passing the argument via `await bot.send_message(chat_id=123, text="Hello!", delete_after=42)` is possible only after PTB was updated. However, you can already do
@ -89,5 +89,5 @@ and PTB will pass the data along to Telegram.
Sometimes, Telegram adds entirely new methods to the API that you can use to trigger novel functionality.
If Telegram adds such a new method, the corresponding method of PTBs class `telegram.Bot` will be missing.
Unfurtunately, PTB does not yet have way to make the new method available to you via in a simple way. This feature is being tracked in #4053.
However, you can of course maunally do a HTTP request to the Bot API for the few API calls that are not yet wrapped by PTB.
Unfortunately, PTB does not yet have way to make the new method available to you via in a simple way. This feature is being tracked in #4053.
However, you can of course manually do a HTTP request to the Bot API for the few API calls that are not yet wrapped by PTB.