Skip to content

Commit

Permalink
Remove deprecated functions
Browse files Browse the repository at this point in the history
They seem to be here by accident, I already removed them for good in
#944.
  • Loading branch information
lukellmann committed Sep 2, 2024
1 parent 274cf12 commit 164203b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 111 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object Jvm {
fun KotlinCommonCompilerOptions.applyKordCompilerOptions() {
allWarningsAsErrors = true
progressiveMode = true
freeCompilerArgs.addAll("-Xexpect-actual-classes", "-Xdont-warn-on-error-suppression")
freeCompilerArgs.add("-Xexpect-actual-classes")
}

internal fun NamedDomainObjectSet<KotlinSourceSet>.applyKordTestOptIns() {
Expand Down
5 changes: 0 additions & 5 deletions rest/api/rest.api
Original file line number Diff line number Diff line change
Expand Up @@ -2253,11 +2253,6 @@ public final class dev/kord/rest/builder/message/create/MessageCreateBuilder$Def
}

public final class dev/kord/rest/builder/message/create/MessageCreateBuilderKt {
public static final synthetic fun actionRow (Ldev/kord/rest/builder/message/create/MessageCreateBuilder;Lkotlin/jvm/functions/Function1;)V
public static final synthetic fun allowedMentions (Ldev/kord/rest/builder/message/create/MessageCreateBuilder;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun allowedMentions$default (Ldev/kord/rest/builder/message/create/MessageCreateBuilder;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public static final synthetic fun embed (Ldev/kord/rest/builder/message/create/MessageCreateBuilder;Lkotlin/jvm/functions/Function1;)V
public static final synthetic fun messageFlags (Ldev/kord/rest/builder/message/create/MessageCreateBuilder;Lkotlin/jvm/functions/Function1;)V
public static final fun poll (Ldev/kord/rest/builder/message/create/MessageCreateBuilder;Lkotlin/jvm/functions/Function1;)V
}

Expand Down
12 changes: 4 additions & 8 deletions rest/api/rest.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -3546,25 +3546,25 @@ final class dev.kord.rest.json.request/ChannelPositionSwapRequest { // dev.kord.
}

final class dev.kord.rest.json.request/CreatablePoll { // dev.kord.rest.json.request/CreatablePoll|null[0]
constructor <init>(dev.kord.common.entity/DiscordPoll.Media, kotlin.collections/List<dev.kord.common.entity/DiscordPoll.Answer>, kotlinx.datetime/Instant, dev.kord.common.entity.optional/Optional<kotlin/Boolean> = ..., dev.kord.common.entity/PollLayoutType) // dev.kord.rest.json.request/CreatablePoll.<init>|<init>(dev.kord.common.entity.DiscordPoll.Media;kotlin.collections.List<dev.kord.common.entity.DiscordPoll.Answer>;kotlinx.datetime.Instant;dev.kord.common.entity.optional.Optional<kotlin.Boolean>;dev.kord.common.entity.PollLayoutType){}[0]
constructor <init>(dev.kord.common.entity/DiscordPoll.Media, kotlin.collections/List<dev.kord.common.entity/DiscordPoll.Answer>, kotlinx.datetime/Instant?, dev.kord.common.entity.optional/Optional<kotlin/Boolean> = ..., dev.kord.common.entity/PollLayoutType) // dev.kord.rest.json.request/CreatablePoll.<init>|<init>(dev.kord.common.entity.DiscordPoll.Media;kotlin.collections.List<dev.kord.common.entity.DiscordPoll.Answer>;kotlinx.datetime.Instant?;dev.kord.common.entity.optional.Optional<kotlin.Boolean>;dev.kord.common.entity.PollLayoutType){}[0]

final val allowMultiselect // dev.kord.rest.json.request/CreatablePoll.allowMultiselect|{}allowMultiselect[0]
final fun <get-allowMultiselect>(): dev.kord.common.entity.optional/Optional<kotlin/Boolean> // dev.kord.rest.json.request/CreatablePoll.allowMultiselect.<get-allowMultiselect>|<get-allowMultiselect>(){}[0]
final val answers // dev.kord.rest.json.request/CreatablePoll.answers|{}answers[0]
final fun <get-answers>(): kotlin.collections/List<dev.kord.common.entity/DiscordPoll.Answer> // dev.kord.rest.json.request/CreatablePoll.answers.<get-answers>|<get-answers>(){}[0]
final val expiry // dev.kord.rest.json.request/CreatablePoll.expiry|{}expiry[0]
final fun <get-expiry>(): kotlinx.datetime/Instant // dev.kord.rest.json.request/CreatablePoll.expiry.<get-expiry>|<get-expiry>(){}[0]
final fun <get-expiry>(): kotlinx.datetime/Instant? // dev.kord.rest.json.request/CreatablePoll.expiry.<get-expiry>|<get-expiry>(){}[0]
final val layoutType // dev.kord.rest.json.request/CreatablePoll.layoutType|{}layoutType[0]
final fun <get-layoutType>(): dev.kord.common.entity/PollLayoutType // dev.kord.rest.json.request/CreatablePoll.layoutType.<get-layoutType>|<get-layoutType>(){}[0]
final val question // dev.kord.rest.json.request/CreatablePoll.question|{}question[0]
final fun <get-question>(): dev.kord.common.entity/DiscordPoll.Media // dev.kord.rest.json.request/CreatablePoll.question.<get-question>|<get-question>(){}[0]

final fun component1(): dev.kord.common.entity/DiscordPoll.Media // dev.kord.rest.json.request/CreatablePoll.component1|component1(){}[0]
final fun component2(): kotlin.collections/List<dev.kord.common.entity/DiscordPoll.Answer> // dev.kord.rest.json.request/CreatablePoll.component2|component2(){}[0]
final fun component3(): kotlinx.datetime/Instant // dev.kord.rest.json.request/CreatablePoll.component3|component3(){}[0]
final fun component3(): kotlinx.datetime/Instant? // dev.kord.rest.json.request/CreatablePoll.component3|component3(){}[0]
final fun component4(): dev.kord.common.entity.optional/Optional<kotlin/Boolean> // dev.kord.rest.json.request/CreatablePoll.component4|component4(){}[0]
final fun component5(): dev.kord.common.entity/PollLayoutType // dev.kord.rest.json.request/CreatablePoll.component5|component5(){}[0]
final fun copy(dev.kord.common.entity/DiscordPoll.Media = ..., kotlin.collections/List<dev.kord.common.entity/DiscordPoll.Answer> = ..., kotlinx.datetime/Instant = ..., dev.kord.common.entity.optional/Optional<kotlin/Boolean> = ..., dev.kord.common.entity/PollLayoutType = ...): dev.kord.rest.json.request/CreatablePoll // dev.kord.rest.json.request/CreatablePoll.copy|copy(dev.kord.common.entity.DiscordPoll.Media;kotlin.collections.List<dev.kord.common.entity.DiscordPoll.Answer>;kotlinx.datetime.Instant;dev.kord.common.entity.optional.Optional<kotlin.Boolean>;dev.kord.common.entity.PollLayoutType){}[0]
final fun copy(dev.kord.common.entity/DiscordPoll.Media = ..., kotlin.collections/List<dev.kord.common.entity/DiscordPoll.Answer> = ..., kotlinx.datetime/Instant? = ..., dev.kord.common.entity.optional/Optional<kotlin/Boolean> = ..., dev.kord.common.entity/PollLayoutType = ...): dev.kord.rest.json.request/CreatablePoll // dev.kord.rest.json.request/CreatablePoll.copy|copy(dev.kord.common.entity.DiscordPoll.Media;kotlin.collections.List<dev.kord.common.entity.DiscordPoll.Answer>;kotlinx.datetime.Instant?;dev.kord.common.entity.optional.Optional<kotlin.Boolean>;dev.kord.common.entity.PollLayoutType){}[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.rest.json.request/CreatablePoll.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.rest.json.request/CreatablePoll.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // dev.kord.rest.json.request/CreatablePoll.toString|toString(){}[0]
Expand Down Expand Up @@ -7996,10 +7996,6 @@ final inline fun (dev.kord.rest.builder.interaction/MultiApplicationCommandBuild
final inline fun (dev.kord.rest.builder.interaction/MultiApplicationCommandBuilder).dev.kord.rest.builder.interaction/user(kotlin/String, kotlin/Function1<dev.kord.rest.builder.interaction/UserCommandCreateBuilder, kotlin/Unit> = ...) // dev.kord.rest.builder.interaction/user|user@dev.kord.rest.builder.interaction.MultiApplicationCommandBuilder(kotlin.String;kotlin.Function1<dev.kord.rest.builder.interaction.UserCommandCreateBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.interaction/RootInputChatBuilder).dev.kord.rest.builder.interaction/group(kotlin/String, kotlin/String, kotlin/Function1<dev.kord.rest.builder.interaction/GroupCommandBuilder, kotlin/Unit> = ...) // dev.kord.rest.builder.interaction/group|[email protected](kotlin.String;kotlin.String;kotlin.Function1<dev.kord.rest.builder.interaction.GroupCommandBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.interaction/RootInputChatBuilder).dev.kord.rest.builder.interaction/subCommand(kotlin/String, kotlin/String, kotlin/Function1<dev.kord.rest.builder.interaction/SubCommandBuilder, kotlin/Unit> = ...) // dev.kord.rest.builder.interaction/subCommand|subCommand@dev.kord.rest.builder.interaction.RootInputChatBuilder(kotlin.String;kotlin.String;kotlin.Function1<dev.kord.rest.builder.interaction.SubCommandBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.message.create/MessageCreateBuilder).dev.kord.rest.builder.message.create/actionRow(kotlin/Function1<dev.kord.rest.builder.component/ActionRowBuilder, kotlin/Unit>) // dev.kord.rest.builder.message.create/actionRow|actionRow@dev.kord.rest.builder.message.create.MessageCreateBuilder(kotlin.Function1<dev.kord.rest.builder.component.ActionRowBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.message.create/MessageCreateBuilder).dev.kord.rest.builder.message.create/allowedMentions(kotlin/Function1<dev.kord.rest.builder.message/AllowedMentionsBuilder, kotlin/Unit> = ...) // dev.kord.rest.builder.message.create/allowedMentions|allowedMentions@dev.kord.rest.builder.message.create.MessageCreateBuilder(kotlin.Function1<dev.kord.rest.builder.message.AllowedMentionsBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.message.create/MessageCreateBuilder).dev.kord.rest.builder.message.create/embed(kotlin/Function1<dev.kord.rest.builder.message/EmbedBuilder, kotlin/Unit>) // dev.kord.rest.builder.message.create/embed|[email protected](kotlin.Function1<dev.kord.rest.builder.message.EmbedBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.message.create/MessageCreateBuilder).dev.kord.rest.builder.message.create/messageFlags(kotlin/Function1<dev.kord.common.entity/MessageFlags.Builder, kotlin/Unit>) // dev.kord.rest.builder.message.create/messageFlags|messageFlags@dev.kord.rest.builder.message.create.MessageCreateBuilder(kotlin.Function1<dev.kord.common.entity.MessageFlags.Builder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.message.create/MessageCreateBuilder).dev.kord.rest.builder.message.create/poll(kotlin/Function1<dev.kord.rest.builder.message/PollBuilder, kotlin/Unit>) // dev.kord.rest.builder.message.create/poll|[email protected](kotlin.Function1<dev.kord.rest.builder.message.PollBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.message.modify/MessageModifyBuilder).dev.kord.rest.builder.message.modify/keepAttachment(dev.kord.common.entity/Snowflake, kotlin/Function1<dev.kord.rest.builder.message/AttachmentBuilder, kotlin/Unit> = ...) // dev.kord.rest.builder.message.modify/keepAttachment|keepAttachment@dev.kord.rest.builder.message.modify.MessageModifyBuilder(dev.kord.common.entity.Snowflake;kotlin.Function1<dev.kord.rest.builder.message.AttachmentBuilder,kotlin.Unit>){}[0]
final inline fun (dev.kord.rest.builder.message/MessageBuilder).dev.kord.rest.builder.message/actionRow(kotlin/Function1<dev.kord.rest.builder.component/ActionRowBuilder, kotlin/Unit>) // dev.kord.rest.builder.message/actionRow|[email protected](kotlin.Function1<dev.kord.rest.builder.component.ActionRowBuilder,kotlin.Unit>){}[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@ package dev.kord.rest.builder.message.create

import dev.kord.common.annotation.KordDsl
import dev.kord.common.annotation.KordUnsafe
import dev.kord.rest.json.request.CreatablePoll
import dev.kord.common.entity.DiscordPoll
import dev.kord.common.entity.MessageFlag
import dev.kord.common.entity.DiscordMessage
import dev.kord.common.entity.MessageFlags
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.OptionalBoolean
import dev.kord.common.entity.optional.delegate.delegate
import dev.kord.rest.NamedFile
import dev.kord.rest.builder.component.ActionRowBuilder
import dev.kord.rest.builder.component.MessageComponentBuilder
import dev.kord.rest.builder.message.AllowedMentionsBuilder
import dev.kord.rest.builder.message.AttachmentBuilder
import dev.kord.rest.builder.message.EmbedBuilder
import dev.kord.rest.builder.message.MessageBuilder
import dev.kord.rest.builder.message.PollBuilder
import dev.kord.rest.builder.message.*
import dev.kord.rest.json.request.CreatablePoll
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import dev.kord.rest.builder.message.actionRow as actionRowExtensionOnNewSupertype
import dev.kord.rest.builder.message.allowedMentions as allowedMentionsExtensionOnNewSupertype
import dev.kord.rest.builder.message.embed as embedExtensionOnNewSupertype
import dev.kord.rest.builder.message.messageFlags as messageFlagsExtensionOnNewSupertype

/**
* The base builder for creating a new message.
Expand Down Expand Up @@ -51,6 +41,21 @@ public sealed interface MessageCreateBuilder : MessageBuilder {
public var suppressNotifications: Boolean?
}

/**
* Set's the [poll][DiscordMessage.poll] of this message.
*
* **Please note that if poll is set, you currently cannot set [MessageBuilder.content],
* [MessageBuilder.attachments], [MessageBuilder.embeds] or [MessageBuilder.components]**
*/
@KordUnsafe
public inline fun MessageCreateBuilder.poll(builder: PollBuilder.() -> Unit) {
contract {
callsInPlace(builder, InvocationKind.EXACTLY_ONCE)
}

poll = PollBuilder().apply(builder).toRequest()
}


// this could have been combined with MessageCreateBuilder into a single sealed class, but it would have broken binary
// compatibility, because MessageCreateBuilder would have changed from interface to class
Expand Down Expand Up @@ -86,87 +91,3 @@ public sealed class AbstractMessageCreateBuilder : MessageCreateBuilder {
@KordUnsafe
final override var poll: CreatablePoll? by ::_poll.delegate()
}


/**
* Adds an embed to the message, configured by the [block]. A message can have up to 10 embeds.
*/
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.LowPriorityInOverloadResolution
@Deprecated(
"Replaced by extension on 'MessageBuilder'. Change import to 'dev.kord.rest.builder.message.embed'.",
ReplaceWith("this.embed(block)", imports = ["dev.kord.rest.builder.message.embed"]),
DeprecationLevel.HIDDEN,
)
public inline fun MessageCreateBuilder.embed(block: EmbedBuilder.() -> Unit) {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
embedExtensionOnNewSupertype(block)
}

/**
* Configures the mentions that should trigger a mention (aka ping). Not calling this function will result in the default behavior
* (ping everything), calling this function but not configuring it before the request is build will result in all
* pings being ignored.
*/
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.LowPriorityInOverloadResolution
@Deprecated(
"Replaced by extension on 'MessageBuilder'. Change import to 'dev.kord.rest.builder.message.allowedMentions'.",
ReplaceWith("this.allowedMentions(block)", imports = ["dev.kord.rest.builder.message.allowedMentions"]),
DeprecationLevel.HIDDEN,
)
public inline fun MessageCreateBuilder.allowedMentions(block: AllowedMentionsBuilder.() -> Unit = {}) {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
allowedMentionsExtensionOnNewSupertype(block)
}

/**
* Adds an Action Row to the message, configured by the [builder]. A message can have up to 5 action rows.
*/
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.LowPriorityInOverloadResolution
@Deprecated(
"Replaced by extension on 'MessageBuilder'. Change import to 'dev.kord.rest.builder.message.actionRow'.",
ReplaceWith("this.actionRow(builder)", imports = ["dev.kord.rest.builder.message.actionRow"]),
DeprecationLevel.HIDDEN,
)
public inline fun MessageCreateBuilder.actionRow(builder: ActionRowBuilder.() -> Unit) {
contract {
callsInPlace(builder, InvocationKind.EXACTLY_ONCE)
}
actionRowExtensionOnNewSupertype(builder)
}

/**
* Sets the [MessageFlags] for the created message.
*
* **Only supports [MessageFlag.SuppressEmbeds] and [MessageFlag.SuppressNotifications]**
*/
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.LowPriorityInOverloadResolution
@Deprecated(
"Replaced by extension on 'MessageBuilder'. Change import to 'dev.kord.rest.builder.message.messageFlags'.",
ReplaceWith("this.messageFlags(builder)", imports = ["dev.kord.rest.builder.message.messageFlags"]),
DeprecationLevel.HIDDEN,
)
public inline fun MessageCreateBuilder.messageFlags(builder: MessageFlags.Builder.() -> Unit) {
contract {
callsInPlace(builder, InvocationKind.EXACTLY_ONCE)
}
messageFlagsExtensionOnNewSupertype(builder)
}

/**
* Set's the [poll][dev.kord.common.entity.DiscordMessage.poll] of this message.
*
* **Please note that if poll is set, you currently cannot set [MessageBuilder.content],
* [MessageBuilder.attachments], [MessageBuilder.embeds] or [MessageBuilder.components]**
*/
@KordUnsafe
public inline fun MessageCreateBuilder.poll(builder: PollBuilder.() -> Unit) {
contract {
callsInPlace(builder, InvocationKind.EXACTLY_ONCE)
}

poll = PollBuilder().apply(builder).toRequest()
}

0 comments on commit 164203b

Please sign in to comment.