mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
CommonGroupEvent -> PublicChatEvent
This commit is contained in:
parent
e51a4b7702
commit
3919359f79
@ -14,7 +14,7 @@
|
|||||||
* `RowBuilder` and `MatrixBuilder` now are open and available for extending
|
* `RowBuilder` and `MatrixBuilder` now are open and available for extending
|
||||||
* `MatrixBuilder#matrix` will return read-only new list instead of original internal `mutMatrix`
|
* `MatrixBuilder#matrix` will return read-only new list instead of original internal `mutMatrix`
|
||||||
* Introduced new type of events `SuccessfulPaymentEvent` instead of putting of payment inside of message
|
* Introduced new type of events `SuccessfulPaymentEvent` instead of putting of payment inside of message
|
||||||
* New type of events union: `CommonGroupEvent`
|
* New type of events union: `PublicChatEvent`
|
||||||
* `Utils`:
|
* `Utils`:
|
||||||
* Two new dsl:
|
* Two new dsl:
|
||||||
* `inlineKeyboard` for creating `InlineKeyboardMarkup`
|
* `inlineKeyboard` for creating `InlineKeyboardMarkup`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents
|
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonGroupEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||||
|
|
||||||
class DeleteChatPhoto: CommonGroupEvent
|
class DeleteChatPhoto: PublicChatEvent
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents
|
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.User
|
import dev.inmo.tgbotapi.types.User
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonGroupEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||||
|
|
||||||
data class LeftChatMember(
|
data class LeftChatMember(
|
||||||
val user: User
|
val user: User
|
||||||
) : CommonGroupEvent
|
) : PublicChatEvent
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents
|
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.files.Photo
|
import dev.inmo.tgbotapi.types.files.Photo
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonGroupEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||||
|
|
||||||
data class NewChatPhoto(
|
data class NewChatPhoto(
|
||||||
val photo: Photo
|
val photo: Photo
|
||||||
): CommonGroupEvent
|
): PublicChatEvent
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents
|
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonGroupEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||||
|
|
||||||
data class NewChatTitle(
|
data class NewChatTitle(
|
||||||
val title: String
|
val title: String
|
||||||
): CommonGroupEvent
|
): PublicChatEvent
|
||||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.message.ChatEvents
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.Meters
|
import dev.inmo.tgbotapi.types.Meters
|
||||||
import dev.inmo.tgbotapi.types.User
|
import dev.inmo.tgbotapi.types.User
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonGroupEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,4 +14,4 @@ data class ProximityAlertTriggered(
|
|||||||
val traveler: User,
|
val traveler: User,
|
||||||
val watcher: User,
|
val watcher: User,
|
||||||
val distance: Meters
|
val distance: Meters
|
||||||
) : CommonGroupEvent
|
) : PublicChatEvent
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
||||||
|
|
||||||
interface CommonEvent : CommonGroupEvent, PrivateEvent
|
interface CommonEvent : PublicChatEvent, PrivateEvent
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
|
||||||
|
|
||||||
interface CommonGroupEvent : ChannelEvent, GroupEvent, SupergroupEvent
|
|
@ -0,0 +1,3 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
||||||
|
|
||||||
|
interface PublicChatEvent : ChannelEvent, GroupEvent, SupergroupEvent
|
@ -1,3 +1,3 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
||||||
|
|
||||||
interface VoiceChatEvent : CommonGroupEvent
|
interface VoiceChatEvent : PublicChatEvent
|
||||||
|
@ -127,12 +127,12 @@ suspend fun BehaviourContext.waitMessageAutoDeleteTimerChangedEvents(
|
|||||||
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
|
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
|
||||||
|
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitCommonGroupEvents(
|
suspend fun BehaviourContext.waitPublicChatEvents(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
count: Int = 1,
|
count: Int = 1,
|
||||||
filter: SimpleFilter<ChatEventMessage<CommonGroupEvent>>? = null,
|
filter: SimpleFilter<ChatEventMessage<PublicChatEvent>>? = null,
|
||||||
mapper: EventMessageToEventMapper<CommonGroupEvent>? = null
|
mapper: EventMessageToEventMapper<PublicChatEvent>? = null
|
||||||
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
|
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
|
||||||
suspend fun BehaviourContext.waitCommonEvents(
|
suspend fun BehaviourContext.waitCommonEvents(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
|
@ -189,11 +189,11 @@ suspend fun BehaviourContext.onMessageAutoDeleteTimerChangedEvent(
|
|||||||
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
* data
|
* data
|
||||||
*/
|
*/
|
||||||
suspend fun BehaviourContext.onCommonGroupEvent(
|
suspend fun BehaviourContext.onPublicChatEvent(
|
||||||
initialFilter: SimpleFilter<ChatEventMessage<CommonGroupEvent>>? = null,
|
initialFilter: SimpleFilter<ChatEventMessage<PublicChatEvent>>? = null,
|
||||||
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, ChatEventMessage<CommonGroupEvent>, Update>? = MessageFilterByChat,
|
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, ChatEventMessage<PublicChatEvent>, Update>? = MessageFilterByChat,
|
||||||
markerFactory: MarkerFactory<in ChatEventMessage<CommonGroupEvent>, Any> = ByChatMessageMarkerFactory,
|
markerFactory: MarkerFactory<in ChatEventMessage<PublicChatEvent>, Any> = ByChatMessageMarkerFactory,
|
||||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<CommonGroupEvent>>
|
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<PublicChatEvent>>
|
||||||
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3043,13 +3043,22 @@ inline fun ChatEvent.asChannelEvent(): ChannelEvent? = this as? ChannelEvent
|
|||||||
inline fun ChatEvent.requireChannelEvent(): ChannelEvent = this as ChannelEvent
|
inline fun ChatEvent.requireChannelEvent(): ChannelEvent = this as ChannelEvent
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> ChatEvent.whenCommonEvent(block: (CommonGroupEvent) -> T) = asCommonEvent() ?.let(block)
|
inline fun <T> ChatEvent.whenPublicChatEvent(block: (PublicChatEvent) -> T) = asPublicChatEvent() ?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun ChatEvent.asCommonEvent(): CommonGroupEvent? = this as? CommonGroupEvent
|
inline fun ChatEvent.asPublicChatEvent(): PublicChatEvent? = this as? PublicChatEvent
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun ChatEvent.requireCommonEvent(): CommonGroupEvent = this as CommonGroupEvent
|
inline fun ChatEvent.requirePublicChatEvent(): PublicChatEvent = this as PublicChatEvent
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun <T> ChatEvent.whenCommonEvent(block: (CommonEvent) -> T) = asCommonEvent() ?.let(block)
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun ChatEvent.asCommonEvent(): CommonEvent? = this as? CommonEvent
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun ChatEvent.requireCommonEvent(): CommonEvent = this as CommonEvent
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> ChatEvent.whenGroupEvent(block: (GroupEvent) -> T) = asGroupEvent() ?.let(block)
|
inline fun <T> ChatEvent.whenGroupEvent(block: (GroupEvent) -> T) = asGroupEvent() ?.let(block)
|
||||||
|
Loading…
Reference in New Issue
Block a user