mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
total rework of chats
This commit is contained in:
parent
c47c82ac43
commit
d6bb14e342
13
CHANGELOG.md
13
CHANGELOG.md
@ -2,16 +2,14 @@
|
|||||||
|
|
||||||
## 0.17.0
|
## 0.17.0
|
||||||
|
|
||||||
|
Libraries updates:
|
||||||
|
|
||||||
* Kotlin version `1.3.31` -> `1.3.41`
|
* Kotlin version `1.3.31` -> `1.3.41`
|
||||||
* Kotlin Coroutines version `1.2.1` -> `1.2.2`
|
* Kotlin Coroutines version `1.2.1` -> `1.2.2`
|
||||||
* Kotlin Serialization version `0.11.0` -> `0.11.1`
|
* Kotlin Serialization version `0.11.0` -> `0.11.1`
|
||||||
* Joda Time version `2.10.1` -> `2.10.3`
|
* Joda Time version `2.10.1` -> `2.10.3`
|
||||||
* Ktor version `1.1.4` -> `1.2.2`
|
* Ktor version `1.1.4` -> `1.2.2`
|
||||||
|
|
||||||
* `RequestsExecutor` now is `Closeable`
|
|
||||||
* `TelegramAPIUrlsKeeper` was added to provide more comfortable work with file urls and other things
|
|
||||||
like this
|
|
||||||
|
|
||||||
Changes according to [July 29, 2019 Telegram Bot API update](https://core.telegram.org/bots/api#july-29-2019):
|
Changes according to [July 29, 2019 Telegram Bot API update](https://core.telegram.org/bots/api#july-29-2019):
|
||||||
|
|
||||||
* `Sticker` and `StickerSet` now have field `isAnimated`
|
* `Sticker` and `StickerSet` now have field `isAnimated`
|
||||||
@ -22,6 +20,13 @@ was replaced into `abstracts` package and available permissions was updated
|
|||||||
* `RestrictChatMember` request now accept `permissions` object instead of separated permissions
|
* `RestrictChatMember` request now accept `permissions` object instead of separated permissions
|
||||||
* All `GroupChat` instances have description
|
* All `GroupChat` instances have description
|
||||||
|
|
||||||
|
Other important changes:
|
||||||
|
|
||||||
|
* Totally reworked chats hierarchy. `Extended` abstractions was added for cases when called `GetChat` request
|
||||||
|
* `RequestsExecutor` now is `Closeable`
|
||||||
|
* `TelegramAPIUrlsKeeper` was added to provide more comfortable work with file urls and other things
|
||||||
|
like this
|
||||||
|
|
||||||
## 0.16.0 Bot API 4.3
|
## 0.16.0 Bot API 4.3
|
||||||
|
|
||||||
* `LoginURL` and `LoginURLInlineKeyboardButton` has been added
|
* `LoginURL` and `LoginURLInlineKeyboardButton` has been added
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.RawChat
|
||||||
|
|
||||||
|
sealed class HandleException (
|
||||||
|
message: String
|
||||||
|
) : IllegalArgumentException(
|
||||||
|
message
|
||||||
|
)
|
||||||
|
|
||||||
|
class IllegalChatRawObjectException(
|
||||||
|
rawChat: RawChat
|
||||||
|
) : HandleException(
|
||||||
|
"One of the fields in raw chat object is incorrect"
|
||||||
|
)
|
@ -11,7 +11,7 @@ data class SetChatStickerSet(
|
|||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(stickerSetNameField)
|
@SerialName(stickerSetNameField)
|
||||||
val stickerSetName: String
|
val stickerSetName: StickerSetName
|
||||||
): ChatRequest, SimpleRequest<Boolean> {
|
): ChatRequest, SimpleRequest<Boolean> {
|
||||||
override fun method(): String = "setChatStickerSet"
|
override fun method(): String = "setChatStickerSet"
|
||||||
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
||||||
|
@ -17,6 +17,7 @@ typealias ShippingOptionIdentifier = String
|
|||||||
typealias StartParameter = String
|
typealias StartParameter = String
|
||||||
typealias InlineMessageIdentifier = String
|
typealias InlineMessageIdentifier = String
|
||||||
typealias PollIdentifier = String
|
typealias PollIdentifier = String
|
||||||
|
typealias StickerSetName = String
|
||||||
|
|
||||||
val callbackQueryAnswerLength = 0 until 200
|
val callbackQueryAnswerLength = 0 until 200
|
||||||
val captionLength = 0 until 1024
|
val captionLength = 0 until 1024
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.UsernameChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
data class PrivateChat(
|
data class ChannelChatImpl(
|
||||||
override val id: ChatId,
|
override val id: ChatId,
|
||||||
override val username: Username? = null,
|
override val title: String,
|
||||||
val firstName: String? = null,
|
override val username: Username? = null
|
||||||
val lastName: String? = null,
|
) : ChannelChat
|
||||||
override val chatPhoto: ChatPhoto? = null
|
|
||||||
) : Chat, UsernameChat
|
|
@ -1,9 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Replaced into another package",
|
|
||||||
ReplaceWith("Chat", "com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat")
|
|
||||||
)
|
|
||||||
typealias Chat = Chat
|
|
@ -1,9 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
|
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Replaced into another package",
|
|
||||||
ReplaceWith("GroupChat", "com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat")
|
|
||||||
)
|
|
||||||
typealias GroupChat = GroupChat
|
|
@ -7,10 +7,5 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
|||||||
|
|
||||||
data class GroupChatImpl(
|
data class GroupChatImpl(
|
||||||
override val id: ChatId,
|
override val id: ChatId,
|
||||||
override val title: String? = null,
|
override val title: String
|
||||||
override val description: String? = null,
|
|
||||||
override val inviteLink: String? = null,
|
|
||||||
override val chatPhoto: ChatPhoto? = null,
|
|
||||||
override val pinnedMessage: RawMessage? = null,
|
|
||||||
override val permissions: ChatPermissions? = null
|
|
||||||
) : GroupChat
|
) : GroupChat
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||||
|
|
||||||
|
data class PrivateChatImpl(
|
||||||
|
override val id: ChatId,
|
||||||
|
override val username: Username? = null,
|
||||||
|
override val firstName: String = "",
|
||||||
|
override val lastName: String = ""
|
||||||
|
) : PrivateChat
|
@ -1,9 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Replaced into another package",
|
|
||||||
ReplaceWith("PublicChat", "com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat")
|
|
||||||
)
|
|
||||||
typealias PublicChat = PublicChat
|
|
@ -1,7 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.IllegalChatRawObjectException
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@ -20,43 +23,75 @@ data class RawChat(
|
|||||||
private val sticker_set_name: String? = null,
|
private val sticker_set_name: String? = null,
|
||||||
private val can_set_sticker_set: Boolean? = null,
|
private val can_set_sticker_set: Boolean? = null,
|
||||||
@SerialName("photo")
|
@SerialName("photo")
|
||||||
override val chatPhoto: ChatPhoto? = null,
|
private val chatPhoto: ChatPhoto? = null,
|
||||||
private val permissions: ChatPermissions? = null
|
private val permissions: ChatPermissions? = null
|
||||||
) : Chat {
|
) : Chat {
|
||||||
fun extractChat(): Chat {
|
private fun extractExtendedChat(): ExtendedChat {
|
||||||
return when (type) {
|
return when (type) {
|
||||||
"private" -> PrivateChat(id, username, first_name, last_name, chatPhoto)
|
"private" -> ExtendedPrivateChatImpl(id, username, first_name ?: "", last_name ?: "", chatPhoto!!)
|
||||||
"group" -> GroupChatImpl(
|
"group" -> ExtendedGroupChatImpl(
|
||||||
id,
|
id,
|
||||||
title,
|
title!!,
|
||||||
description,
|
chatPhoto!!,
|
||||||
|
description ?: "",
|
||||||
invite_link,
|
invite_link,
|
||||||
chatPhoto,
|
permissions!!,
|
||||||
pinned_message,
|
pinned_message
|
||||||
permissions
|
|
||||||
)
|
)
|
||||||
"supergroup" -> SupergroupChat(
|
"supergroup" -> ExtendedSupergroupChatImpl(
|
||||||
id,
|
id,
|
||||||
title,
|
title!!,
|
||||||
username,
|
username,
|
||||||
description,
|
chatPhoto!!,
|
||||||
|
description ?: "",
|
||||||
invite_link,
|
invite_link,
|
||||||
chatPhoto,
|
permissions!!,
|
||||||
pinned_message,
|
pinned_message,
|
||||||
sticker_set_name,
|
sticker_set_name,
|
||||||
can_set_sticker_set ?: false,
|
can_set_sticker_set ?: false
|
||||||
permissions
|
|
||||||
)
|
)
|
||||||
"channel" -> ChannelChat(
|
"channel" -> ExtendedChannelChatImpl(
|
||||||
id,
|
id,
|
||||||
title,
|
title!!,
|
||||||
username,
|
username,
|
||||||
description,
|
chatPhoto!!,
|
||||||
|
description ?: "",
|
||||||
invite_link,
|
invite_link,
|
||||||
chatPhoto,
|
|
||||||
pinned_message
|
pinned_message
|
||||||
)
|
)
|
||||||
else -> throw IllegalArgumentException("Unknown type of chat")
|
else -> throw IllegalArgumentException("Unknown type of chat")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun extractPreviewChat(): Chat {
|
||||||
|
return when (type) {
|
||||||
|
"private" -> PrivateChatImpl(id, username, first_name ?: "", last_name ?: "")
|
||||||
|
"group" -> GroupChatImpl(
|
||||||
|
id,
|
||||||
|
title!!
|
||||||
|
)
|
||||||
|
"supergroup" -> SupergroupChatImpl(
|
||||||
|
id,
|
||||||
|
title!!,
|
||||||
|
username
|
||||||
|
)
|
||||||
|
"channel" -> ChannelChatImpl(
|
||||||
|
id,
|
||||||
|
title!!,
|
||||||
|
username
|
||||||
|
)
|
||||||
|
else -> throw IllegalArgumentException("Unknown type of chat")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun extractChat(): Chat {
|
||||||
|
return try {
|
||||||
|
when (chatPhoto) {
|
||||||
|
null -> extractPreviewChat()
|
||||||
|
else -> extractExtendedChat()
|
||||||
|
}
|
||||||
|
} catch (e: NullPointerException) {
|
||||||
|
throw IllegalChatRawObjectException(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
|
||||||
|
|
||||||
data class SupergroupChat(
|
|
||||||
override val id: ChatId,
|
|
||||||
override val title: String? = null,
|
|
||||||
override val username: Username? = null,
|
|
||||||
override val description: String? = null,
|
|
||||||
override val inviteLink: String? = null,
|
|
||||||
override val chatPhoto: ChatPhoto? = null,
|
|
||||||
override val pinnedMessage: RawMessage? = null,
|
|
||||||
val stickerSetName: String? = null,
|
|
||||||
val canSetStickerSet: Boolean = false,
|
|
||||||
override val permissions: ChatPermissions? = null
|
|
||||||
) : GroupChat, UsernameChat
|
|
@ -2,15 +2,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
data class ChannelChat(
|
data class SupergroupChatImpl(
|
||||||
override val id: ChatId,
|
override val id: ChatId,
|
||||||
override val title: String? = null,
|
override val title: String,
|
||||||
override val username: Username? = null,
|
override val username: Username? = null
|
||||||
override val description: String? = null,
|
) : SupergroupChat
|
||||||
override val inviteLink: String? = null,
|
|
||||||
override val chatPhoto: ChatPhoto? = null,
|
|
||||||
override val pinnedMessage: RawMessage?
|
|
||||||
) : PublicChat, UsernameChat, DescriptionChat
|
|
@ -1,5 +1,3 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
||||||
|
|
||||||
interface DescriptionChat : PublicChat {
|
interface ChannelChat : SuperPublicChat
|
||||||
val description: String?
|
|
||||||
}
|
|
@ -5,5 +5,4 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto
|
|||||||
|
|
||||||
interface Chat {
|
interface Chat {
|
||||||
val id: ChatId
|
val id: ChatId
|
||||||
val chatPhoto: ChatPhoto?
|
|
||||||
}
|
}
|
@ -1,7 +1,3 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
interface GroupChat : PublicChat
|
||||||
|
|
||||||
interface GroupChat : PublicChat, DescriptionChat {
|
|
||||||
val permissions: ChatPermissions?
|
|
||||||
}
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
||||||
|
|
||||||
|
interface PrivateChat : Chat, UsernameChat {
|
||||||
|
val firstName: String
|
||||||
|
val lastName: String
|
||||||
|
}
|
@ -1,9 +1,5 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
|
||||||
|
|
||||||
interface PublicChat : Chat {
|
interface PublicChat : Chat {
|
||||||
val title: String?
|
val title: String
|
||||||
val inviteLink: String?
|
|
||||||
val pinnedMessage: RawMessage?
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
||||||
|
|
||||||
|
interface SuperPublicChat : PublicChat, UsernameChat
|
@ -0,0 +1,3 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
|
||||||
|
|
||||||
|
interface SupergroupChat : GroupChat, SuperPublicChat
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat
|
||||||
|
|
||||||
|
interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
|
||||||
|
interface ExtendedChat : Chat {
|
||||||
|
val chatPhoto: ChatPhoto
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
|
||||||
|
|
||||||
|
interface ExtendedGroupChat : GroupChat, ExtendedPublicChat {
|
||||||
|
val permissions: ChatPermissions
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
||||||
|
|
||||||
|
interface ExtendedPrivateChat : PrivateChat, ExtendedChat
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
|
interface ExtendedPublicChat : ExtendedChat, PublicChat {
|
||||||
|
val description: String
|
||||||
|
val inviteLink: String?
|
||||||
|
val pinnedMessage: RawMessage?
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.StickerSetName
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
|
||||||
|
|
||||||
|
interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat {
|
||||||
|
val stickerSetName: StickerSetName?
|
||||||
|
val canSetStickerSet: Boolean
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChannelChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
|
data class ExtendedChannelChatImpl(
|
||||||
|
override val id: ChatId,
|
||||||
|
override val title: String,
|
||||||
|
override val username: Username?,
|
||||||
|
override val chatPhoto: ChatPhoto,
|
||||||
|
override val description: String,
|
||||||
|
override val inviteLink: String?,
|
||||||
|
override val pinnedMessage: RawMessage?
|
||||||
|
) : ExtendedChannelChat
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedGroupChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
|
data class ExtendedGroupChatImpl(
|
||||||
|
override val id: ChatId,
|
||||||
|
override val title: String,
|
||||||
|
override val chatPhoto: ChatPhoto,
|
||||||
|
override val description: String,
|
||||||
|
override val inviteLink: String?,
|
||||||
|
override val permissions: ChatPermissions,
|
||||||
|
override val pinnedMessage: RawMessage?
|
||||||
|
) : ExtendedGroupChat
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedPrivateChat
|
||||||
|
|
||||||
|
data class ExtendedPrivateChatImpl(
|
||||||
|
override val id: ChatId,
|
||||||
|
override val username: Username? = null,
|
||||||
|
override val firstName: String = "",
|
||||||
|
override val lastName: String = "",
|
||||||
|
override val chatPhoto: ChatPhoto
|
||||||
|
) : ExtendedPrivateChat
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedSupergroupChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
|
data class ExtendedSupergroupChatImpl(
|
||||||
|
override val id: ChatId,
|
||||||
|
override val title: String,
|
||||||
|
override val username: Username? = null,
|
||||||
|
override val chatPhoto: ChatPhoto,
|
||||||
|
override val description: String,
|
||||||
|
override val inviteLink: String?,
|
||||||
|
override val permissions: ChatPermissions,
|
||||||
|
override val pinnedMessage: RawMessage?,
|
||||||
|
override val stickerSetName: StickerSetName?,
|
||||||
|
override val canSetStickerSet: Boolean
|
||||||
|
) : ExtendedSupergroupChat
|
@ -20,7 +20,7 @@ data class Sticker(
|
|||||||
@SerialName(emojiField)
|
@SerialName(emojiField)
|
||||||
val emoji: String? = null,
|
val emoji: String? = null,
|
||||||
@SerialName(stickerSetNameField)
|
@SerialName(stickerSetNameField)
|
||||||
val stickerSetName: String? = null,
|
val stickerSetName: StickerSetName? = null,
|
||||||
@SerialName(isAnimatedField)
|
@SerialName(isAnimatedField)
|
||||||
val isAnimated: Boolean = false,
|
val isAnimated: Boolean = false,
|
||||||
@SerialName(maskPositionField)
|
@SerialName(maskPositionField)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChannelChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChannelChatImpl
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.ChannelEvent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.ChannelEvent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RawMessage
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RawMessageEntitiesSerializer
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RawMessageEntitiesSerializer
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game
|
import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.*
|
||||||
@ -199,18 +199,18 @@ data class RawMessage(
|
|||||||
chatEvent ?.let {
|
chatEvent ?.let {
|
||||||
chatEvent ->
|
chatEvent ->
|
||||||
when (chat) {
|
when (chat) {
|
||||||
is GroupChat -> GroupEventMessage(
|
|
||||||
messageId,
|
|
||||||
chat,
|
|
||||||
chatEvent as? GroupEvent ?: throwWrongChatEvent(GroupChat::class, chatEvent),
|
|
||||||
date.asDate
|
|
||||||
)
|
|
||||||
is SupergroupChat -> SupergroupEventMessage(
|
is SupergroupChat -> SupergroupEventMessage(
|
||||||
messageId,
|
messageId,
|
||||||
chat,
|
chat,
|
||||||
chatEvent as? SupergroupEvent ?: throwWrongChatEvent(SupergroupEvent::class, chatEvent),
|
chatEvent as? SupergroupEvent ?: throwWrongChatEvent(SupergroupEvent::class, chatEvent),
|
||||||
date.asDate
|
date.asDate
|
||||||
)
|
)
|
||||||
|
is GroupChat -> GroupEventMessage(
|
||||||
|
messageId,
|
||||||
|
chat,
|
||||||
|
chatEvent as? GroupEvent ?: throwWrongChatEvent(GroupChat::class, chatEvent),
|
||||||
|
date.asDate
|
||||||
|
)
|
||||||
is ChannelChat -> ChannelEventMessage(
|
is ChannelChat -> ChannelEventMessage(
|
||||||
messageId,
|
messageId,
|
||||||
chat,
|
chat,
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.SupergroupChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.SupergroupChatImpl
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.SupergroupEvent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.SupergroupEvent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
Loading…
Reference in New Issue
Block a user