mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-30 03:15:42 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74fb448378 | |||
| 9df9af193c | |||
| ba4b4c4b64 | |||
| fa0861b8bc | |||
| 20494e1d4a | |||
| a404008dee | |||
| 881205dd80 | |||
| 2096c44811 | |||
| 1a3da33589 | |||
| be28c9bd5d | |||
| a193ef5fd5 | |||
| 7c43d3aaa5 | |||
| e034afc75c | |||
| 08e3326d1a | |||
| 6dd1825b98 | |||
| bd4eb29fc1 | |||
| 2cc66ef13c | |||
| 9a8175d1c8 | |||
| 25285b2e8a | |||
| bb09f05d7b |
32
CHANGELOG.md
32
CHANGELOG.md
@@ -1,5 +1,37 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 0.30.11
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.4.11` -> `0.4.15`
|
||||
* `Klock`: `2.0.1` -> `2.0.3`
|
||||
* `Ktor`: `1.4.3` -> `1.5.0`
|
||||
* `Core`:
|
||||
* All bot actions got functions for short calling, like `recordVideo` for `RecordVideoNote`
|
||||
* All bot actions got class-cast shortcuts
|
||||
|
||||
## 0.30.10
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `Kotlin`: `1.4.20` -> `1.4.21`
|
||||
* `Klock`: `2.0.0` -> `2.0.1`
|
||||
* `Ktor`: `1.4.2` -> `1.4.3`
|
||||
* `MicroUtils`: `0.4.6` -> `0.4.11`
|
||||
* `API Extensions`:
|
||||
* New function `buildBot`
|
||||
|
||||
## 0.30.9
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `UUID`: `0.2.2` -> `0.2.3`
|
||||
* `Coroutines`: `1.4.1` -> `1.4.2`
|
||||
* `MicroUtils`: `0.4.3` -> `0.4.6`
|
||||
* `Core`:
|
||||
* Add `BowlingDiceAnimationType`
|
||||
|
||||
## 0.30.8
|
||||
|
||||
* `Common`:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
dokka_version=1.4.0
|
||||
dokka_version=1.4.20
|
||||
|
||||
org.gradle.jvmargs=-Xmx1024m
|
||||
|
||||
@@ -5,18 +5,18 @@ kotlin.js.generate.externals=true
|
||||
kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
kotlin_version=1.4.20
|
||||
kotlin_coroutines_version=1.4.1
|
||||
kotlin_version=1.4.21
|
||||
kotlin_coroutines_version=1.4.2
|
||||
kotlin_serialisation_runtime_version=1.0.1
|
||||
klock_version=2.0.0
|
||||
uuid_version=0.2.2
|
||||
ktor_version=1.4.2
|
||||
klock_version=2.0.3
|
||||
uuid_version=0.2.3
|
||||
ktor_version=1.5.0
|
||||
|
||||
micro_utils_version=0.4.3
|
||||
micro_utils_version=0.4.15
|
||||
|
||||
javax_activation_version=1.1.1
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=0.30.8
|
||||
library_version=0.30.11
|
||||
|
||||
github_release_plugin_version=2.2.12
|
||||
|
||||
@@ -61,10 +61,13 @@ val inlineQueryAnswerResultsLimit = 0 .. 50
|
||||
|
||||
val customTitleLength = 0 .. 16
|
||||
|
||||
val dartsAndCubeDiceResultLimit = 1 .. 6
|
||||
@Deprecated("Renamed", ReplaceWith("dartsAndCubeDiceResultLimit", "dev.inmo.tgbotapi.types.dartsAndCubeDiceResultLimit"))
|
||||
val dartsCubeAndBowlingDiceResultLimit = 1 .. 6
|
||||
@Deprecated("Renamed", ReplaceWith("dartsCubeAndBowlingDiceResultLimit", "dev.inmo.tgbotapi.types.dartsCubeAndBowlingDiceResultLimit"))
|
||||
val dartsAndCubeDiceResultLimit
|
||||
get() = dartsCubeAndBowlingDiceResultLimit
|
||||
@Deprecated("Renamed", ReplaceWith("dartsCubeAndBowlingDiceResultLimit", "dev.inmo.tgbotapi.types.dartsCubeAndBowlingDiceResultLimit"))
|
||||
val diceResultLimit
|
||||
get() = dartsAndCubeDiceResultLimit
|
||||
get() = dartsCubeAndBowlingDiceResultLimit
|
||||
val basketballAndFootballDiceResultLimit = 1 .. 5
|
||||
val slotMachineDiceResultLimit = 1 .. 64
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ internal object BotActionSerializer: KSerializer<BotAction> {
|
||||
object TypingAction : BotAction() {
|
||||
override val actionName: String = "typing"
|
||||
}
|
||||
inline val typing
|
||||
get() = TypingAction
|
||||
inline fun BotAction.asTyping() = this as? TypingAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is uploading some photo
|
||||
@@ -50,6 +53,9 @@ object TypingAction : BotAction() {
|
||||
object UploadPhotoAction : BotAction() {
|
||||
override val actionName: String = "upload_photo"
|
||||
}
|
||||
inline val uploadPhoto
|
||||
get() = UploadPhotoAction
|
||||
inline fun BotAction.asUploadPhoto() = this as? UploadPhotoAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is recording some video
|
||||
@@ -58,6 +64,9 @@ object UploadPhotoAction : BotAction() {
|
||||
object RecordVideoAction : BotAction() {
|
||||
override val actionName: String = "record_video"
|
||||
}
|
||||
inline val recordVideo
|
||||
get() = RecordVideoAction
|
||||
inline fun BotAction.asRecordVideo() = this as? RecordVideoAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is uploading some photo
|
||||
@@ -66,6 +75,9 @@ object RecordVideoAction : BotAction() {
|
||||
object UploadVideoAction : BotAction() {
|
||||
override val actionName: String = "upload_video"
|
||||
}
|
||||
inline val uploadVideo
|
||||
get() = UploadVideoAction
|
||||
inline fun BotAction.asUploadVideo() = this as? UploadVideoAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is recording some audio
|
||||
@@ -74,6 +86,9 @@ object UploadVideoAction : BotAction() {
|
||||
object RecordAudioAction : BotAction() {
|
||||
override val actionName: String = "record_audio"
|
||||
}
|
||||
inline val recordAudio
|
||||
get() = RecordAudioAction
|
||||
inline fun BotAction.asRecordAudio() = this as? RecordAudioAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is uploading some audio
|
||||
@@ -82,6 +97,9 @@ object RecordAudioAction : BotAction() {
|
||||
object UploadAudioAction : BotAction() {
|
||||
override val actionName: String = "upload_audio"
|
||||
}
|
||||
inline val uploadAudio
|
||||
get() = UploadAudioAction
|
||||
inline fun BotAction.asUploadAudio() = this as? UploadAudioAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is uploading some document
|
||||
@@ -90,6 +108,9 @@ object UploadAudioAction : BotAction() {
|
||||
object UploadDocumentAction : BotAction() {
|
||||
override val actionName: String = "upload_document"
|
||||
}
|
||||
inline val uploadDocument
|
||||
get() = UploadDocumentAction
|
||||
inline fun BotAction.asUploadDocument() = this as? UploadDocumentAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is trying to find location
|
||||
@@ -98,6 +119,9 @@ object UploadDocumentAction : BotAction() {
|
||||
object FindLocationAction : BotAction() {
|
||||
override val actionName: String = "find_location"
|
||||
}
|
||||
inline val findLocation
|
||||
get() = FindLocationAction
|
||||
inline fun BotAction.asFindLocation() = this as? FindLocationAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is recording video note
|
||||
@@ -106,6 +130,9 @@ object FindLocationAction : BotAction() {
|
||||
object RecordVideoNoteAction : BotAction() {
|
||||
override val actionName: String = "record_video_note"
|
||||
}
|
||||
inline val recordVideoNote
|
||||
get() = RecordVideoNoteAction
|
||||
inline fun BotAction.asRecordVideoNote() = this as? RecordVideoNoteAction
|
||||
|
||||
/**
|
||||
* Will notify user that bot is uploading video note
|
||||
@@ -114,3 +141,6 @@ object RecordVideoNoteAction : BotAction() {
|
||||
object UploadVideoNoteAction : BotAction() {
|
||||
override val actionName: String = "upload_video_note"
|
||||
}
|
||||
inline val uploadVideoNote
|
||||
get() = UploadVideoNoteAction
|
||||
inline fun BotAction.asUploadVideoNote() = this as? UploadVideoNoteAction
|
||||
|
||||
@@ -15,13 +15,13 @@ sealed class DiceAnimationType {
|
||||
object CubeDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFB2"
|
||||
override val valueLimits: IntRange
|
||||
get() = dartsAndCubeDiceResultLimit
|
||||
get() = dartsCubeAndBowlingDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object DartsDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFAF"
|
||||
override val valueLimits: IntRange
|
||||
get() = dartsAndCubeDiceResultLimit
|
||||
get() = dartsCubeAndBowlingDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object BasketballDiceAnimationType : DiceAnimationType() {
|
||||
@@ -36,6 +36,12 @@ object FootballDiceAnimationType : DiceAnimationType() {
|
||||
get() = basketballAndFootballDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object BowlingDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFB3"
|
||||
override val valueLimits: IntRange
|
||||
get() = dartsCubeAndBowlingDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object SlotMachineDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFB0"
|
||||
override val valueLimits: IntRange
|
||||
@@ -59,6 +65,7 @@ internal object DiceAnimationTypeSerializer : KSerializer<DiceAnimationType> {
|
||||
BasketballDiceAnimationType.emoji -> BasketballDiceAnimationType
|
||||
SlotMachineDiceAnimationType.emoji -> SlotMachineDiceAnimationType
|
||||
FootballDiceAnimationType.emoji -> FootballDiceAnimationType
|
||||
BowlingDiceAnimationType.emoji -> BowlingDiceAnimationType
|
||||
else -> CustomDiceAnimationType(type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.HttpClientConfig
|
||||
import io.ktor.client.engine.*
|
||||
@@ -36,10 +37,25 @@ data class BotBuilder internal constructor(
|
||||
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
||||
* [block]
|
||||
*/
|
||||
fun buildBot(
|
||||
token: String,
|
||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||
block: BotBuilder.() -> Unit
|
||||
) = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, apiUrl),
|
||||
BotBuilder().apply(block).createHttpClient()
|
||||
)
|
||||
|
||||
/**
|
||||
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
||||
* [block]
|
||||
*/
|
||||
@Deprecated("Renamed", ReplaceWith("buildBot", "dev.inmo.tgbotapi.extensions.api.buildBot"))
|
||||
fun telegramBot(
|
||||
token: String,
|
||||
block: BotBuilder.() -> Unit
|
||||
): TelegramBot = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token),
|
||||
BotBuilder().apply(block).createHttpClient()
|
||||
): TelegramBot = buildBot(
|
||||
token,
|
||||
telegramBotAPIDefaultUrl,
|
||||
block
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user