mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
commit
6654f27f9d
@ -1,5 +1,13 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 0.30.1
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.2.7` -> `0.3.0`
|
||||
* `Utils`:
|
||||
* Builder-style DSL for text sources - `buildEntities` (thanks to [djaler](https://github.com/djaler))
|
||||
|
||||
## 0.30.0 Bot API 5.0
|
||||
|
||||
**THIS UPDATE CONTAINS A LOT OF BREAKING CHANGES. PLEASE, BE CAREFUL ON UPGRADING OF YOUR PROJECT**
|
||||
|
@ -12,12 +12,12 @@ klock_version=1.12.1
|
||||
uuid_version=0.2.2
|
||||
ktor_version=1.4.1
|
||||
|
||||
micro_utils_version=0.2.7
|
||||
micro_utils_version=0.3.0
|
||||
|
||||
javax_activation_version=1.1.1
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=0.30.0
|
||||
library_version=0.30.1
|
||||
|
||||
gradle_bintray_plugin_version=1.8.5
|
||||
github_release_plugin_version=2.2.12
|
||||
|
@ -1 +1 @@
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}
|
@ -27,6 +27,7 @@ bintray {
|
||||
}
|
||||
|
||||
publish = true
|
||||
override = true
|
||||
|
||||
pkg {
|
||||
repo = "TelegramBotAPI"
|
||||
|
@ -1 +1 @@
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}
|
@ -27,6 +27,7 @@ bintray {
|
||||
}
|
||||
|
||||
publish = true
|
||||
override = true
|
||||
|
||||
pkg {
|
||||
repo = "TelegramBotAPI"
|
||||
|
@ -1 +1 @@
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Utility Extensions","description":"Util extensions for more useful work with updates and other things","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-utils","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Utility Extensions","description":"Util extensions for more useful work with updates and other things","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-utils","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}
|
@ -27,6 +27,7 @@ bintray {
|
||||
}
|
||||
|
||||
publish = true
|
||||
override = true
|
||||
|
||||
pkg {
|
||||
repo = "TelegramBotAPI"
|
||||
|
@ -0,0 +1,140 @@
|
||||
@file:Suppress("NOTHING_TO_INLINE", "unused")
|
||||
|
||||
package dev.inmo.tgbotapi.extensions.utils.formatting
|
||||
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
|
||||
import dev.inmo.tgbotapi.types.User
|
||||
|
||||
fun buildEntities(init: EntitiesBuilder.() -> Unit): List<TextSource> = EntitiesBuilder().apply(init).build()
|
||||
|
||||
/**
|
||||
* This builder can be used to provide building of [TextSource]s [List]
|
||||
*
|
||||
* @see buildEntities
|
||||
*/
|
||||
class EntitiesBuilder internal constructor(
|
||||
private val entitiesList: MutableList<TextSource> = mutableListOf()
|
||||
) {
|
||||
/**
|
||||
* It is not safe field which contains potentially changeable [List]
|
||||
*/
|
||||
val entities: List<TextSource>
|
||||
get() = entitiesList
|
||||
|
||||
/**
|
||||
* @return New immutable list which will be deattached from this builder
|
||||
*/
|
||||
fun build(): List<TextSource> = entities.toList()
|
||||
|
||||
fun add(source: TextSource) { entitiesList.add(source) }
|
||||
|
||||
operator fun TextSource.unaryPlus() = add(this)
|
||||
operator fun List<TextSource>.unaryPlus() = entitiesList.addAll(this)
|
||||
operator fun invoke(vararg source: TextSource) = entitiesList.addAll(source)
|
||||
|
||||
operator fun String.unaryPlus() {
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.regular(this))
|
||||
}
|
||||
}
|
||||
|
||||
inline fun EntitiesBuilder.bold(parts: List<TextSource>) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(parts))
|
||||
|
||||
inline fun EntitiesBuilder.bold(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.bold(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(text))
|
||||
|
||||
inline fun EntitiesBuilder.botCommand(command: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.botCommand(command))
|
||||
|
||||
inline fun EntitiesBuilder.cashTag(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.cashTag(parts))
|
||||
|
||||
inline fun EntitiesBuilder.cashTag(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.cashTag(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.cashTag(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.cashTag(text))
|
||||
|
||||
inline fun EntitiesBuilder.code(code: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.code(code))
|
||||
|
||||
inline fun EntitiesBuilder.email(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(parts))
|
||||
|
||||
inline fun EntitiesBuilder.email(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.email(emailAddress: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(emailAddress))
|
||||
|
||||
inline fun EntitiesBuilder.hashtag(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(parts))
|
||||
|
||||
inline fun EntitiesBuilder.hashtag(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.hashtag(hashtag: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(hashtag))
|
||||
|
||||
inline fun EntitiesBuilder.italic(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(parts))
|
||||
|
||||
inline fun EntitiesBuilder.italic(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.italic(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(text))
|
||||
|
||||
inline fun EntitiesBuilder.mention(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(parts))
|
||||
|
||||
inline fun EntitiesBuilder.mention(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.mention(whoToMention: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(whoToMention))
|
||||
|
||||
inline fun EntitiesBuilder.mention(parts: List<TextSource>, user: User) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(parts, user))
|
||||
|
||||
inline fun EntitiesBuilder.mention(user: User, vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(user, *parts))
|
||||
|
||||
inline fun EntitiesBuilder.mention(text: String, user: User) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(text, user))
|
||||
|
||||
inline fun EntitiesBuilder.phone(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.phone(parts))
|
||||
|
||||
inline fun EntitiesBuilder.phone(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.phone(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.phone(number: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.phone(number))
|
||||
|
||||
inline fun EntitiesBuilder.pre(code: String, language: String?) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.pre(code, language))
|
||||
|
||||
inline fun EntitiesBuilder.regular(text: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.regular(text))
|
||||
|
||||
inline fun EntitiesBuilder.strikethrough(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough(parts))
|
||||
|
||||
inline fun EntitiesBuilder.strikethrough(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.strikethrough(text: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough(text))
|
||||
|
||||
inline fun EntitiesBuilder.link(text: String, url: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.link(text, url))
|
||||
|
||||
inline fun EntitiesBuilder.link(url: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.link(url))
|
||||
|
||||
inline fun EntitiesBuilder.underline(parts: List<TextSource>) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.underline(parts))
|
||||
|
||||
inline fun EntitiesBuilder.underline(vararg parts: TextSource) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.underline(*parts))
|
||||
|
||||
inline fun EntitiesBuilder.underline(text: String) =
|
||||
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.underline(text))
|
@ -1 +1 @@
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API","description":"This project just include all subproject of TelegramBotAPI","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
||||
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API","description":"This project just include all subproject of TelegramBotAPI","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}
|
@ -27,6 +27,7 @@ bintray {
|
||||
}
|
||||
|
||||
publish = true
|
||||
override = true
|
||||
|
||||
pkg {
|
||||
repo = "TelegramBotAPI"
|
||||
|
Loading…
Reference in New Issue
Block a user