1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-16 05:40:32 +00:00

add ChatJoinRequest

This commit is contained in:
2021-11-08 18:21:55 +06:00
parent c969d88bf0
commit c24d536d4c
10 changed files with 146 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class ChatJoinRequest(
@SerialName(chatField)
val chat: PublicChat,
@SerialName(userField)
override val from: User,
@SerialName(dateField)
val date: TelegramDate,
@SerialName(bioField)
val bio: String,
@SerialName(inviteLinkField)
val inviteLink: ChatInviteLink
) : FromUser

View File

@@ -0,0 +1,10 @@
package dev.inmo.tgbotapi.types.update
import dev.inmo.tgbotapi.types.ChatJoinRequest
import dev.inmo.tgbotapi.types.UpdateIdentifier
import dev.inmo.tgbotapi.types.update.abstracts.Update
data class ChatJoinRequestUpdate(
override val updateId: UpdateIdentifier,
override val data: ChatJoinRequest
) : Update

View File

@@ -35,7 +35,8 @@ internal data class RawUpdate constructor(
private val poll: Poll? = null,
private val poll_answer: PollAnswer? = null,
private val my_chat_member: ChatMemberUpdated? = null,
private val chat_member: ChatMemberUpdated? = null
private val chat_member: ChatMemberUpdated? = null,
private val chat_join_request: ChatJoinRequest? = null
) {
private var initedUpdate: Update? = null
/**
@@ -61,6 +62,7 @@ internal data class RawUpdate constructor(
poll_answer != null -> PollAnswerUpdate(updateId, poll_answer)
my_chat_member != null -> MyChatMemberUpdatedUpdate(updateId, my_chat_member)
chat_member != null -> CommonChatMemberUpdatedUpdate(updateId, chat_member)
chat_join_request != null -> ChatJoinRequestUpdate(updateId, chat_join_request)
else -> UnknownUpdate(
updateId,
raw.toString(),

View File

@@ -32,6 +32,7 @@ interface FlowsUpdatesFilter : UpdatesFilter {
val pollAnswersFlow: Flow<PollAnswerUpdate>
val chatMemberUpdatesFlow: Flow<CommonChatMemberUpdatedUpdate>
val myChatMemberUpdatesFlow: Flow<MyChatMemberUpdatedUpdate>
val chatJoinRequestUpdateFlow: Flow<ChatJoinRequestUpdate>
val unknownUpdatesFlow: Flow<UnknownUpdate>
}
@@ -62,6 +63,7 @@ abstract class AbstractFlowsUpdatesFilter : FlowsUpdatesFilter {
override val pollAnswersFlow: Flow<PollAnswerUpdate> by lazy { allUpdatesFlow.filterIsInstance() }
override val chatMemberUpdatesFlow: Flow<CommonChatMemberUpdatedUpdate> by lazy { allUpdatesFlow.filterIsInstance() }
override val myChatMemberUpdatesFlow: Flow<MyChatMemberUpdatedUpdate> by lazy { allUpdatesFlow.filterIsInstance() }
override val chatJoinRequestUpdateFlow: Flow<ChatJoinRequestUpdate> by lazy { allUpdatesFlow.filterIsInstance() }
override val unknownUpdatesFlow: Flow<UnknownUpdate> by lazy { allUpdatesFlow.filterIsInstance() }
}