1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00

all PublicChat implementations may have pinned message, chats abstractions refactoring

This commit is contained in:
InsanusMokrassar 2019-04-16 17:03:35 +08:00
parent 3bb1cb1552
commit 8b67f16da3
23 changed files with 98 additions and 40 deletions

View File

@ -12,6 +12,9 @@
* Most part of requests which are working with identifiers of messages now implement `MessageAction` directly or * Most part of requests which are working with identifiers of messages now implement `MessageAction` directly or
by their parents by their parents
* `StopPoll` implemented * `StopPoll` implemented
* All current `Chat` abstractions are deprecated and rewritten as typealiases. Use `Chat` abstractions from
`com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts` package
* Common Groups now may have pinned message
## 0.12.0 Webhooks ## 0.12.0 Webhooks

View File

@ -1,14 +1,16 @@
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.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
data class ChannelChat( data class ChannelChat(
override val id: ChatId, override val id: ChatId,
override val title: String? = null, override val title: String? = null,
val username: Username? = null, override val username: Username? = null,
val description: String? = null, override val description: String? = null,
override val inviteLink: String? = null, override val inviteLink: String? = null,
override val chatPhoto: ChatPhoto? = null, override val chatPhoto: ChatPhoto? = null,
val pinnedMessage: RawMessage? override val pinnedMessage: RawMessage?
) : PublicChat ) : PublicChat, UsernameChat, DescriptionChat

View File

@ -1,9 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat package com.github.insanusmokrassar.TelegramBotAPI.types.chat
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto
interface Chat { @Deprecated(
val id: ChatId "Replaced into another package",
val chatPhoto: ChatPhoto? ReplaceWith("Chat", "com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat")
} )
typealias Chat = Chat

View File

@ -1,15 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat package com.github.insanusmokrassar.TelegramBotAPI.types.chat
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto
interface GroupChat : PublicChat { @Deprecated(
val allMembersAreAdmins: Boolean "Replaced into another package",
} ReplaceWith("GroupChat", "com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat")
)
data class GroupChatImpl( typealias GroupChat = GroupChat
override val id: ChatId,
override val title: String? = null,
override val allMembersAreAdmins: Boolean,
override val inviteLink: String? = null,
override val chatPhoto: ChatPhoto? = null) : GroupChat

View File

@ -0,0 +1,15 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
data class GroupChatImpl(
override val id: ChatId,
override val title: String? = null,
override val allMembersAreAdmins: Boolean,
override val inviteLink: String? = null,
override val chatPhoto: ChatPhoto? = null,
override val pinnedMessage: RawMessage? = null
) : GroupChat

View File

@ -1,11 +1,13 @@
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.UsernameChat
data class PrivateChat( data class PrivateChat(
override val id: ChatId, override val id: ChatId,
val username: Username? = null, override val username: Username? = null,
val firstName: String? = null, val firstName: String? = null,
val lastName: String? = null, val lastName: String? = null,
override val chatPhoto: ChatPhoto? = null override val chatPhoto: ChatPhoto? = null
) : Chat ) : Chat, UsernameChat

View File

@ -1,6 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat package com.github.insanusmokrassar.TelegramBotAPI.types.chat
interface PublicChat : Chat { import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
val title: String?
val inviteLink: String? @Deprecated(
} "Replaced into another package",
ReplaceWith("PublicChat", "com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat")
)
typealias PublicChat = PublicChat

View File

@ -1,6 +1,7 @@
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.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

View File

@ -1,17 +1,19 @@
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.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
data class SupergroupChat( data class SupergroupChat(
override val id: ChatId, override val id: ChatId,
override val title: String? = null, override val title: String? = null,
val username: Username? = null, override val username: Username? = null,
val description: String? = null, override val description: String? = null,
override val allMembersAreAdmins: Boolean, override val allMembersAreAdmins: Boolean,
override val inviteLink: String? = null, override val inviteLink: String? = null,
override val chatPhoto: ChatPhoto? = null, override val chatPhoto: ChatPhoto? = null,
val pinnedMessage: RawMessage? = null, override val pinnedMessage: RawMessage? = null,
val stickerSetName: String? = null, val stickerSetName: String? = null,
val canSetStickerSet: Boolean val canSetStickerSet: Boolean
) : GroupChat ) : GroupChat, UsernameChat, DescriptionChat

View File

@ -0,0 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto
interface Chat {
val id: ChatId
val chatPhoto: ChatPhoto?
}

View File

@ -0,0 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
interface DescriptionChat : PublicChat {
val description: String?
}

View File

@ -0,0 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
interface GroupChat : PublicChat {
val allMembersAreAdmins: Boolean
}

View File

@ -0,0 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
interface PublicChat : Chat {
val title: String?
val inviteLink: String?
val pinnedMessage: RawMessage?
}

View File

@ -0,0 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.Username
interface UsernameChat : Chat {
val username: Username?
}

View File

@ -2,7 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message
import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent

View File

@ -2,7 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message
import com.github.insanusmokrassar.TelegramBotAPI.types.AuthorSignature import com.github.insanusmokrassar.TelegramBotAPI.types.AuthorSignature
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.CommonMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.CommonMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.message package com.github.insanusmokrassar.TelegramBotAPI.types.message
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
import org.joda.time.DateTime import org.joda.time.DateTime

View File

@ -2,7 +2,7 @@ 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.User import com.github.insanusmokrassar.TelegramBotAPI.types.User
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.message package com.github.insanusmokrassar.TelegramBotAPI.types.message
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
sealed class ForwardedMessage { sealed class ForwardedMessage {
abstract val messageId: MessageIdentifier abstract val messageId: MessageIdentifier

View File

@ -1,7 +1,7 @@
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.GroupChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.GroupEvent import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.GroupEvent
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

View File

@ -4,6 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RawMessageEntities import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RawMessageEntities
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RawMessageEntitiesSerializer import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RawMessageEntitiesSerializer
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.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.*

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts package com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import org.joda.time.DateTime import org.joda.time.DateTime
interface Message { interface Message {

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.utils package com.github.insanusmokrassar.TelegramBotAPI.utils
import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardedMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardedMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate