mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-21 15:53:47 +00:00
upgrades
This commit is contained in:
parent
4085f721be
commit
9a7dd6ec9a
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.deleteMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode?
|
||||
languageCode: IetfLang?
|
||||
) = execute(DeleteMyCommands(scope, languageCode))
|
||||
|
||||
suspend fun TelegramBot.deleteMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String? = null
|
||||
) = deleteMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
||||
) = deleteMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.getMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode? = null
|
||||
languageCode: IetfLang? = null
|
||||
) = execute(GetMyCommands(scope, languageCode))
|
||||
|
||||
suspend fun TelegramBot.getMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String?
|
||||
) = getMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
||||
) = getMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||
|
@ -1,16 +1,13 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.getMyDescription(
|
||||
languageCode: IetfLanguageCode? = null
|
||||
languageCode: IetfLang? = null
|
||||
) = execute(GetMyDescription(languageCode))
|
||||
|
||||
suspend fun TelegramBot.getMyDescription(
|
||||
languageCode: String?
|
||||
) = getMyDescription(languageCode ?.let(::IetfLanguageCode))
|
||||
) = getMyDescription(languageCode ?.let(::IetfLang))
|
||||
|
@ -1,16 +1,13 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.getMyName(
|
||||
languageCode: IetfLanguageCode? = null
|
||||
languageCode: IetfLang? = null
|
||||
) = execute(GetMyName(languageCode))
|
||||
|
||||
suspend fun TelegramBot.getMyName(
|
||||
languageCode: String?
|
||||
) = getMyName(languageCode ?.let(::IetfLanguageCode))
|
||||
) = getMyName(languageCode ?.let(::IetfLang))
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
|
||||
@ -8,9 +8,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.getMyShortDescription(
|
||||
languageCode: IetfLanguageCode? = null
|
||||
languageCode: IetfLang? = null
|
||||
) = execute(GetMyShortDescription(languageCode))
|
||||
|
||||
suspend fun TelegramBot.getMyShortDescription(
|
||||
languageCode: String?
|
||||
) = getMyShortDescription(languageCode ?.let(::IetfLanguageCode))
|
||||
) = getMyShortDescription(languageCode ?.let(::IetfLang))
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
|
||||
import dev.inmo.tgbotapi.types.BotCommand
|
||||
@ -10,20 +10,20 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
commands: List<BotCommand>,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode?
|
||||
languageCode: IetfLang?
|
||||
) = execute(SetMyCommands(commands, scope, languageCode))
|
||||
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
vararg commands: BotCommand,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode?
|
||||
languageCode: IetfLang?
|
||||
) = setMyCommands(commands.toList(), scope, languageCode)
|
||||
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
commands: List<BotCommand>,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String? = null
|
||||
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLanguageCode))
|
||||
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
|
||||
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
vararg commands: BotCommand,
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||
@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.setMyDescription(
|
||||
description: String? = null,
|
||||
languageCode: IetfLanguageCode? = null
|
||||
languageCode: IetfLang? = null
|
||||
) = execute(SetMyDescription(description, languageCode))
|
||||
|
||||
suspend fun TelegramBot.setMyDescription(
|
||||
description: String?,
|
||||
languageCode: String?
|
||||
) = setMyDescription(description, languageCode ?.let(::IetfLanguageCode))
|
||||
) = setMyDescription(description, languageCode ?.let(::IetfLang))
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
||||
@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.setMyName(
|
||||
name: String? = null,
|
||||
languageCode: IetfLanguageCode? = null
|
||||
languageCode: IetfLang? = null
|
||||
) = execute(SetMyName(name, languageCode))
|
||||
|
||||
suspend fun TelegramBot.setMyName(
|
||||
name: String?,
|
||||
languageCode: String?
|
||||
) = setMyName(name, languageCode ?.let(::IetfLanguageCode))
|
||||
) = setMyName(name, languageCode ?.let(::IetfLang))
|
||||
|
@ -1,15 +1,15 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
||||
|
||||
suspend fun TelegramBot.setMyShortDescription(
|
||||
shortDescription: String? = null,
|
||||
languageCode: IetfLanguageCode? = null
|
||||
languageCode: IetfLang? = null
|
||||
) = execute(SetMyShortDescription(shortDescription, languageCode))
|
||||
|
||||
suspend fun TelegramBot.setMyShortDescription(
|
||||
shortDescription: String?,
|
||||
languageCode: String?
|
||||
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLanguageCode))
|
||||
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import dev.inmo.tgbotapi.types.languageCodeField
|
||||
import dev.inmo.tgbotapi.types.scopeField
|
||||
@ -14,8 +15,8 @@ data class DeleteMyCommands(
|
||||
@Serializable(BotCommandScopeSerializer::class)
|
||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : MyCommandsRequest<Boolean> {
|
||||
override fun method(): String = "deleteMyCommands"
|
||||
override val requestSerializer: SerializationStrategy<DeleteMyCommands>
|
||||
@ -28,7 +29,7 @@ data class DeleteMyCommands(
|
||||
languageCode: String?
|
||||
) : this(
|
||||
scope,
|
||||
languageCode ?.let(::IetfLanguageCode)
|
||||
languageCode ?.let(::IetfLang)
|
||||
)
|
||||
|
||||
companion object : MyCommandsRequest<Boolean> by DeleteMyCommands()
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
@ -15,8 +16,8 @@ data class GetMyCommands(
|
||||
@Serializable(BotCommandScopeSerializer::class)
|
||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : MyCommandsRequest<List<BotCommand>> {
|
||||
override fun method(): String = "getMyCommands"
|
||||
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
|
||||
@ -29,7 +30,7 @@ data class GetMyCommands(
|
||||
languageCode: String?
|
||||
) : this(
|
||||
scope,
|
||||
languageCode ?.let(::IetfLanguageCode)
|
||||
languageCode ?.let(::IetfLang)
|
||||
)
|
||||
|
||||
companion object : MyCommandsRequest<List<BotCommand>> by GetMyCommands()
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
@ -12,8 +13,8 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
class GetMyDescription(
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : SimpleRequest<BotDescription>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "getMyDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<BotDescription>
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
@ -12,8 +13,8 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
class GetMyName(
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : SimpleRequest<BotName>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "getMyName"
|
||||
override val resultDeserializer: DeserializationStrategy<BotName>
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
@ -12,8 +13,8 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
class GetMyShortDescription(
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : SimpleRequest<BotShortDescription>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "getMyShortDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<BotShortDescription>
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
@ -15,8 +16,8 @@ class SetMyCommands(
|
||||
@Serializable(BotCommandScopeSerializer::class)
|
||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : MyCommandsRequest<Boolean> {
|
||||
override fun method(): String = "setMyCommands"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
@ -31,7 +32,7 @@ class SetMyCommands(
|
||||
) : this(
|
||||
commands,
|
||||
scope,
|
||||
languageCode ?.let(::IetfLanguageCode)
|
||||
languageCode ?.let(::IetfLang)
|
||||
)
|
||||
|
||||
init {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
@ -14,8 +14,8 @@ class SetMyDescription(
|
||||
@SerialName(descriptionField)
|
||||
val description: String? = null,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "setMyDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
@ -14,8 +14,8 @@ class SetMyName(
|
||||
@SerialName(nameField)
|
||||
val name: String? = null,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "setMyName"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
@ -14,8 +14,8 @@ class SetMyShortDescription(
|
||||
@SerialName(shortDescriptionField)
|
||||
val shortDescription: String? = null,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null
|
||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "setMyShortDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
|
@ -1,9 +1,9 @@
|
||||
package dev.inmo.tgbotapi.types.abstracts
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
|
||||
interface WithOptionalLanguageCode {
|
||||
val ietfLanguageCode: IetfLanguageCode?
|
||||
val ietfLanguageCode: IetfLang?
|
||||
|
||||
val languageCode: String?
|
||||
get() = ietfLanguageCode ?.code
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.chat
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
@ -99,8 +99,8 @@ data class CommonUser(
|
||||
@SerialName(usernameField)
|
||||
override val username: Username? = null,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null,
|
||||
@Serializable(IetfLangSerializer::class)
|
||||
override val ietfLanguageCode: IetfLang? = null,
|
||||
@SerialName(isPremiumField)
|
||||
override val isPremium: Boolean = false,
|
||||
@SerialName(addedToAttachmentMenuField)
|
||||
@ -112,5 +112,5 @@ data class CommonUser(
|
||||
lastName: String = "",
|
||||
username: Username? = null,
|
||||
languageCode: String
|
||||
) : this(id, firstName, lastName, username, IetfLanguageCode(languageCode))
|
||||
) : this(id, firstName, lastName, username, IetfLang(languageCode))
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import java.util.*
|
||||
|
||||
fun IetfLanguageCode?.javaLocale() = this ?.code ?.let { Locale.forLanguageTag(it) }
|
||||
fun IetfLang?.javaLocale() = this ?.code ?.let { Locale.forLanguageTag(it) }
|
||||
fun WithOptionalLanguageCode?.javaLocale() = this ?.ietfLanguageCode ?.javaLocale()
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.webapps
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
@ -42,7 +42,7 @@ fun WebAppUser.asUser() = if (isBot == true) {
|
||||
firstName = firstName,
|
||||
lastName = lastName ?: "",
|
||||
username = username ?.let(::Username),
|
||||
ietfLanguageCode = languageCode ?.let(::IetfLanguageCode),
|
||||
ietfLanguageCode = languageCode ?.let(::IetfLang),
|
||||
isPremium = isPremium
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user