mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-28 03:27:13 +00:00
rename ScheduledGiveaway -> Giveaway
This commit is contained in:
parent
a4064a15ec
commit
294f80032c
@ -139,10 +139,10 @@ suspend fun BehaviourContext.waitMediaContent(
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContent(initRequest, errorFactory).mapContent<MediaContent>()
|
||||
|
||||
suspend fun BehaviourContext.waitScheduledGiveawayContent(
|
||||
suspend fun BehaviourContext.waitGiveawayContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContent(initRequest, errorFactory).mapContent<ScheduledGiveawayContent>()
|
||||
) = waitContent(initRequest, errorFactory).mapContent<GiveawayContent>()
|
||||
|
||||
suspend fun BehaviourContext.waitGiveawayPublicResultsContent(
|
||||
initRequest: Request<*>? = null,
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||
import dev.inmo.tgbotapi.extensions.utils.withContent
|
||||
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||
@ -13,7 +11,6 @@ import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.mapNotNull
|
||||
|
||||
typealias CommonMessageToCommonMessageMapper<T> = suspend CommonMessage<T>.() -> CommonMessage<T>?
|
||||
@ -153,10 +150,10 @@ suspend fun BehaviourContext.waitMediaContentMessage(
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage(initRequest, errorFactory).mapWithContent<MediaContent>()
|
||||
|
||||
suspend fun BehaviourContext.waitScheduledGiveawayContentMessage(
|
||||
suspend fun BehaviourContext.waitGiveawayContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage(initRequest, errorFactory).mapWithContent<ScheduledGiveawayContent>()
|
||||
) = waitContentMessage(initRequest, errorFactory).mapWithContent<GiveawayContent>()
|
||||
|
||||
suspend fun BehaviourContext.waitGiveawayPublicResultsContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
|
@ -131,10 +131,10 @@ suspend fun BehaviourContext.waitEditedInvoice(
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitEditedScheduledGiveawayContent(
|
||||
suspend fun BehaviourContext.waitEditedGiveawayContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<ScheduledGiveawayContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<GiveawayContent>(initRequest, false, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContent(
|
||||
initRequest: Request<*>? = null,
|
||||
|
@ -3,7 +3,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||
import dev.inmo.tgbotapi.extensions.utils.baseEditMessageUpdateOrNull
|
||||
import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
|
||||
import dev.inmo.tgbotapi.extensions.utils.withContent
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
@ -137,10 +136,10 @@ suspend fun BehaviourContext.waitEditedInvoiceMessage(
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContentMessage<InvoiceContent>(initRequest, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitEditedScheduledGiveawayContentMessage(
|
||||
suspend fun BehaviourContext.waitEditedGiveawayContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContentMessage<ScheduledGiveawayContent>(initRequest, errorFactory)
|
||||
) = waitEditedContentMessage<GiveawayContent>(initRequest, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
|
@ -716,8 +716,8 @@ suspend fun <BC : BehaviourContext> BC.onMediaContent(
|
||||
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||
* data
|
||||
*/
|
||||
suspend fun <BC : BehaviourContext> BC.onScheduledGiveawayContent(
|
||||
initialFilter: CommonMessageFilter<ScheduledGiveawayContent>? = null,
|
||||
suspend fun <BC : BehaviourContext> BC.onGiveawayContent(
|
||||
initialFilter: CommonMessageFilter<GiveawayContent>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ScheduledGiveawayContentMessage, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ScheduledGiveawayContentMessage, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ScheduledGiveawayContentMessage>
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.dice.Dice
|
||||
import dev.inmo.tgbotapi.types.files.*
|
||||
import dev.inmo.tgbotapi.types.games.RawGame
|
||||
import dev.inmo.tgbotapi.types.giveaway.GiveawayPublicResults
|
||||
import dev.inmo.tgbotapi.types.giveaway.ScheduledGiveaway
|
||||
import dev.inmo.tgbotapi.types.giveaway.Giveaway
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.message.MessageOrigin
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
@ -96,7 +96,7 @@ sealed interface ReplyInfo {
|
||||
private val poll: Poll? = null,
|
||||
private val invoice: Invoice? = null,
|
||||
private val dice: Dice? = null,
|
||||
private val giveaway: ScheduledGiveaway? = null,
|
||||
private val giveaway: Giveaway? = null,
|
||||
private val giveaway_winners: GiveawayPublicResults? = null,
|
||||
) {
|
||||
val asExternalReplyInfo: External
|
||||
|
@ -1,19 +1,13 @@
|
||||
package dev.inmo.tgbotapi.types.giveaway
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||
import dev.inmo.tgbotapi.types.giveaway.GiveawayInfo
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChatEvent
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ScheduledGiveaway(
|
||||
data class Giveaway(
|
||||
@SerialName(chatsField)
|
||||
val chats: List<PreviewChat>,
|
||||
@SerialName(winnersSelectionDateField)
|
@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.files.*
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.games.RawGame
|
||||
import dev.inmo.tgbotapi.types.giveaway.*
|
||||
import dev.inmo.tgbotapi.types.message.content.ScheduledGiveawayContent
|
||||
import dev.inmo.tgbotapi.types.message.content.GiveawayContent
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
|
||||
@ -96,7 +96,7 @@ internal data class RawMessage(
|
||||
private val invoice: Invoice? = null,
|
||||
private val dice: Dice? = null,
|
||||
private val successful_payment: SuccessfulPayment? = null,
|
||||
private val giveaway: ScheduledGiveaway? = null,
|
||||
private val giveaway: Giveaway? = null,
|
||||
private val giveaway_winners: GiveawayResults? = null,
|
||||
|
||||
private val users_shared: UsersShared? = null,
|
||||
@ -199,7 +199,7 @@ internal data class RawMessage(
|
||||
venue != null -> VenueContent(venue)
|
||||
poll != null -> PollContent(poll)
|
||||
invoice != null -> InvoiceContent(invoice)
|
||||
giveaway != null -> ScheduledGiveawayContent(chat, messageId, giveaway)
|
||||
giveaway != null -> GiveawayContent(chat, messageId, giveaway)
|
||||
giveaway_winners is GiveawayPublicResults -> GiveawayPublicResultsContent(giveaway_winners)
|
||||
else -> null
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ sealed interface MessageContent: ResendableContent {
|
||||
subclass(InvoiceContent::class)
|
||||
subclass(StoryContent::class)
|
||||
subclass(GiveawayPublicResultsContent::class)
|
||||
subclass(ScheduledGiveawayContent::class)
|
||||
subclass(GiveawayContent::class)
|
||||
|
||||
additionalBuilder()
|
||||
}
|
||||
|
@ -1,23 +1,19 @@
|
||||
package dev.inmo.tgbotapi.types.message.content
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.requests.ForwardMessage
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||
import dev.inmo.tgbotapi.types.giveaway.GiveawayInfo
|
||||
import dev.inmo.tgbotapi.types.giveaway.ScheduledGiveaway
|
||||
import dev.inmo.tgbotapi.types.giveaway.Giveaway
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ScheduledGiveawayContent(
|
||||
data class GiveawayContent(
|
||||
private val chat: Chat,
|
||||
private val messageId: MessageId,
|
||||
val giveaway: ScheduledGiveaway
|
||||
val giveaway: Giveaway
|
||||
) : MessageContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
@ -32,7 +32,7 @@ typealias VisualMediaGroupMessage = CommonMessage<VisualMediaGroupPartContent>
|
||||
typealias VideoMessage = CommonMessage<VideoContent>
|
||||
typealias PhotoMessage = CommonMessage<PhotoContent>
|
||||
typealias AnimationMessage = CommonMessage<AnimationContent>
|
||||
typealias ScheduledGiveawayContentMessage = CommonMessage<ScheduledGiveawayContent>
|
||||
typealias ScheduledGiveawayContentMessage = CommonMessage<GiveawayContent>
|
||||
typealias GiveawayPublicResultsContentMessage = CommonMessage<GiveawayPublicResultsContent>
|
||||
|
||||
|
||||
|
@ -298,6 +298,7 @@ import dev.inmo.tgbotapi.types.message.content.DiceContent
|
||||
import dev.inmo.tgbotapi.types.message.content.DocumentContent
|
||||
import dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupPartContent
|
||||
import dev.inmo.tgbotapi.types.message.content.GameContent
|
||||
import dev.inmo.tgbotapi.types.message.content.GiveawayContent
|
||||
import dev.inmo.tgbotapi.types.message.content.GiveawayPublicResultsContent
|
||||
import dev.inmo.tgbotapi.types.message.content.InvoiceContent
|
||||
import dev.inmo.tgbotapi.types.message.content.LiveLocationContent
|
||||
@ -311,7 +312,6 @@ import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
import dev.inmo.tgbotapi.types.message.content.PhotoContent
|
||||
import dev.inmo.tgbotapi.types.message.content.PollContent
|
||||
import dev.inmo.tgbotapi.types.message.content.ResendableContent
|
||||
import dev.inmo.tgbotapi.types.message.content.ScheduledGiveawayContent
|
||||
import dev.inmo.tgbotapi.types.message.content.SpoilerableMediaContent
|
||||
import dev.inmo.tgbotapi.types.message.content.StaticLocationContent
|
||||
import dev.inmo.tgbotapi.types.message.content.StickerContent
|
||||
@ -3795,6 +3795,15 @@ public inline fun ResendableContent.gameContentOrThrow(): GameContent = this as
|
||||
public inline fun <T> ResendableContent.ifGameContent(block: (GameContent) -> T): T? =
|
||||
gameContentOrNull() ?.let(block)
|
||||
|
||||
public inline fun ResendableContent.giveawayContentOrNull(): GiveawayContent? = this as?
|
||||
dev.inmo.tgbotapi.types.message.content.GiveawayContent
|
||||
|
||||
public inline fun ResendableContent.giveawayContentOrThrow(): GiveawayContent = this as
|
||||
dev.inmo.tgbotapi.types.message.content.GiveawayContent
|
||||
|
||||
public inline fun <T> ResendableContent.ifGiveawayContent(block: (GiveawayContent) -> T): T? =
|
||||
giveawayContentOrNull() ?.let(block)
|
||||
|
||||
public inline fun ResendableContent.giveawayPublicResultsContentOrNull():
|
||||
GiveawayPublicResultsContent? = this as?
|
||||
dev.inmo.tgbotapi.types.message.content.GiveawayPublicResultsContent
|
||||
@ -3874,16 +3883,6 @@ public inline fun ResendableContent.pollContentOrThrow(): PollContent = this as
|
||||
public inline fun <T> ResendableContent.ifPollContent(block: (PollContent) -> T): T? =
|
||||
pollContentOrNull() ?.let(block)
|
||||
|
||||
public inline fun ResendableContent.scheduledGiveawayContentOrNull(): ScheduledGiveawayContent? =
|
||||
this as? dev.inmo.tgbotapi.types.message.content.ScheduledGiveawayContent
|
||||
|
||||
public inline fun ResendableContent.scheduledGiveawayContentOrThrow(): ScheduledGiveawayContent =
|
||||
this as dev.inmo.tgbotapi.types.message.content.ScheduledGiveawayContent
|
||||
|
||||
public inline fun <T>
|
||||
ResendableContent.ifScheduledGiveawayContent(block: (ScheduledGiveawayContent) -> T): T? =
|
||||
scheduledGiveawayContentOrNull() ?.let(block)
|
||||
|
||||
public inline fun ResendableContent.stickerContentOrNull(): StickerContent? = this as?
|
||||
dev.inmo.tgbotapi.types.message.content.StickerContent
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user