This commit is contained in:
2021-02-02 19:15:42 +06:00
commit 3f4dacc129
22 changed files with 789 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package dev.inmo.configurable_inline_telegram_bot.config
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery
import kotlinx.serialization.Serializable
@Serializable
data class Restrictions(
val allowedUsers: List<ChatIdentifier> = emptyList()
) {
fun check(query: InlineQuery): Boolean {
return query.from.id in allowedUsers || query.from.username ?.let { it in allowedUsers } ?: false
}
}