Skip to content

Commit

Permalink
Merge branch 'main' into kotlin-2.1.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/commonMain/kotlin/Kord.kt
  • Loading branch information
lukellmann committed Sep 22, 2024
2 parents 6bbb4bc + 59630f2 commit 4afb307
Show file tree
Hide file tree
Showing 23 changed files with 666 additions and 113 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Documentation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fun AbstractDokkaLeafTask.applyKordDokkaOptions() {

dokkaSourceSets.configureEach {

jdkVersion = 22
jdkVersion = 23

suppressGeneratedFiles = false

Expand Down
12 changes: 12 additions & 0 deletions common/api/common.api
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,10 @@ public abstract class dev/kord/common/entity/AutoModerationActionType {
public final fun toString ()Ljava/lang/String;
}

public final class dev/kord/common/entity/AutoModerationActionType$BlockMemberInteraction : dev/kord/common/entity/AutoModerationActionType {
public static final field INSTANCE Ldev/kord/common/entity/AutoModerationActionType$BlockMemberInteraction;
}

public final class dev/kord/common/entity/AutoModerationActionType$BlockMessage : dev/kord/common/entity/AutoModerationActionType {
public static final field INSTANCE Ldev/kord/common/entity/AutoModerationActionType$BlockMessage;
}
Expand Down Expand Up @@ -1456,6 +1460,10 @@ public final class dev/kord/common/entity/AutoModerationRuleEventType$Companion
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

public final class dev/kord/common/entity/AutoModerationRuleEventType$MemberUpdate : dev/kord/common/entity/AutoModerationRuleEventType {
public static final field INSTANCE Ldev/kord/common/entity/AutoModerationRuleEventType$MemberUpdate;
}

public final class dev/kord/common/entity/AutoModerationRuleEventType$MessageSend : dev/kord/common/entity/AutoModerationRuleEventType {
public static final field INSTANCE Ldev/kord/common/entity/AutoModerationRuleEventType$MessageSend;
}
Expand Down Expand Up @@ -1516,6 +1524,10 @@ public final class dev/kord/common/entity/AutoModerationRuleTriggerType$KeywordP
public static final field INSTANCE Ldev/kord/common/entity/AutoModerationRuleTriggerType$KeywordPreset;
}

public final class dev/kord/common/entity/AutoModerationRuleTriggerType$MemberProfile : dev/kord/common/entity/AutoModerationRuleTriggerType {
public static final field INSTANCE Ldev/kord/common/entity/AutoModerationRuleTriggerType$MemberProfile;
}

public final class dev/kord/common/entity/AutoModerationRuleTriggerType$MentionSpam : dev/kord/common/entity/AutoModerationRuleTriggerType {
public static final field INSTANCE Ldev/kord/common/entity/AutoModerationRuleTriggerType$MentionSpam;
}
Expand Down
6 changes: 6 additions & 0 deletions common/api/common.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -7515,6 +7515,8 @@ sealed class dev.kord.common.entity/AutoModerationActionType { // dev.kord.commo

final class Unknown : dev.kord.common.entity/AutoModerationActionType // dev.kord.common.entity/AutoModerationActionType.Unknown|null[0]

final object BlockMemberInteraction : dev.kord.common.entity/AutoModerationActionType // dev.kord.common.entity/AutoModerationActionType.BlockMemberInteraction|null[0]

final object BlockMessage : dev.kord.common.entity/AutoModerationActionType // dev.kord.common.entity/AutoModerationActionType.BlockMessage|null[0]

final object Companion { // dev.kord.common.entity/AutoModerationActionType.Companion|null[0]
Expand Down Expand Up @@ -7548,6 +7550,8 @@ sealed class dev.kord.common.entity/AutoModerationRuleEventType { // dev.kord.co
final fun serializer(): kotlinx.serialization/KSerializer<dev.kord.common.entity/AutoModerationRuleEventType> // dev.kord.common.entity/AutoModerationRuleEventType.Companion.serializer|serializer(){}[0]
}

final object MemberUpdate : dev.kord.common.entity/AutoModerationRuleEventType // dev.kord.common.entity/AutoModerationRuleEventType.MemberUpdate|null[0]

final object MessageSend : dev.kord.common.entity/AutoModerationRuleEventType // dev.kord.common.entity/AutoModerationRuleEventType.MessageSend|null[0]
}

Expand Down Expand Up @@ -7598,6 +7602,8 @@ sealed class dev.kord.common.entity/AutoModerationRuleTriggerType { // dev.kord.

final object KeywordPreset : dev.kord.common.entity/AutoModerationRuleTriggerType // dev.kord.common.entity/AutoModerationRuleTriggerType.KeywordPreset|null[0]

final object MemberProfile : dev.kord.common.entity/AutoModerationRuleTriggerType // dev.kord.common.entity/AutoModerationRuleTriggerType.MemberProfile|null[0]

final object MentionSpam : dev.kord.common.entity/AutoModerationRuleTriggerType // dev.kord.common.entity/AutoModerationRuleTriggerType.MentionSpam|null[0]

final object Spam : dev.kord.common.entity/AutoModerationRuleTriggerType // dev.kord.common.entity/AutoModerationRuleTriggerType.Spam|null[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public sealed class AutoModerationActionType(
*/
public object Timeout : AutoModerationActionType(3)

/**
* Prevents a member from using text, voice, or other interactions.
*/
public object BlockMemberInteraction : AutoModerationActionType(4)

internal object Serializer : KSerializer<AutoModerationActionType> {
override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("dev.kord.common.entity.AutoModerationActionType",
Expand All @@ -90,6 +95,7 @@ public sealed class AutoModerationActionType(
BlockMessage,
SendAlertMessage,
Timeout,
BlockMemberInteraction,
)
}

Expand All @@ -101,6 +107,7 @@ public sealed class AutoModerationActionType(
1 -> BlockMessage
2 -> SendAlertMessage
3 -> Timeout
4 -> BlockMemberInteraction
else -> Unknown(value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public sealed class AutoModerationRuleEventType(
*/
public object MessageSend : AutoModerationRuleEventType(1)

/**
* When a member edits their profile.
*/
public object MemberUpdate : AutoModerationRuleEventType(2)

internal object Serializer : KSerializer<AutoModerationRuleEventType> {
override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("dev.kord.common.entity.AutoModerationRuleEventType",
Expand All @@ -70,6 +75,7 @@ public sealed class AutoModerationRuleEventType(
public val entries: List<AutoModerationRuleEventType> by lazy(mode = PUBLICATION) {
listOf(
MessageSend,
MemberUpdate,
)
}

Expand All @@ -79,6 +85,7 @@ public sealed class AutoModerationRuleEventType(
*/
public fun from(`value`: Int): AutoModerationRuleEventType = when (value) {
1 -> MessageSend
2 -> MemberUpdate
else -> Unknown(value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public sealed class AutoModerationRuleTriggerType(
*/
public object MentionSpam : AutoModerationRuleTriggerType(5)

/**
* Check if member profile contains words from a user defined list of keywords.
*/
public object MemberProfile : AutoModerationRuleTriggerType(6)

internal object Serializer : KSerializer<AutoModerationRuleTriggerType> {
override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("dev.kord.common.entity.AutoModerationRuleTriggerType",
Expand All @@ -88,6 +93,7 @@ public sealed class AutoModerationRuleTriggerType(
Spam,
KeywordPreset,
MentionSpam,
MemberProfile,
)
}

Expand All @@ -100,6 +106,7 @@ public sealed class AutoModerationRuleTriggerType(
3 -> Spam
4 -> KeywordPreset
5 -> MentionSpam
6 -> MemberProfile
else -> Unknown(value)
}
}
Expand Down
9 changes: 9 additions & 0 deletions common/src/commonMain/kotlin/entity/AutoModeration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
kDoc = "Check if content contains words from internal pre-defined wordsets."
),
Entry("MentionSpam", intValue = 5, kDoc = "Check if content contains more unique mentions than allowed."),
Entry(
"MemberProfile", intValue = 6,
kDoc = "Check if member profile contains words from a user defined list of keywords.",
),
],
)

Expand All @@ -30,6 +34,7 @@
docUrl = "https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types",
entries = [
Entry("MessageSend", intValue = 1, kDoc = "When a member sends or edits a message in the guild."),
Entry("MemberUpdate", intValue = 2, kDoc = "When a member edits their profile."),
],
)

Expand All @@ -52,6 +57,10 @@
"[ModerateMembers][dev.kord.common.entity.Permission.ModerateMembers] permission is required to " +
"use the [Timeout] action type."
),
Entry(
"BlockMemberInteraction", intValue = 4,
kDoc = "Prevents a member from using text, voice, or other interactions.",
),
],
)

Expand Down
8 changes: 4 additions & 4 deletions common/src/commonMain/kotlin/entity/Snowflake.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public class Snowflake : Comparable<Snowflake> {
*
* The comparison is based first on the value of the [timestamp], then on the value of the [workerId], then on the
* value of the [processId] and finally on the value of the [increment]. It is *consistent with equals*, as defined
* by [Comparable](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/Comparable.html).
* by [Comparable](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/lang/Comparable.html).
*/
override fun compareTo(other: Snowflake): Int {
// the layout of Snowflake values from MSB to LSB is timestamp, workerId, processId, increment,
Expand Down Expand Up @@ -175,10 +175,10 @@ public class Snowflake : Comparable<Snowflake> {
* [processId] and [increment] are not taken into account.
*
* Note: this comparator imposes an ordering that is *inconsistent with equals*, as defined by
* [Comparator](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Comparator.html). It
* [Comparator](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/Comparator.html). It
* therefore shouldn't be used to order a
* [SortedSet](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/SortedSet.html) or
* [SortedMap](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/SortedMap.html). This is
* [SortedSet](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/SortedSet.html) or
* [SortedMap](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/SortedMap.html). This is
* because `TimestampComparator` only compares the first 42 bits of the ULong [value] (comparing the timestamp),
* whereas [equals][Snowflake.equals] compares all the bits of the [value]. `TimestampComparator` can return `0`
* even if [equals][Snowflake.equals] returns `false`, but [equals][Snowflake.equals] only returns `true` if
Expand Down
Loading

0 comments on commit 4afb307

Please sign in to comment.