mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 03:50:24 +00:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f539a24740 | |||
| 1d7b4ea862 | |||
| 2d6f296c20 | |||
| 0ba1aa1127 | |||
| ae8a461e9d | |||
| 99f16e33a6 | |||
| e029b29f7f | |||
| c04f795fdd | |||
| b873898100 | |||
| 61ac9df5e3 | |||
| b1931900e7 | |||
| fab3af48d6 | |||
| 8d7563b6e4 | |||
| 05112afe0c | |||
| 9ea06de27c | |||
| fff05a40d9 | |||
| 5c6428f220 | |||
| 766b7ca205 | |||
| 41e6c52369 | |||
| 06013f624f | |||
| d8bba89f3f | |||
| 141281f96d | |||
| be7aaa7845 | |||
| 78c224ffa8 | |||
| a08d07f7b3 | |||
| 69dde19543 | |||
| e8a3b93831 | |||
| e10caa3171 | |||
| d4fe4e09fc | |||
| ad453afba2 | |||
| a0daca28b1 |
26
CHANGELOG.md
26
CHANGELOG.md
@@ -1,5 +1,31 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 3.2.1
|
||||
|
||||
* `Versions`:
|
||||
* `Ktor`: `2.1.0` -> `2.1.1`
|
||||
* `Korlibs`: `3.0.0` -> `3.1.0`
|
||||
* `MicroUtils`: `0.12.4` -> `0.12.10`
|
||||
|
||||
## 3.2.0
|
||||
|
||||
**Since this update, `RequestsExecutor#execute` may throw only `BotException`. In case you wish to handle some exceptions from `execute` you must catch `BotException` and handle its `cause`**
|
||||
|
||||
* `Versions`:
|
||||
* `Serialization`: `1.4.0-RC` -> `1.4.0`
|
||||
* `MicroUtils`: `0.12.1` -> `0.12.4`
|
||||
* `Core`:
|
||||
* `SetWebhook#allowedUpdates` now is `ALL_UPDATES_LIST` by default instead of `null`
|
||||
* `API`:
|
||||
* Extension `TelegramBot#setWebhook` parameter `allowedUpdates` now is `ALL_UPDATES_LIST` by default instead of `null`
|
||||
* `Utils`:
|
||||
* All related to long polling extensions parameters `allowedUpdates` now are `ALL_UPDATES_LIST` by default instead of `null`
|
||||
|
||||
## 3.1.1
|
||||
|
||||
* `Common`:
|
||||
* Complete Bot API 6.2 implementation
|
||||
|
||||
## 3.1.0
|
||||
|
||||
**This update contains including of Bot API 6.2**
|
||||
|
||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=3.1.0
|
||||
library_version=3.2.1
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
[versions]
|
||||
|
||||
kotlin = "1.7.10"
|
||||
kotlin-serialization = "1.4.0-RC"
|
||||
kotlin-serialization = "1.4.0"
|
||||
kotlin-coroutines = "1.6.4"
|
||||
|
||||
javax-activation = "1.1.1"
|
||||
|
||||
korlibs = "3.0.0"
|
||||
korlibs = "3.1.0"
|
||||
uuid = "0.5.0"
|
||||
ktor = "2.1.0"
|
||||
ktor = "2.1.1"
|
||||
|
||||
ksp = "1.7.10-1.0.6"
|
||||
kotlin-poet = "1.12.0"
|
||||
|
||||
microutils = "0.12.1"
|
||||
microutils = "0.12.10"
|
||||
|
||||
github-release-plugin = "2.4.1"
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.webhook.SetWebhook
|
||||
import dev.inmo.tgbotapi.types.ALL_UPDATES_LIST
|
||||
|
||||
/**
|
||||
* Use this method to send information about webhook (like [url])
|
||||
@@ -12,7 +13,7 @@ suspend fun TelegramBot.setWebhookInfo(
|
||||
url: String,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = execute(
|
||||
@@ -29,7 +30,7 @@ suspend fun TelegramBot.setWebhookInfo(
|
||||
certificate: FileId,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = execute(
|
||||
@@ -46,7 +47,7 @@ suspend fun TelegramBot.setWebhookInfo(
|
||||
certificate: MultipartFile,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = execute(
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.doWithRegistration
|
||||
import dev.inmo.tgbotapi.extensions.utils.*
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import kotlinx.coroutines.flow.*
|
||||
|
||||
/**
|
||||
* Will filter all the messages and include required commands with [commandRegex].
|
||||
*
|
||||
* * In case you wish to get only the commands at the start of message, use [requireCommandAtStart]
|
||||
* * In case you wish to exclude messages with more than one command, you may use [requireSingleCommand]
|
||||
* * In case you wish to exclude messages with commands params, you may use [requireCommandsWithoutParams]
|
||||
*/
|
||||
suspend fun BehaviourContext.waitCommandMessage(
|
||||
commandRegex: Regex,
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = channelFlow {
|
||||
triggersHolder.handleableCommandsHolder.doWithRegistration(
|
||||
commandRegex
|
||||
) {
|
||||
waitTextMessage(initRequest, errorFactory).filter {
|
||||
it.content.textSources.any { it.botCommandTextSourceOrNull() ?.command ?.matches(commandRegex) == true }
|
||||
}.collect {
|
||||
send(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun BehaviourContext.waitCommandMessage(
|
||||
command: String,
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitCommandMessage(Regex(command), initRequest, errorFactory)
|
||||
|
||||
fun Flow<CommonMessage<TextContent>>.requireCommandAtStart() = filter {
|
||||
it.content.textSources.firstOrNull() is BotCommandTextSource
|
||||
}
|
||||
|
||||
/**
|
||||
* Subsequent [Flow] will retrieve only messages with ONE [BotCommandTextSource]. It does not guarantee that this
|
||||
* [BotCommandTextSource] will be at the start of the message
|
||||
*
|
||||
* @see requireCommandAtStart
|
||||
*/
|
||||
fun Flow<CommonMessage<TextContent>>.requireSingleCommand() = filter {
|
||||
var count = 0
|
||||
|
||||
it.content.textSources.forEach {
|
||||
if (it is BotCommandTextSource) {
|
||||
count++
|
||||
if (count > 1) {
|
||||
return@filter false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
count == 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Subsequent [Flow] will retrieve only messages without [TextContent.textSources] which are not [BotCommandTextSource]
|
||||
*/
|
||||
fun Flow<CommonMessage<TextContent>>.requireCommandsWithoutParams() = filter {
|
||||
it.content.textSources.none { it !is BotCommandTextSource }
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the commands with their arguments and source messages
|
||||
*/
|
||||
fun Flow<CommonMessage<TextContent>>.commandsWithParams(): Flow<Pair<CommonMessage<TextContent>, List<Pair<BotCommandTextSource, Array<TextSource>>>>> = mapNotNull {
|
||||
var currentCommandTextSource: BotCommandTextSource? = null
|
||||
val currentArgs = mutableListOf<TextSource>()
|
||||
val result = mutableListOf<Pair<BotCommandTextSource, Array<TextSource>>>()
|
||||
|
||||
fun addCurrentCommandToResult() {
|
||||
currentCommandTextSource ?.let {
|
||||
result.add(it to currentArgs.toTypedArray())
|
||||
currentArgs.clear()
|
||||
}
|
||||
}
|
||||
|
||||
it.content.textSources.forEach {
|
||||
it.ifBotCommandTextSource {
|
||||
addCurrentCommandToResult()
|
||||
currentCommandTextSource = it
|
||||
return@forEach
|
||||
}
|
||||
currentArgs.add(it)
|
||||
}
|
||||
addCurrentCommandToResult()
|
||||
|
||||
result.toList().takeIf { it.isNotEmpty() } ?.let { result ->
|
||||
it to result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flat [commandsWithParams]. Each [Pair] of [BotCommandTextSource] and its [Array] of arg text sources will
|
||||
* be associated with its source message
|
||||
*/
|
||||
fun Flow<CommonMessage<TextContent>>.flattenCommandsWithParams() = commandsWithParams().flatMapConcat { (message, commandsWithParams) ->
|
||||
commandsWithParams.map {
|
||||
message to it
|
||||
}.asFlow()
|
||||
}
|
||||
|
||||
/**
|
||||
* Use [flattenCommandsWithParams] and filter out the commands which do not [matches] to [commandRegex]
|
||||
*/
|
||||
fun Flow<CommonMessage<TextContent>>.commandParams(commandRegex: Regex) = flattenCommandsWithParams().filter { (_, commandWithParams) ->
|
||||
commandWithParams.first.command.matches(commandRegex)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||
import dev.inmo.tgbotapi.extensions.utils.regularTextSourceOrNull
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.textsources.RegularTextSource
|
||||
import kotlinx.coroutines.flow.*
|
||||
|
||||
suspend fun BehaviourContext.waitDeepLinks(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
): Flow<Pair<CommonMessage<TextContent>, String>> = waitCommandMessage(
|
||||
"start",
|
||||
initRequest,
|
||||
errorFactory
|
||||
)
|
||||
.requireSingleCommand()
|
||||
.requireCommandAtStart()
|
||||
.flattenCommandsWithParams().mapNotNull {
|
||||
it.first to (it.second.second.singleOrNull() ?.regularTextSourceOrNull() ?.source ?.removePrefix(" ") ?: return@mapNotNull null)
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
@file:Suppress("unused")
|
||||
|
||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitDeepLinks
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CommonMessageFilterExcludeMediaGroups
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times
|
||||
import dev.inmo.tgbotapi.extensions.utils.*
|
||||
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.content.TextMessage
|
||||
import dev.inmo.tgbotapi.types.message.textsources.RegularTextSource
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
import io.ktor.http.decodeURLQueryComponent
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.filter
|
||||
|
||||
private val startRegex = Regex("start")
|
||||
suspend fun <BC : BehaviourContext> BC.onDeepLink(
|
||||
initialFilter: SimpleFilter<Pair<TextMessage, String>>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, Pair<TextMessage, String>, Update> = { (message, _), update -> MessageFilterByChat(this, message, update) },
|
||||
markerFactory: MarkerFactory<Pair<TextMessage, String>, Any> = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) },
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, Pair<TextMessage, String>>
|
||||
): Job = on(
|
||||
markerFactory,
|
||||
SimpleFilter<Pair<TextMessage, String>> { (message, _) ->
|
||||
message.content.textSources.size == 2
|
||||
&& message.content.textSources.firstOrNull() ?.asBotCommandTextSource() ?.command == "start"
|
||||
&& message.content.textSources.getOrNull(1) is RegularTextSource
|
||||
} * initialFilter,
|
||||
subcontextUpdatesFilter,
|
||||
scenarioReceiver,
|
||||
) {
|
||||
(it.messageUpdateOrNull()) ?.data ?.commonMessageOrNull() ?.withContentOrNull<TextContent>() ?.let { message ->
|
||||
message to message.content.textSources[1].source.removePrefix(" ").decodeURLQueryComponent()
|
||||
} ?.let(::listOfNotNull)
|
||||
}.also {
|
||||
triggersHolder.handleableCommandsHolder.registerHandleable(startRegex)
|
||||
it.invokeOnCompletion {
|
||||
this@onDeepLink.launchSafelyWithoutExceptions { triggersHolder.handleableCommandsHolder.unregisterHandleable(startRegex) }
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ fun interface SimpleFilter<in T> {
|
||||
suspend operator fun invoke(o: T): Boolean
|
||||
}
|
||||
val TrueSimpleFilter = SimpleFilter<Any?> { true }
|
||||
val FalseSimpleFilter = SimpleFilter<Any?> { false }
|
||||
|
||||
/**
|
||||
* @return [SimpleFilter] which will return true in case when all the items in incoming data passed [this] filter
|
||||
@@ -28,21 +29,29 @@ fun <T> SimpleFilter<T>.listNone() = SimpleFilter<Iterable<T>> {
|
||||
|
||||
/**
|
||||
* Makes an AND (&&) operation between [this] and [other]
|
||||
*
|
||||
* * When both arguments are null, [TrueSimpleFilter] will be returned
|
||||
*/
|
||||
operator fun <T> SimpleFilter<T>?.times(other: SimpleFilter<T>): SimpleFilter<T> = this ?.let {
|
||||
SimpleFilter {
|
||||
this(it) && other(it)
|
||||
}
|
||||
} ?: other
|
||||
infix operator fun <T> SimpleFilter<T>?.times(other: SimpleFilter<T>?): SimpleFilter<T> = this ?.let {
|
||||
other ?.let {
|
||||
SimpleFilter {
|
||||
this(it) && other(it)
|
||||
}
|
||||
} ?: it
|
||||
} ?: other ?: TrueSimpleFilter
|
||||
|
||||
/**
|
||||
* Makes an OR (||) operation between [this] and [other]
|
||||
*
|
||||
* * When both arguments are null, [TrueSimpleFilter] will be returned
|
||||
*/
|
||||
operator fun <T> SimpleFilter<T>?.plus(other: SimpleFilter<T>): SimpleFilter<T> = this ?.let {
|
||||
SimpleFilter {
|
||||
this(it) || other(it)
|
||||
}
|
||||
} ?: other
|
||||
infix operator fun <T> SimpleFilter<T>?.plus(other: SimpleFilter<T>?): SimpleFilter<T> = this ?.let {
|
||||
other ?.let {
|
||||
SimpleFilter {
|
||||
this(it) || other(it)
|
||||
}
|
||||
} ?: it
|
||||
} ?: other ?: TrueSimpleFilter
|
||||
|
||||
/**
|
||||
* Reverse results of [this]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
|
||||
@@ -7,6 +8,7 @@ open class HandleableTriggersHolder<T>(
|
||||
preset: List<T> = emptyList()
|
||||
) {
|
||||
protected val commandsMutex = Mutex()
|
||||
protected val handleableCounts = mutableMapOf<T, Int>()
|
||||
protected val _handleable = mutableListOf<T>().also {
|
||||
it.addAll(preset)
|
||||
}
|
||||
@@ -16,12 +18,31 @@ open class HandleableTriggersHolder<T>(
|
||||
suspend fun registerHandleable(data: T) {
|
||||
commandsMutex.withLock {
|
||||
_handleable.add(data)
|
||||
handleableCounts[data] = (handleableCounts[data] ?: 0) + 1
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun unregisterHandleable(data: T) {
|
||||
commandsMutex.withLock {
|
||||
_handleable.remove(data)
|
||||
val newHandleableCount = (handleableCounts[data] ?: 0) - 1
|
||||
if (newHandleableCount > 0) {
|
||||
handleableCounts[data] = newHandleableCount
|
||||
} else {
|
||||
handleableCounts.remove(data)
|
||||
_handleable.remove(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun <T, R> HandleableTriggersHolder<T>.doWithRegistration(
|
||||
data: T,
|
||||
block: suspend () -> R
|
||||
): R {
|
||||
registerHandleable(data)
|
||||
val result = runCatchingSafely {
|
||||
block()
|
||||
}
|
||||
unregisterHandleable(data)
|
||||
return result.getOrThrow()
|
||||
}
|
||||
|
||||
@@ -35,13 +35,18 @@ fun newRequestException(
|
||||
}
|
||||
} ?: CommonRequestException(response, plainAnswer, message, cause)
|
||||
|
||||
sealed class BotException(message: String = "Something went wrong", cause: Throwable? = null) : IOException(message, cause)
|
||||
|
||||
class CommonBotException(message: String = "Something went wrong", cause: Throwable? = null) : BotException(message, cause)
|
||||
|
||||
sealed class RequestException constructor(
|
||||
val response: Response,
|
||||
val plainAnswer: String,
|
||||
message: String? = null,
|
||||
override val cause: Throwable? = null
|
||||
) : IOException(
|
||||
message ?: "Something went wrong"
|
||||
cause: Throwable? = null
|
||||
) : BotException(
|
||||
message ?: "Something went wrong",
|
||||
cause
|
||||
)
|
||||
|
||||
class CommonRequestException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package dev.inmo.tgbotapi.bot.ktor
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||
import dev.inmo.micro_utils.coroutines.safely
|
||||
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
||||
import dev.inmo.tgbotapi.bot.exceptions.*
|
||||
import dev.inmo.tgbotapi.bot.ktor.base.*
|
||||
import dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter
|
||||
import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter
|
||||
@@ -48,12 +49,36 @@ class KtorRequestsExecutor(
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> execute(request: Request<T>): T {
|
||||
return runCatching {
|
||||
safely(
|
||||
{ e ->
|
||||
pipelineStepsHolder.onRequestException(request, e) ?.let { return@safely it }
|
||||
return runCatchingSafely {
|
||||
pipelineStepsHolder.onBeforeSearchCallFactory(request, callsFactories)
|
||||
requestsLimiter.limit {
|
||||
var result: T? = null
|
||||
lateinit var factoryHandledRequest: KtorCallFactory
|
||||
for (potentialFactory in callsFactories) {
|
||||
pipelineStepsHolder.onBeforeCallFactoryMakeCall(request, potentialFactory)
|
||||
result = potentialFactory.makeCall(
|
||||
client,
|
||||
telegramAPIUrlsKeeper,
|
||||
request,
|
||||
jsonFormatter
|
||||
)
|
||||
result = pipelineStepsHolder.onAfterCallFactoryMakeCall(result, request, potentialFactory)
|
||||
if (result != null) {
|
||||
factoryHandledRequest = potentialFactory
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
throw if (e is ClientRequestException) {
|
||||
result ?.let {
|
||||
pipelineStepsHolder.onRequestResultPresented(it, request, factoryHandledRequest, callsFactories)
|
||||
} ?: pipelineStepsHolder.onRequestResultAbsent(request, callsFactories) ?: error("Can't execute request: $request")
|
||||
}
|
||||
}.let {
|
||||
val result = it.exceptionOrNull() ?.let { e ->
|
||||
pipelineStepsHolder.onRequestException(request, e) ?.let { return@let it }
|
||||
|
||||
if (e is ClientRequestException) {
|
||||
val exceptionResult = runCatchingSafely {
|
||||
val content = e.response.bodyAsText()
|
||||
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
|
||||
newRequestException(
|
||||
@@ -61,38 +86,15 @@ class KtorRequestsExecutor(
|
||||
content,
|
||||
"Can't get result object from $content"
|
||||
)
|
||||
} else {
|
||||
e
|
||||
}
|
||||
|
||||
exceptionResult.exceptionOrNull() ?.let {
|
||||
CommonBotException(cause = e)
|
||||
} ?: exceptionResult.getOrThrow()
|
||||
} else {
|
||||
CommonBotException(cause = e)
|
||||
}
|
||||
) {
|
||||
pipelineStepsHolder.onBeforeSearchCallFactory(request, callsFactories)
|
||||
requestsLimiter.limit {
|
||||
var result: T? = null
|
||||
lateinit var factoryHandledRequest: KtorCallFactory
|
||||
for (potentialFactory in callsFactories) {
|
||||
pipelineStepsHolder.onBeforeCallFactoryMakeCall(request, potentialFactory)
|
||||
result = potentialFactory.makeCall(
|
||||
client,
|
||||
telegramAPIUrlsKeeper,
|
||||
request,
|
||||
jsonFormatter
|
||||
)
|
||||
result = pipelineStepsHolder.onAfterCallFactoryMakeCall(result, request, potentialFactory)
|
||||
if (result != null) {
|
||||
factoryHandledRequest = potentialFactory
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
result ?.let {
|
||||
pipelineStepsHolder.onRequestResultPresented(it, request, factoryHandledRequest, callsFactories)
|
||||
} ?: pipelineStepsHolder.onRequestResultAbsent(request, callsFactories) ?: error("Can't execute request: $request")
|
||||
}
|
||||
}
|
||||
}.let {
|
||||
pipelineStepsHolder.onRequestReturnResult(it, request, callsFactories)
|
||||
} ?.let { Result.failure(it) } ?: it
|
||||
pipelineStepsHolder.onRequestReturnResult(result, request, callsFactories)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class MultipartSetWebhookRequest(
|
||||
certificate: MultipartFile,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) : SetWebhookRequest(), MultipartRequest<Boolean> by MultipartRequestImpl(
|
||||
@@ -40,7 +40,7 @@ fun SetWebhook(
|
||||
certificate: MultipartFile,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
): MultipartSetWebhookRequest = MultipartSetWebhookRequest(
|
||||
@@ -58,7 +58,7 @@ fun SetWebhook(
|
||||
certificate: FileId,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
): SetWebhook = SetWebhook(
|
||||
@@ -84,7 +84,7 @@ fun SetWebhook(
|
||||
certificate: InputFile,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = when (certificate) {
|
||||
@@ -104,7 +104,7 @@ fun SetWebhook(
|
||||
url: String,
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = SetWebhook(
|
||||
@@ -135,7 +135,7 @@ data class SetWebhook internal constructor(
|
||||
@SerialName(maxAllowedConnectionsField)
|
||||
val maxAllowedConnections: Int? = null,
|
||||
@SerialName(allowedUpdatesField)
|
||||
val allowedUpdates: List<String>? = null,
|
||||
val allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
@SerialName(dropPendingUpdatesField)
|
||||
val dropPendingUpdates: Boolean? = null,
|
||||
@SerialName(secretTokenField)
|
||||
|
||||
@@ -81,6 +81,8 @@ sealed interface StickerType {
|
||||
}
|
||||
}
|
||||
|
||||
val usernameRegex = Regex("@[\\w\\d_]+")
|
||||
|
||||
val degreesLimit = 1 .. 360
|
||||
val horizontalAccuracyLimit = 0F .. 1500F
|
||||
|
||||
@@ -164,6 +166,7 @@ const val languageCodeField = "language_code"
|
||||
const val addedToAttachmentMenuField = "added_to_attachment_menu"
|
||||
const val isPremiumField = "is_premium"
|
||||
const val hasPrivateForwardsField = "has_private_forwards"
|
||||
const val hasRestrictedVoiceAndVideoMessagesField = "has_restricted_voice_and_video_messages"
|
||||
const val canJoinGroupsField = "can_join_groups"
|
||||
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
||||
const val supportInlineQueriesField = "supports_inline_queries"
|
||||
|
||||
@@ -62,7 +62,9 @@ data class ExtendedPrivateChatImpl(
|
||||
@SerialName(bioField)
|
||||
override val bio: String = "",
|
||||
@SerialName(hasPrivateForwardsField)
|
||||
override val hasPrivateForwards: Boolean = false
|
||||
override val hasPrivateForwards: Boolean = false,
|
||||
@SerialName(hasRestrictedVoiceAndVideoMessagesField)
|
||||
override val hasRestrictedVoiceAndVideoMessages: Boolean = false
|
||||
) : ExtendedPrivateChat
|
||||
|
||||
typealias ExtendedUser = ExtendedPrivateChatImpl
|
||||
|
||||
@@ -19,6 +19,7 @@ sealed interface ExtendedGroupChat : GroupChat, ExtendedPublicChat {
|
||||
sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChat {
|
||||
val bio: String
|
||||
val hasPrivateForwards: Boolean
|
||||
val hasRestrictedVoiceAndVideoMessages: Boolean
|
||||
|
||||
val allowCreateUserIdLink: Boolean
|
||||
get() = hasPrivateForwards
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.usernameRegex
|
||||
import dev.inmo.tgbotapi.types.Username
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -16,6 +18,9 @@ data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstru
|
||||
val command: String by lazy {
|
||||
commandRegex.find(source) ?.value ?.substring(1) ?: source.substring(1)// skip first symbol like "/" or "!"
|
||||
}
|
||||
val username: Username? by lazy {
|
||||
Username(usernameRegex.find(source) ?.value ?: return@lazy null)
|
||||
}
|
||||
|
||||
override val markdown: String by lazy { source.commandMarkdown() }
|
||||
override val markdownV2: String by lazy { source.commandMarkdownV2() }
|
||||
|
||||
@@ -30,7 +30,7 @@ fun <T> Flow<Iterable<T>>.flatten(): Flow<T> = flow {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T, R> Flow<T>.flatMap(mapper: (T) -> Iterable<R>): Flow<R> = flow {
|
||||
fun <T, R> Flow<T>.flatMap(mapper: suspend (T) -> Iterable<R>): Flow<R> = flow {
|
||||
collect {
|
||||
mapper(it).forEach {
|
||||
emit(it)
|
||||
|
||||
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.textsources.link
|
||||
import io.ktor.http.encodeURLQueryComponent
|
||||
|
||||
|
||||
fun makeUsernameLink(username: String) = "$internalLinkBeginning/$username"
|
||||
@@ -17,11 +18,11 @@ inline val Username.deepLinkPrefix
|
||||
inline val Username.startattachPrefix
|
||||
get() = makeUsernameStartattachPrefix(usernameWithoutAt)
|
||||
inline fun makeLink(username: Username) = username.link
|
||||
inline fun makeTelegramDeepLink(username: String, startParameter: String) = "${makeUsernameDeepLinkPrefix(username)}$startParameter"
|
||||
inline fun makeTelegramDeepLink(username: String, startParameter: String) = "${makeUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent()
|
||||
inline fun makeTelegramStartattach(username: String, data: String? = null) = makeUsernameStartattachLink(username, data)
|
||||
inline fun makeDeepLink(username: Username, startParameter: String) = "${username.deepLinkPrefix}$startParameter"
|
||||
inline fun makeDeepLink(username: Username, startParameter: String) = makeTelegramDeepLink(username.usernameWithoutAt, startParameter)
|
||||
inline fun makeTelegramDeepLink(username: Username, startParameter: String) = makeDeepLink(username, startParameter)
|
||||
inline fun makeTelegramStartattach(username: Username, data: String? = null) = makeTelegramStartattach(username.username, data)
|
||||
inline fun makeTelegramStartattach(username: Username, data: String? = null) = makeTelegramStartattach(username.usernameWithoutAt, data)
|
||||
|
||||
fun makeLinkToMessage(
|
||||
username: String,
|
||||
|
||||
@@ -21,7 +21,7 @@ import kotlinx.coroutines.flow.*
|
||||
fun TelegramBot.longPollingFlow(
|
||||
timeoutSeconds: Seconds = 30,
|
||||
exceptionsHandler: (ExceptionHandler<Unit>)? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
): Flow<Update> = channelFlow {
|
||||
var lastUpdateIdentifier: UpdateIdentifier? = null
|
||||
|
||||
@@ -81,7 +81,7 @@ fun TelegramBot.startGettingOfUpdatesByLongPolling(
|
||||
timeoutSeconds: Seconds = 30,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||
exceptionsHandler: (ExceptionHandler<Unit>)? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
updatesReceiver: UpdateReceiver<Update>
|
||||
): Job = longPollingFlow(timeoutSeconds, exceptionsHandler, allowedUpdates).subscribeSafely(
|
||||
scope,
|
||||
@@ -97,7 +97,7 @@ fun TelegramBot.createAccumulatedUpdatesRetrieverFlow(
|
||||
avoidInlineQueries: Boolean = false,
|
||||
avoidCallbackQueries: Boolean = false,
|
||||
exceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||
allowedUpdates: List<String>? = null
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST
|
||||
): Flow<Update> = longPollingFlow(
|
||||
timeoutSeconds = 0,
|
||||
exceptionsHandler = {
|
||||
@@ -117,7 +117,7 @@ fun TelegramBot.retrieveAccumulatedUpdates(
|
||||
avoidCallbackQueries: Boolean = false,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||
exceptionsHandler: (ExceptionHandler<Unit>)? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
updatesReceiver: UpdateReceiver<Update>
|
||||
): Job = createAccumulatedUpdatesRetrieverFlow(
|
||||
avoidInlineQueries,
|
||||
@@ -149,7 +149,7 @@ suspend fun TelegramBot.flushAccumulatedUpdates(
|
||||
avoidInlineQueries: Boolean = false,
|
||||
avoidCallbackQueries: Boolean = false,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||
allowedUpdates: List<String>? = null,
|
||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||
exceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||
updatesReceiver: UpdateReceiver<Update> = {}
|
||||
) = retrieveAccumulatedUpdates(
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package dev.inmo.tgbotapi.webapps
|
||||
|
||||
typealias AlertCallback = () -> Unit
|
||||
@@ -0,0 +1,3 @@
|
||||
package dev.inmo.tgbotapi.webapps
|
||||
|
||||
typealias ConfirmCallback = (confirmed: Boolean) -> Unit
|
||||
@@ -5,3 +5,4 @@ import dev.inmo.tgbotapi.webapps.invoice.InvoiceClosedInfo
|
||||
typealias EventHandler = WebApp.() -> Unit
|
||||
typealias ViewportChangedEventHandler = WebApp.(ViewportChangedData) -> Unit
|
||||
typealias InvoiceClosedEventHandler = WebApp.(InvoiceClosedInfo) -> Unit
|
||||
typealias PopupClosedEventHandler = WebApp.(String?) -> Unit
|
||||
|
||||
@@ -7,4 +7,5 @@ sealed class EventType(val typeName: String) {
|
||||
object BackButtonClicked : EventType("backButtonClicked")
|
||||
object SettingsButtonClicked : EventType("settingsButtonClicked")
|
||||
object InvoiceClosed : EventType("invoiceClosed")
|
||||
object PopupClosed : EventType("popupClosed")
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.webapps
|
||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||
import dev.inmo.tgbotapi.webapps.haptic.HapticFeedback
|
||||
import dev.inmo.tgbotapi.webapps.invoice.InvoiceClosedInfo
|
||||
import dev.inmo.tgbotapi.webapps.popup.*
|
||||
|
||||
external class WebApp {
|
||||
val version: String
|
||||
@@ -24,6 +25,15 @@ external class WebApp {
|
||||
val viewportHeight: Float
|
||||
val viewportStableHeight: Float
|
||||
|
||||
|
||||
val isClosingConfirmationEnabled: Boolean
|
||||
fun enableClosingConfirmation()
|
||||
fun disableClosingConfirmation()
|
||||
|
||||
fun showPopup(params: PopupParams, callback: ClosePopupCallback? = definedExternally)
|
||||
fun showAlert(message: String, callback: AlertCallback? = definedExternally)
|
||||
fun showConfirm(message: String, callback: ConfirmCallback? = definedExternally)
|
||||
|
||||
@JsName("MainButton")
|
||||
val mainButton: MainButton
|
||||
|
||||
@@ -38,6 +48,8 @@ external class WebApp {
|
||||
internal fun onEventWithViewportChangedData(type: String, callback: (ViewportChangedData) -> Unit)
|
||||
@JsName("onEvent")
|
||||
internal fun onEventWithInvoiceClosedInfo(type: String, callback: (InvoiceClosedInfo) -> Unit)
|
||||
@JsName("onEvent")
|
||||
internal fun onEventWithPopupClosedInfo(type: String, callback: (String?) -> Unit)
|
||||
|
||||
fun offEvent(type: String, callback: () -> Unit)
|
||||
@JsName("offEvent")
|
||||
@@ -100,6 +112,18 @@ fun WebApp.onEvent(type: EventType.InvoiceClosed, eventHandler: InvoiceClosedEve
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The callback which should be used in case you want to turn off events handling
|
||||
*/
|
||||
fun WebApp.onEvent(type: EventType.PopupClosed, eventHandler: PopupClosedEventHandler) = { it: String? ->
|
||||
eventHandler(js("this").unsafeCast<WebApp>(), it)
|
||||
}.also {
|
||||
onEventWithPopupClosedInfo(
|
||||
type.typeName,
|
||||
callback = it
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The callback which should be used in case you want to turn off events handling
|
||||
*/
|
||||
@@ -124,8 +148,55 @@ fun WebApp.onSettingsButtonClicked(eventHandler: EventHandler) = onEvent(EventTy
|
||||
* @return The callback which should be used in case you want to turn off events handling
|
||||
*/
|
||||
fun WebApp.onInvoiceClosed(eventHandler: InvoiceClosedEventHandler) = onEvent(EventType.InvoiceClosed, eventHandler)
|
||||
/**
|
||||
* @return The callback which should be used in case you want to turn off events handling
|
||||
*/
|
||||
fun WebApp.onPopupClosed(eventHandler: PopupClosedEventHandler) = onEvent(EventType.PopupClosed, eventHandler)
|
||||
|
||||
fun WebApp.isInitDataSafe(botToken: String) = TelegramAPIUrlsKeeper(botToken).checkWebAppData(
|
||||
initData,
|
||||
initDataUnsafe.hash
|
||||
)
|
||||
|
||||
fun WebApp.showPopup(
|
||||
message: String,
|
||||
title: String?,
|
||||
buttons: Array<PopupButton>,
|
||||
callback: ClosePopupCallback? = null
|
||||
) = showPopup(
|
||||
PopupParams(
|
||||
message,
|
||||
title,
|
||||
buttons
|
||||
),
|
||||
callback
|
||||
)
|
||||
|
||||
fun WebApp.showPopup(
|
||||
message: String,
|
||||
title: String?,
|
||||
firstButton: PopupButton,
|
||||
vararg otherButtons: PopupButton,
|
||||
callback: ClosePopupCallback? = null
|
||||
) = showPopup(
|
||||
PopupParams(
|
||||
message,
|
||||
title,
|
||||
arrayOf(firstButton, *otherButtons)
|
||||
),
|
||||
callback
|
||||
)
|
||||
|
||||
var WebApp.requireClosingConfirmation
|
||||
get() = isClosingConfirmationEnabled
|
||||
set(value) {
|
||||
if (value) {
|
||||
enableClosingConfirmation()
|
||||
} else {
|
||||
disableClosingConfirmation()
|
||||
}
|
||||
}
|
||||
|
||||
fun WebApp.toggleClosingConfirmation() {
|
||||
requireClosingConfirmation = !requireClosingConfirmation
|
||||
}
|
||||
|
||||
@@ -17,10 +17,14 @@ external interface WebAppUser {
|
||||
val username: String?
|
||||
@JsName(languageCodeField)
|
||||
val languageCode: String?
|
||||
val is_premium: Boolean?
|
||||
@JsName(photoUrlField)
|
||||
val photoUrl: String?
|
||||
}
|
||||
|
||||
val WebAppUser.isPremium
|
||||
get() = is_premium == true
|
||||
|
||||
fun WebAppUser.asUser() = if (isBot == true) {
|
||||
CommonBot(
|
||||
UserId(id),
|
||||
@@ -34,6 +38,7 @@ fun WebAppUser.asUser() = if (isBot == true) {
|
||||
firstName,
|
||||
lastName ?: "",
|
||||
username ?.let(::Username),
|
||||
languageCode ?.let(::IetfLanguageCode)
|
||||
languageCode ?.let(::IetfLanguageCode),
|
||||
isPremium = isPremium
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package dev.inmo.tgbotapi.webapps.popup
|
||||
|
||||
typealias ClosePopupCallback = (id: String) -> Unit
|
||||
@@ -0,0 +1,55 @@
|
||||
package dev.inmo.tgbotapi.webapps.popup
|
||||
|
||||
import kotlin.js.json
|
||||
|
||||
external interface PopupButton {
|
||||
val id: String
|
||||
val type: PopupButtonType
|
||||
val text: String?
|
||||
}
|
||||
|
||||
fun PopupButton(
|
||||
id: String,
|
||||
type: PopupButtonType,
|
||||
text: String? = null
|
||||
) = json(
|
||||
*listOfNotNull(
|
||||
"id" to id,
|
||||
"type" to type.typeName,
|
||||
("text" to text).takeIf { text != null }
|
||||
).toTypedArray()
|
||||
).unsafeCast<PopupButton>()
|
||||
|
||||
value class PopupButtonType(
|
||||
val typeName: String
|
||||
) {
|
||||
companion object {
|
||||
val Default = PopupButtonType("default")
|
||||
val Ok = PopupButtonType("ok")
|
||||
val Close = PopupButtonType("close")
|
||||
val Cancel = PopupButtonType("cancel")
|
||||
val Destructive = PopupButtonType("destructive")
|
||||
}
|
||||
}
|
||||
|
||||
fun DefaultPopupButton(
|
||||
id: String,
|
||||
text: String
|
||||
) = PopupButton(id, PopupButtonType.Default, text)
|
||||
|
||||
fun OkPopupButton(
|
||||
id: String
|
||||
) = PopupButton(id, PopupButtonType.Ok)
|
||||
|
||||
fun ClosePopupButton(
|
||||
id: String
|
||||
) = PopupButton(id, PopupButtonType.Close)
|
||||
|
||||
fun CancelPopupButton(
|
||||
id: String
|
||||
) = PopupButton(id, PopupButtonType.Cancel)
|
||||
|
||||
fun DestructivePopupButton(
|
||||
id: String,
|
||||
text: String
|
||||
) = PopupButton(id, PopupButtonType.Destructive, text)
|
||||
@@ -0,0 +1,48 @@
|
||||
package dev.inmo.tgbotapi.webapps.popup
|
||||
|
||||
import kotlin.js.json
|
||||
|
||||
external interface PopupParams {
|
||||
val message: String
|
||||
val title: String?
|
||||
val buttons: Array<PopupButton>
|
||||
}
|
||||
|
||||
fun PopupParams(
|
||||
message: String,
|
||||
title: String?,
|
||||
buttons: Array<PopupButton>
|
||||
) = json(
|
||||
*listOfNotNull(
|
||||
"message" to message,
|
||||
"buttons" to buttons,
|
||||
("title" to title).takeIf { title != null }
|
||||
).toTypedArray()
|
||||
).unsafeCast<PopupParams>()
|
||||
|
||||
fun PopupParams(
|
||||
message: String,
|
||||
firstButton: PopupButton,
|
||||
vararg otherButtons: PopupButton
|
||||
) = PopupParams(
|
||||
message,
|
||||
null,
|
||||
arrayOf(
|
||||
firstButton,
|
||||
*otherButtons
|
||||
)
|
||||
)
|
||||
|
||||
fun PopupParams(
|
||||
title: String,
|
||||
message: String,
|
||||
firstButton: PopupButton,
|
||||
vararg otherButtons: PopupButton
|
||||
) = PopupParams(
|
||||
message,
|
||||
title,
|
||||
arrayOf(
|
||||
firstButton,
|
||||
*otherButtons
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user