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

voice(_c/C)hat* -> video(_c/C)hat* renames

This commit is contained in:
InsanusMokrassar 2022-04-17 20:03:00 +06:00
parent 12d2c05110
commit 2c71377058
13 changed files with 290 additions and 82 deletions

View File

@ -89,33 +89,66 @@ suspend fun BehaviourContext.waitChatEvents(
mapper: EventMessageToEventMapper<ChatEvent>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
@Deprecated("Renamed as Video instead of Voice")
suspend fun BehaviourContext.waitVoiceChatEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VoiceChatEvent>>? = null,
mapper: EventMessageToEventMapper<VoiceChatEvent>? = null
filter: SimpleFilter<ChatEventMessage<VideoChatEvent>>? = null,
mapper: EventMessageToEventMapper<VideoChatEvent>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
@Deprecated("Renamed as Video instead of Voice")
suspend fun BehaviourContext.waitVoiceChatStartedEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VoiceChatStarted>>? = null,
mapper: EventMessageToEventMapper<VoiceChatStarted>? = null
filter: SimpleFilter<ChatEventMessage<VideoChatStarted>>? = null,
mapper: EventMessageToEventMapper<VideoChatStarted>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
@Deprecated("Renamed as Video instead of Voice")
suspend fun BehaviourContext.waitVoiceChatEndedEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VoiceChatEnded>>? = null,
mapper: EventMessageToEventMapper<VoiceChatEnded>? = null
filter: SimpleFilter<ChatEventMessage<VideoChatEnded>>? = null,
mapper: EventMessageToEventMapper<VideoChatEnded>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
@Deprecated("Renamed as Video instead of Voice")
suspend fun BehaviourContext.waitVoiceChatParticipantsInvitedEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VoiceChatParticipantsInvited>>? = null,
mapper: EventMessageToEventMapper<VoiceChatParticipantsInvited>? = null
filter: SimpleFilter<ChatEventMessage<VideoChatParticipantsInvited>>? = null,
mapper: EventMessageToEventMapper<VideoChatParticipantsInvited>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
suspend fun BehaviourContext.waitVideoChatEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VideoChatEvent>>? = null,
mapper: EventMessageToEventMapper<VideoChatEvent>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
suspend fun BehaviourContext.waitVideoChatStartedEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VideoChatStarted>>? = null,
mapper: EventMessageToEventMapper<VideoChatStarted>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
suspend fun BehaviourContext.waitVideoChatEndedEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VideoChatEnded>>? = null,
mapper: EventMessageToEventMapper<VideoChatEnded>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
suspend fun BehaviourContext.waitVideoChatParticipantsInvitedEvents(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
count: Int = 1,
filter: SimpleFilter<ChatEventMessage<VideoChatParticipantsInvited>>? = null,
mapper: EventMessageToEventMapper<VideoChatParticipantsInvited>? = null
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
suspend fun BehaviourContext.waitMessageAutoDeleteTimerChangedEvents(

View File

@ -94,11 +94,12 @@ suspend fun <BC : BehaviourContext> BC.onChatEvent(
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
@Deprecated("Renamed as Video instead of Voice")
suspend fun <BC : BehaviourContext> BC.onVoiceChatEvent(
initialFilter: SimpleFilter<ChatEventMessage<VoiceChatEvent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VoiceChatEvent>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VoiceChatEvent>>
initialFilter: SimpleFilter<ChatEventMessage<VideoChatEvent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatEvent>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatEvent>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
@ -113,11 +114,12 @@ suspend fun <BC : BehaviourContext> BC.onVoiceChatEvent(
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
@Deprecated("Renamed as Video instead of Voice")
suspend fun <BC : BehaviourContext> BC.onVoiceChatStartedEvent(
initialFilter: SimpleFilter<ChatEventMessage<VoiceChatStarted>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VoiceChatStarted>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatStarted>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VoiceChatStarted>>
initialFilter: SimpleFilter<ChatEventMessage<VideoChatStarted>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatStarted>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatStarted>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatStarted>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
@ -132,11 +134,12 @@ suspend fun <BC : BehaviourContext> BC.onVoiceChatStartedEvent(
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
@Deprecated("Renamed as Video instead of Voice")
suspend fun <BC : BehaviourContext> BC.onVoiceChatEndedEvent(
initialFilter: SimpleFilter<ChatEventMessage<VoiceChatEnded>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VoiceChatEnded>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatEnded>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VoiceChatEnded>>
initialFilter: SimpleFilter<ChatEventMessage<VideoChatEnded>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatEnded>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatEnded>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatEnded>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
@ -151,11 +154,88 @@ suspend fun <BC : BehaviourContext> BC.onVoiceChatEndedEvent(
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
@Deprecated("Renamed as Video instead of Voice")
suspend fun <BC : BehaviourContext> BC.onVoiceChatParticipantsInvitedEvent(
initialFilter: SimpleFilter<ChatEventMessage<VoiceChatParticipantsInvited>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VoiceChatParticipantsInvited>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatParticipantsInvited>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VoiceChatParticipantsInvited>>
initialFilter: SimpleFilter<ChatEventMessage<VideoChatParticipantsInvited>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatParticipantsInvited>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatParticipantsInvited>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatParticipantsInvited>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onVideoChatEvent(
initialFilter: SimpleFilter<ChatEventMessage<VideoChatEvent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatEvent>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatEvent>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onVideoChatStartedEvent(
initialFilter: SimpleFilter<ChatEventMessage<VideoChatStarted>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatStarted>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatStarted>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatStarted>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onVideoChatEndedEvent(
initialFilter: SimpleFilter<ChatEventMessage<VideoChatEnded>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatEnded>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatEnded>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatEnded>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onVideoChatParticipantsInvitedEvent(
initialFilter: SimpleFilter<ChatEventMessage<VideoChatParticipantsInvited>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatParticipantsInvited>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatParticipantsInvited>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatParticipantsInvited>>
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**

View File

@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled
interface VideoChatEvent : PublicChatEvent
@Deprecated("Renamed", ReplaceWith("VideoChatEvent", "dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEvent"))
typealias VoiceChatEvent = VideoChatEvent

View File

@ -1,3 +0,0 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
interface VoiceChatEvent : PublicChatEvent

View File

@ -4,15 +4,18 @@ import com.soywiz.klock.TimeSpan
import com.soywiz.klock.seconds
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.durationField
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class VoiceChatEnded(
data class VideoChatEnded(
@SerialName(durationField)
val duration: Seconds
) : VoiceChatEvent {
) : VideoChatEvent {
val timeSpan: TimeSpan
get() = TimeSpan(duration.seconds.milliseconds)
}
@Deprecated("Renamed", ReplaceWith("VideoChatEnded", "dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEnded"))
typealias VoiceChatEnded = VideoChatEnded

View File

@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
import dev.inmo.tgbotapi.types.User
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent
import dev.inmo.tgbotapi.types.usersField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class VideoChatParticipantsInvited(
@SerialName(usersField)
val users: List<User> = emptyList()
) : VideoChatEvent
@Deprecated("Renamed", ReplaceWith("VideoChatParticipantsInvited", "dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatParticipantsInvited"))
typealias VoiceChatParticipantsInvited = VideoChatParticipantsInvited

View File

@ -1,13 +1,16 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent
import dev.inmo.tgbotapi.types.startDateField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class VoiceChatScheduled(
data class VideoChatScheduled(
@SerialName(startDateField)
val startDate: TelegramDate
) : VoiceChatEvent
) : VideoChatEvent
@Deprecated("Renamed", ReplaceWith("VideoChatScheduled", "dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled"))
typealias VoiceChatScheduled = VideoChatScheduled

View File

@ -0,0 +1,10 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent
import kotlinx.serialization.Serializable
@Serializable
object VideoChatStarted : VideoChatEvent
@Deprecated("Renamed", ReplaceWith("VideoChatStarted", "dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatStarted"))
typealias VoiceChatStarted = VideoChatStarted

View File

@ -1,13 +0,0 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
import dev.inmo.tgbotapi.types.User
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent
import dev.inmo.tgbotapi.types.usersField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class VoiceChatParticipantsInvited(
@SerialName(usersField)
val users: List<User> = emptyList()
) : VoiceChatEvent

View File

@ -1,7 +0,0 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent
import kotlinx.serialization.Serializable
@Serializable
object VoiceChatStarted : VoiceChatEvent

View File

@ -84,10 +84,10 @@ internal data class RawMessage(
private val successful_payment: SuccessfulPayment? = null,
// Voice Chat Service Messages
private val voice_chat_scheduled: VoiceChatScheduled? = null,
private val voice_chat_started: VoiceChatStarted? = null,
private val voice_chat_ended: VoiceChatEnded? = null,
private val voice_chat_participants_invited: VoiceChatParticipantsInvited? = null,
private val video_chat_scheduled: VideoChatScheduled? = null,
private val video_chat_started: VideoChatStarted? = null,
private val video_chat_ended: VideoChatEnded? = null,
private val video_chat_participants_invited: VideoChatParticipantsInvited? = null,
// AutoDelete Message time changed
private val message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged? = null,
@ -186,11 +186,11 @@ internal data class RawMessage(
left_chat_member != null -> LeftChatMember(left_chat_member)
new_chat_title != null -> NewChatTitle(new_chat_title)
new_chat_photo != null -> NewChatPhoto(new_chat_photo.toList())
voice_chat_started != null -> voice_chat_started
voice_chat_scheduled != null -> voice_chat_scheduled
video_chat_started != null -> video_chat_started
video_chat_scheduled != null -> video_chat_scheduled
message_auto_delete_timer_changed != null -> message_auto_delete_timer_changed
voice_chat_ended != null -> voice_chat_ended
voice_chat_participants_invited != null -> voice_chat_participants_invited
video_chat_ended != null -> video_chat_ended
video_chat_participants_invited != null -> video_chat_participants_invited
delete_chat_photo -> DeleteChatPhoto()
group_chat_created -> GroupChatCreated(
migrate_to_chat_id

View File

@ -3191,51 +3191,113 @@ inline fun ChatEvent.asSupergroupEvent(): SupergroupEvent? = this as? Supergroup
inline fun ChatEvent.requireSupergroupEvent(): SupergroupEvent = this as SupergroupEvent
@PreviewFeature
inline fun <T> ChatEvent.whenVoiceChatEvent(block: (VoiceChatEvent) -> T) = asVoiceChatEvent() ?.let(block)
@Deprecated("Renamed as Video instead of Voice")
inline fun <T> ChatEvent.whenVoiceChatEvent(block: (VideoChatEvent) -> T) = asVoiceChatEvent() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVoiceChatEvent(): VoiceChatEvent? = this as? VoiceChatEvent
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.asVoiceChatEvent(): VideoChatEvent? = this as? VideoChatEvent
@PreviewFeature
inline fun ChatEvent.requireVoiceChatEvent(): VoiceChatEvent = this as VoiceChatEvent
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.requireVoiceChatEvent(): VideoChatEvent = this as VideoChatEvent
@PreviewFeature
inline fun <T> ChatEvent.whenVoiceChatEnded(block: (VoiceChatEnded) -> T) = asVoiceChatEnded() ?.let(block)
@Deprecated("Renamed as Video instead of Voice")
inline fun <T> ChatEvent.whenVoiceChatEnded(block: (VideoChatEnded) -> T) = asVoiceChatEnded() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVoiceChatEnded(): VoiceChatEnded? = this as? VoiceChatEnded
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.asVoiceChatEnded(): VideoChatEnded? = this as? VideoChatEnded
@PreviewFeature
inline fun ChatEvent.requireVoiceChatEnded(): VoiceChatEnded = this as VoiceChatEnded
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.requireVoiceChatEnded(): VideoChatEnded = this as VideoChatEnded
@PreviewFeature
inline fun <T> ChatEvent.whenVoiceChatParticipantsInvited(block: (VoiceChatParticipantsInvited) -> T) = asVoiceChatParticipantsInvited() ?.let(block)
@Deprecated("Renamed as Video instead of Voice")
inline fun <T> ChatEvent.whenVoiceChatParticipantsInvited(block: (VideoChatParticipantsInvited) -> T) = asVoiceChatParticipantsInvited() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVoiceChatParticipantsInvited(): VoiceChatParticipantsInvited? =
this as? VoiceChatParticipantsInvited
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.asVoiceChatParticipantsInvited(): VideoChatParticipantsInvited? =
this as? VideoChatParticipantsInvited
@PreviewFeature
inline fun ChatEvent.requireVoiceChatParticipantsInvited(): VoiceChatParticipantsInvited =
this as VoiceChatParticipantsInvited
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.requireVoiceChatParticipantsInvited(): VideoChatParticipantsInvited =
this as VideoChatParticipantsInvited
@PreviewFeature
inline fun <T> ChatEvent.whenVoiceChatStarted(block: (VoiceChatStarted) -> T) = asVoiceChatStarted() ?.let(block)
@Deprecated("Renamed as Video instead of Voice")
inline fun <T> ChatEvent.whenVoiceChatStarted(block: (VideoChatStarted) -> T) = asVoiceChatStarted() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVoiceChatStarted(): VoiceChatStarted? = this as? VoiceChatStarted
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.asVoiceChatStarted(): VideoChatStarted? = this as? VideoChatStarted
@PreviewFeature
inline fun ChatEvent.requireVoiceChatStarted(): VoiceChatStarted = this as VoiceChatStarted
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.requireVoiceChatStarted(): VideoChatStarted = this as VideoChatStarted
@PreviewFeature
inline fun <T> ChatEvent.whenVoiceChatScheduled(block: (VoiceChatScheduled) -> T) = asVoiceChatScheduled() ?.let(block)
@Deprecated("Renamed as Video instead of Voice")
inline fun <T> ChatEvent.whenVoiceChatScheduled(block: (VideoChatScheduled) -> T) = asVoiceChatScheduled() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVoiceChatScheduled(): VoiceChatScheduled? = this as? VoiceChatScheduled
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.asVoiceChatScheduled(): VideoChatScheduled? = this as? VideoChatScheduled
@PreviewFeature
inline fun ChatEvent.requireVoiceChatScheduled(): VoiceChatScheduled = this as VoiceChatScheduled
@Deprecated("Renamed as Video instead of Voice")
inline fun ChatEvent.requireVoiceChatScheduled(): VideoChatScheduled = this as VideoChatScheduled
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatEvent(block: (VideoChatEvent) -> T) = asVideoChatEvent() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVideoChatEvent(): VideoChatEvent? = this as? VideoChatEvent
@PreviewFeature
inline fun ChatEvent.requireVideoChatEvent(): VideoChatEvent = this as VideoChatEvent
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatEnded(block: (VideoChatEnded) -> T) = asVideoChatEnded() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVideoChatEnded(): VideoChatEnded? = this as? VideoChatEnded
@PreviewFeature
inline fun ChatEvent.requireVideoChatEnded(): VideoChatEnded = this as VideoChatEnded
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatParticipantsInvited(block: (VideoChatParticipantsInvited) -> T) = asVideoChatParticipantsInvited() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVideoChatParticipantsInvited(): VideoChatParticipantsInvited? =
this as? VideoChatParticipantsInvited
@PreviewFeature
inline fun ChatEvent.requireVideoChatParticipantsInvited(): VideoChatParticipantsInvited =
this as VideoChatParticipantsInvited
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatStarted(block: (VideoChatStarted) -> T) = asVideoChatStarted() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVideoChatStarted(): VideoChatStarted? = this as? VideoChatStarted
@PreviewFeature
inline fun ChatEvent.requireVideoChatStarted(): VideoChatStarted = this as VideoChatStarted
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatScheduled(block: (VideoChatScheduled) -> T) = asVideoChatScheduled() ?.let(block)
@PreviewFeature
inline fun ChatEvent.asVideoChatScheduled(): VideoChatScheduled? = this as? VideoChatScheduled
@PreviewFeature
inline fun ChatEvent.requireVideoChatScheduled(): VideoChatScheduled = this as VideoChatScheduled
@PreviewFeature
inline fun <T> ChatEvent.whenUserLoggedIn(block: (UserLoggedIn) -> T) = asUserLoggedIn() ?.let(block)

View File

@ -177,17 +177,33 @@ inline val Message.successful_payment: SuccessfulPayment?
get() = asChatEventMessage() ?.chatEvent ?.asSuccessfulPaymentEvent() ?.payment
@RiskFeature(RawFieldsUsageWarning)
inline val Message.voice_chat_scheduled: VoiceChatScheduled?
@Deprecated("Renamed as video instead of voice")
inline val Message.voice_chat_scheduled: VideoChatScheduled?
get() = asChatEventMessage() ?.chatEvent ?.asVoiceChatScheduled()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.voice_chat_started: VoiceChatStarted?
@Deprecated("Renamed as video instead of voice")
inline val Message.voice_chat_started: VideoChatStarted?
get() = asChatEventMessage() ?.chatEvent ?.asVoiceChatStarted()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.voice_chat_ended: VoiceChatEnded?
@Deprecated("Renamed as video instead of voice")
inline val Message.voice_chat_ended: VideoChatEnded?
get() = asChatEventMessage() ?.chatEvent ?.asVoiceChatEnded()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.voice_chat_participants_invited: VoiceChatParticipantsInvited?
@Deprecated("Renamed as video instead of voice")
inline val Message.voice_chat_participants_invited: VideoChatParticipantsInvited?
get() = asChatEventMessage() ?.chatEvent ?.asVoiceChatParticipantsInvited()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.video_chat_scheduled: VideoChatScheduled?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatScheduled()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.video_chat_started: VideoChatStarted?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatStarted()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.video_chat_ended: VideoChatEnded?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatEnded()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.video_chat_participants_invited: VideoChatParticipantsInvited?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatParticipantsInvited()
@RiskFeature(RawFieldsUsageWarning)
inline val Message.message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged?