mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
fill CHANGELOG and update README
This commit is contained in:
parent
fe8c3392fa
commit
aa333d7c58
@ -47,6 +47,7 @@
|
|||||||
* `SendInvoice` now return `ContentMessage<InvoiceContent>`
|
* `SendInvoice` now return `ContentMessage<InvoiceContent>`
|
||||||
* `paymentInfo` inside of `CommonMessageImpl` now can be set only to `SuccessfulPaymentInfo`
|
* `paymentInfo` inside of `CommonMessageImpl` now can be set only to `SuccessfulPaymentInfo`
|
||||||
* Added `RecordVideoNoteAction` and `UploadVideoNoteAction` for `record_video_note` and `upload_video_note` actions
|
* Added `RecordVideoNoteAction` and `UploadVideoNoteAction` for `record_video_note` and `upload_video_note` actions
|
||||||
|
* For most part of messages was added `RequestsExecutor` extensions for more useful way of usage
|
||||||
|
|
||||||
## 0.22.0
|
## 0.22.0
|
||||||
|
|
||||||
|
42
README.md
42
README.md
@ -76,10 +76,10 @@ important objects:
|
|||||||
Types declare different objects representation. For example, `Chat` for now represented as
|
Types declare different objects representation. For example, `Chat` for now represented as
|
||||||
interface and has several realisations:
|
interface and has several realisations:
|
||||||
|
|
||||||
* PrivateChat
|
* `PrivateChat`
|
||||||
* GroupChat
|
* `GroupChat`
|
||||||
* SupergroupChat
|
* `SupergroupChat`
|
||||||
* ChannelChat
|
* `ChannelChat`
|
||||||
|
|
||||||
Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat),
|
Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat),
|
||||||
here it was separated for more obvious difference between chats types and their possible content.
|
here it was separated for more obvious difference between chats types and their possible content.
|
||||||
@ -96,7 +96,14 @@ val requestsExecutor: RequestsExecutor = ...
|
|||||||
requestsExecutor.execute(GetMe())
|
requestsExecutor.execute(GetMe())
|
||||||
```
|
```
|
||||||
|
|
||||||
The result type of [GetMe](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
|
Or you can use new syntax:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val bot: RequestsExecutor = ...
|
||||||
|
bot.getMe()
|
||||||
|
```
|
||||||
|
|
||||||
|
The result type of [GetMe (and getMe extension)](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
|
||||||
request is
|
request is
|
||||||
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
|
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
|
||||||
|
|
||||||
@ -107,31 +114,38 @@ realisation of `RequestsExecutor`, but it is possible, that in future it will be
|
|||||||
project. How to create `RequestsExecutor`:
|
project. How to create `RequestsExecutor`:
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val requestsExecutor = KtorRequestsExecutor(TOKEN)
|
val requestsExecutor = KtorRequestsExecutor(
|
||||||
|
TelegramAPIUrlsKeeper(TOKEN)
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Here `KtorRequestsExecutor` - default realisation with Ktor. `TOKEN` is just a token of bot which was retrieved
|
Here:
|
||||||
according to [instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
|
|
||||||
|
|
||||||
Besides, for correct usage of this, you must implement in your project both one of engines for client and server
|
* `KtorRequestsExecutor` - default realisation with [ktor](https://ktor.io)
|
||||||
Ktor libraries:
|
* `TelegramAPIUrlsKeeper` - special keeper, which you can save and use for getting files full urls (`resolveFileURL`
|
||||||
|
extension inside of `PathedFile.kt`)
|
||||||
|
* `TOKEN` is just a token of bot which was retrieved according to
|
||||||
|
[instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
|
||||||
|
|
||||||
|
By default, for JVM there is implemented `CIO` client engine, but there is not server engine. Both can be changed like
|
||||||
|
here:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
dependencies {
|
dependencies {
|
||||||
// ...
|
// ...
|
||||||
implementation "io.ktor:ktor-server-cio:$ktor_version"
|
implementation "io.ktor:ktor-server-cio:$ktor_version" // for implementing of server engine
|
||||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
It is able to avoid using of `server` dependency in case if will not be used `Webhook`s. In this case,
|
You can avoid using of `server` dependency in case if you will not use `Webhook`s. In this case,
|
||||||
dependencies list will be simplify:
|
dependencies list will be simplify:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
dependencies {
|
dependencies {
|
||||||
// ...
|
// ...
|
||||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user