From 84aa40f6ab7602aff34da36aeeaf10761da1d03a Mon Sep 17 00:00:00 2001 From: lukellmann <47486203+lukellmann@users.noreply.github.com> Date: Sat, 2 Sep 2023 05:40:44 +0200 Subject: [PATCH] Allow modifying GuildMemberFlags (#865) This was missing in #760. See https://github.com/discord/discord-api-docs/pull/5881 --- common/api/common.api | 50 +++++++++++-------- common/src/commonMain/kotlin/entity/Member.kt | 15 ++---- .../json/interaction/groupsubcommand.json | 1 + .../json/interaction/rootcommand.json | 1 + .../json/interaction/selectmenu.json | 1 + .../json/interaction/subcommand.json | 1 + core/api/core.api | 17 ++++--- .../kotlin/cache/data/MemberData.kt | 5 ++ core/src/commonMain/kotlin/entity/Member.kt | 4 ++ .../commonTest/kotlin/live/LiveGuildTest.kt | 2 + .../commonTest/kotlin/live/LiveMemberTest.kt | 2 + rest/api/rest.api | 14 ++++-- .../builder/member/MemberModifyBuilder.kt | 7 ++- .../kotlin/json/request/GuildRequests.kt | 3 +- 14 files changed, 75 insertions(+), 48 deletions(-) diff --git a/common/api/common.api b/common/api/common.api index 3f55f5f1232..cb426e30c5e 100644 --- a/common/api/common.api +++ b/common/api/common.api @@ -2411,26 +2411,28 @@ public final class dev/kord/common/entity/DiscordActivityTimestamps$Companion { public final class dev/kord/common/entity/DiscordAddedGuildMember { public static final field Companion Ldev/kord/common/entity/DiscordAddedGuildMember$Companion; - public synthetic fun (ILdev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V - public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (ILdev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V + public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/kord/common/entity/optional/Optional; - public final fun component10 ()Ldev/kord/common/entity/optional/Optional; + public final fun component10 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component11 ()Ldev/kord/common/entity/optional/Optional; + public final fun component12 ()Ldev/kord/common/entity/optional/Optional; public final fun component2 ()Ldev/kord/common/entity/optional/Optional; public final fun component3 ()Ljava/util/List; public final fun component4 ()Lkotlinx/datetime/Instant; public final fun component5 ()Ldev/kord/common/entity/optional/Optional; public final fun component6 ()Z public final fun component7 ()Z - public final fun component8 ()Ldev/kord/common/entity/Snowflake; - public final fun component9 ()Ldev/kord/common/entity/optional/OptionalBoolean; - public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordAddedGuildMember; - public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordAddedGuildMember;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordAddedGuildMember; + public final fun component8 ()Ldev/kord/common/entity/GuildMemberFlags; + public final fun component9 ()Ldev/kord/common/entity/Snowflake; + public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordAddedGuildMember; + public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordAddedGuildMember;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;ZZLdev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordAddedGuildMember; public fun equals (Ljava/lang/Object;)Z public final fun getAvatar ()Ldev/kord/common/entity/optional/Optional; public final fun getCommunicationDisabledUntil ()Ldev/kord/common/entity/optional/Optional; public final fun getDeaf ()Z + public final fun getFlags ()Ldev/kord/common/entity/GuildMemberFlags; public final fun getGuildId ()Ldev/kord/common/entity/Snowflake; public final fun getJoinedAt ()Lkotlinx/datetime/Instant; public final fun getMute ()Z @@ -4447,23 +4449,25 @@ public final class dev/kord/common/entity/DiscordInteraction$Companion { public final class dev/kord/common/entity/DiscordInteractionGuildMember { public static final field Companion Ldev/kord/common/entity/DiscordInteractionGuildMember$Companion; - public synthetic fun (ILdev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V - public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (ILdev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V + public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/kord/common/entity/optional/Optional; + public final fun component10 ()Ldev/kord/common/entity/optional/Optional; public final fun component2 ()Ldev/kord/common/entity/optional/Optional; public final fun component3 ()Ljava/util/List; public final fun component4 ()Lkotlinx/datetime/Instant; public final fun component5 ()Ldev/kord/common/entity/optional/Optional; public final fun component6 ()Ldev/kord/common/entity/Permissions; - public final fun component7 ()Ldev/kord/common/entity/optional/OptionalBoolean; - public final fun component8 ()Ldev/kord/common/entity/optional/Optional; + public final fun component7 ()Ldev/kord/common/entity/GuildMemberFlags; + public final fun component8 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component9 ()Ldev/kord/common/entity/optional/Optional; - public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordInteractionGuildMember; - public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordInteractionGuildMember;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordInteractionGuildMember; + public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordInteractionGuildMember; + public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordInteractionGuildMember;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/Permissions;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordInteractionGuildMember; public fun equals (Ljava/lang/Object;)Z public final fun getAvatar ()Ldev/kord/common/entity/optional/Optional; public final fun getCommunicationDisabledUntil ()Ldev/kord/common/entity/optional/Optional; + public final fun getFlags ()Ldev/kord/common/entity/GuildMemberFlags; public final fun getJoinedAt ()Lkotlinx/datetime/Instant; public final fun getNick ()Ldev/kord/common/entity/optional/Optional; public final fun getPending ()Ldev/kord/common/entity/optional/OptionalBoolean; @@ -6139,23 +6143,25 @@ public final class dev/kord/common/entity/DiscordUpdatedEmojis$Companion { public final class dev/kord/common/entity/DiscordUpdatedGuildMember { public static final field Companion Ldev/kord/common/entity/DiscordUpdatedGuildMember$Companion; - public synthetic fun (ILdev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V - public synthetic fun (Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (ILdev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V + public synthetic fun (Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/kord/common/entity/Snowflake; + public final fun component10 ()Ldev/kord/common/entity/optional/Optional; public final fun component2 ()Ljava/util/List; public final fun component3 ()Ldev/kord/common/entity/DiscordUser; public final fun component4 ()Ldev/kord/common/entity/optional/Optional; public final fun component5 ()Lkotlinx/datetime/Instant; public final fun component6 ()Ldev/kord/common/entity/optional/Optional; - public final fun component7 ()Ldev/kord/common/entity/optional/OptionalBoolean; - public final fun component8 ()Ldev/kord/common/entity/optional/Optional; + public final fun component7 ()Ldev/kord/common/entity/GuildMemberFlags; + public final fun component8 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component9 ()Ldev/kord/common/entity/optional/Optional; - public final fun copy (Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordUpdatedGuildMember; - public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordUpdatedGuildMember;Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordUpdatedGuildMember; + public final fun copy (Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordUpdatedGuildMember; + public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordUpdatedGuildMember;Ldev/kord/common/entity/Snowflake;Ljava/util/List;Ldev/kord/common/entity/DiscordUser;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordUpdatedGuildMember; public fun equals (Ljava/lang/Object;)Z public final fun getAvatar ()Ldev/kord/common/entity/optional/Optional; public final fun getCommunicationDisabledUntil ()Ldev/kord/common/entity/optional/Optional; + public final fun getFlags ()Ldev/kord/common/entity/GuildMemberFlags; public final fun getGuildId ()Ldev/kord/common/entity/Snowflake; public final fun getJoinedAt ()Lkotlinx/datetime/Instant; public final fun getNick ()Ldev/kord/common/entity/optional/Optional; diff --git a/common/src/commonMain/kotlin/entity/Member.kt b/common/src/commonMain/kotlin/entity/Member.kt index a1f47a48522..a37a5dc6a98 100644 --- a/common/src/commonMain/kotlin/entity/Member.kt +++ b/common/src/commonMain/kotlin/entity/Member.kt @@ -23,10 +23,6 @@ import kotlinx.serialization.Serializable @Serializable public data class DiscordGuildMember( val user: Optional = Optional.Missing(), - /* - Don't trust the docs: - 2020-11-05 nick is only documented as nullable but can be missing through Gateway - */ val nick: Optional = Optional.Missing(), val roles: List, @SerialName("joined_at") @@ -46,10 +42,6 @@ public data class DiscordGuildMember( @Serializable public data class DiscordInteractionGuildMember( val user: Optional = Optional.Missing(), - /* - Don't trust the docs: - 2020-11-05 nick is only documented as nullable but can be missing through Gateway - */ val nick: Optional = Optional.Missing(), val roles: List, @SerialName("joined_at") @@ -57,6 +49,7 @@ public data class DiscordInteractionGuildMember( @SerialName("premium_since") val premiumSince: Optional = Optional.Missing(), val permissions: Permissions, + val flags: GuildMemberFlags, val pending: OptionalBoolean = OptionalBoolean.Missing, val avatar: Optional = Optional.Missing(), @SerialName("communication_disabled_until") @@ -67,10 +60,6 @@ public data class DiscordInteractionGuildMember( @Serializable public data class DiscordAddedGuildMember( val user: Optional = Optional.Missing(), - /* - Don't trust the docs: - 2020-11-05 nick is only documented as nullable but can be missing through Gateway - */ val nick: Optional = Optional.Missing(), val roles: List, @SerialName("joined_at") @@ -79,6 +68,7 @@ public data class DiscordAddedGuildMember( val premiumSince: Optional = Optional.Missing(), val deaf: Boolean, val mute: Boolean, + val flags: GuildMemberFlags, @SerialName("guild_id") val guildId: Snowflake, val pending: OptionalBoolean = OptionalBoolean.Missing, @@ -105,6 +95,7 @@ public data class DiscordUpdatedGuildMember( val joinedAt: Instant, @SerialName("premium_since") val premiumSince: Optional = Optional.Missing(), + val flags: GuildMemberFlags, val pending: OptionalBoolean = OptionalBoolean.Missing, val avatar: Optional = Optional.Missing(), @SerialName("communication_disabled_until") diff --git a/common/src/commonTest/resources/json/interaction/groupsubcommand.json b/common/src/commonTest/resources/json/interaction/groupsubcommand.json index a5a7d0d8cd0..1e27103d55d 100644 --- a/common/src/commonTest/resources/json/interaction/groupsubcommand.json +++ b/common/src/commonTest/resources/json/interaction/groupsubcommand.json @@ -17,6 +17,7 @@ "premium_since": null, "permissions": "2147483647", "pending": false, + "flags": 3, "nick": null, "mute": false, "joined_at": "2020-04-03T09:35:54.879000+00:00", diff --git a/common/src/commonTest/resources/json/interaction/rootcommand.json b/common/src/commonTest/resources/json/interaction/rootcommand.json index bade6fdf227..9424de1ccbc 100644 --- a/common/src/commonTest/resources/json/interaction/rootcommand.json +++ b/common/src/commonTest/resources/json/interaction/rootcommand.json @@ -17,6 +17,7 @@ "premium_since": null, "permissions": "2147483647", "pending": false, + "flags": 3, "nick": null, "mute": false, "joined_at": "2020-04-03T09:35:54.879000+00:00", diff --git a/common/src/commonTest/resources/json/interaction/selectmenu.json b/common/src/commonTest/resources/json/interaction/selectmenu.json index b6612122f21..de514c5202d 100644 --- a/common/src/commonTest/resources/json/interaction/selectmenu.json +++ b/common/src/commonTest/resources/json/interaction/selectmenu.json @@ -21,6 +21,7 @@ "joined_at": "2020-11-02T19:25:47.248000+00:00", "mute": false, "nick": "Bot Man", + "flags": 3, "pending": false, "permissions": "17179869183", "premium_since": null, diff --git a/common/src/commonTest/resources/json/interaction/subcommand.json b/common/src/commonTest/resources/json/interaction/subcommand.json index dc7c201f467..7165eb0220e 100644 --- a/common/src/commonTest/resources/json/interaction/subcommand.json +++ b/common/src/commonTest/resources/json/interaction/subcommand.json @@ -16,6 +16,7 @@ ], "premium_since": null, "permissions": "2147483647", + "flags": 3, "pending": false, "nick": null, "mute": false, diff --git a/core/api/core.api b/core/api/core.api index c0aa6d4e6d0..8a0a90912db 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -4181,23 +4181,25 @@ public final class dev/kord/core/cache/data/InviteWithMetadataData$Companion { public final class dev/kord/core/cache/data/MemberData { public static final field Companion Ldev/kord/core/cache/data/MemberData$Companion; - public synthetic fun (ILdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V - public synthetic fun (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (ILdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V + public synthetic fun (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/kord/common/entity/Snowflake; + public final fun component10 ()Ldev/kord/common/entity/optional/Optional; public final fun component2 ()Ldev/kord/common/entity/Snowflake; public final fun component3 ()Ldev/kord/common/entity/optional/Optional; public final fun component4 ()Ljava/util/List; public final fun component5 ()Lkotlinx/datetime/Instant; public final fun component6 ()Ldev/kord/common/entity/optional/Optional; - public final fun component7 ()Ldev/kord/common/entity/optional/OptionalBoolean; - public final fun component8 ()Ldev/kord/common/entity/optional/Optional; + public final fun component7 ()Ldev/kord/common/entity/GuildMemberFlags; + public final fun component8 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component9 ()Ldev/kord/common/entity/optional/Optional; - public final fun copy (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/core/cache/data/MemberData; - public static synthetic fun copy$default (Ldev/kord/core/cache/data/MemberData;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/core/cache/data/MemberData; + public final fun copy (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/core/cache/data/MemberData; + public static synthetic fun copy$default (Ldev/kord/core/cache/data/MemberData;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/util/List;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/GuildMemberFlags;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/core/cache/data/MemberData; public fun equals (Ljava/lang/Object;)Z public final fun getAvatar ()Ldev/kord/common/entity/optional/Optional; public final fun getCommunicationDisabledUntil ()Ldev/kord/common/entity/optional/Optional; + public final fun getFlags ()Ldev/kord/common/entity/GuildMemberFlags; public final fun getGuildId ()Ldev/kord/common/entity/Snowflake; public final fun getJoinedAt ()Lkotlinx/datetime/Instant; public final fun getNick ()Ldev/kord/common/entity/optional/Optional; @@ -6611,6 +6613,7 @@ public final class dev/kord/core/entity/Member : dev/kord/core/entity/User, dev/ public final fun getCommunicationDisabledUntil ()Lkotlinx/datetime/Instant; public final fun getDisplayName ()Ljava/lang/String; public final fun getEffectiveName ()Ljava/lang/String; + public final fun getFlags ()Ldev/kord/common/entity/GuildMemberFlags; public fun getGuild ()Ldev/kord/core/behavior/GuildBehavior; public fun getGuild (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getGuildId ()Ldev/kord/common/entity/Snowflake; diff --git a/core/src/commonMain/kotlin/cache/data/MemberData.kt b/core/src/commonMain/kotlin/cache/data/MemberData.kt index a4fc752194f..4f99cf14e48 100644 --- a/core/src/commonMain/kotlin/cache/data/MemberData.kt +++ b/core/src/commonMain/kotlin/cache/data/MemberData.kt @@ -18,6 +18,7 @@ public data class MemberData( val roles: List, val joinedAt: Instant, val premiumSince: Optional = Optional.Missing(), + val flags: GuildMemberFlags, val pending: OptionalBoolean = OptionalBoolean.Missing, val avatar: Optional = Optional.Missing(), val communicationDisabledUntil: Optional = Optional.Missing() @@ -34,6 +35,7 @@ public data class MemberData( roles = roles, joinedAt = joinedAt, premiumSince = premiumSince, + flags = flags, pending = pending, avatar = avatar, communicationDisabledUntil = communicationDisabledUntil, @@ -50,6 +52,7 @@ public data class MemberData( roles = roles, joinedAt = joinedAt, premiumSince = premiumSince, + flags = flags, pending = pending, avatar = avatar, communicationDisabledUntil = communicationDisabledUntil, @@ -64,6 +67,7 @@ public data class MemberData( roles = roles, joinedAt = joinedAt, premiumSince = premiumSince, + flags = flags, pending = pending, avatar = avatar, communicationDisabledUntil = communicationDisabledUntil, @@ -78,6 +82,7 @@ public data class MemberData( roles = roles, joinedAt = joinedAt, premiumSince = premiumSince, + flags = flags, pending = pending, avatar = avatar, communicationDisabledUntil = communicationDisabledUntil, diff --git a/core/src/commonMain/kotlin/entity/Member.kt b/core/src/commonMain/kotlin/entity/Member.kt index bae2a891a18..64c2c4a5969 100644 --- a/core/src/commonMain/kotlin/entity/Member.kt +++ b/core/src/commonMain/kotlin/entity/Member.kt @@ -1,6 +1,7 @@ package dev.kord.core.entity import dev.kord.common.entity.ALL +import dev.kord.common.entity.GuildMemberFlags import dev.kord.common.entity.Permissions import dev.kord.common.entity.Snowflake import dev.kord.common.exception.RequestException @@ -97,6 +98,9 @@ public class Member( get() = if (roleIds.isEmpty()) emptyFlow() else supplier.getGuildRoles(guildId).filter { it.id in roleIds } + /** The [GuildMemberFlags] of this member. */ + public val flags: GuildMemberFlags get() = memberData.flags + /** * Whether the user has not yet passed the guild's Membership Screening requirements. */ diff --git a/core/src/commonTest/kotlin/live/LiveGuildTest.kt b/core/src/commonTest/kotlin/live/LiveGuildTest.kt index 9f578749466..e0a1cb38ca5 100644 --- a/core/src/commonTest/kotlin/live/LiveGuildTest.kt +++ b/core/src/commonTest/kotlin/live/LiveGuildTest.kt @@ -353,6 +353,7 @@ class LiveGuildTest : AbstractLiveEntityTest() { deaf = false, mute = false, joinedAt = Instant.fromEpochMilliseconds(0), + flags = GuildMemberFlags(), ), 0 ) @@ -380,6 +381,7 @@ class LiveGuildTest : AbstractLiveEntityTest() { avatar = null ), joinedAt = Instant.fromEpochMilliseconds(0), + flags = GuildMemberFlags(), ), 0 ) diff --git a/core/src/commonTest/kotlin/live/LiveMemberTest.kt b/core/src/commonTest/kotlin/live/LiveMemberTest.kt index d39c1df850f..0ba1299e22b 100644 --- a/core/src/commonTest/kotlin/live/LiveMemberTest.kt +++ b/core/src/commonTest/kotlin/live/LiveMemberTest.kt @@ -40,6 +40,7 @@ class LiveMemberTest : AbstractLiveEntityTest() { joinedAt = Instant.fromEpochMilliseconds(0), premiumSince = Optional.Missing(), avatar = Optional.Missing(), + flags = GuildMemberFlags(), ), userData = UserData( id = userId, @@ -69,6 +70,7 @@ class LiveMemberTest : AbstractLiveEntityTest() { avatar = null ), joinedAt = Instant.fromEpochMilliseconds(0), + flags = GuildMemberFlags(), ), 0 ) diff --git a/rest/api/rest.api b/rest/api/rest.api index 0b4a20cd253..96cc14dc4c0 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -1833,6 +1833,7 @@ public final class dev/kord/rest/builder/member/MemberModifyBuilder : dev/kord/r public fun ()V public final fun getCommunicationDisabledUntil ()Lkotlinx/datetime/Instant; public final fun getDeafened ()Ljava/lang/Boolean; + public final fun getFlags ()Ldev/kord/common/entity/GuildMemberFlags; public final fun getMuted ()Ljava/lang/Boolean; public final fun getNickname ()Ljava/lang/String; public fun getReason ()Ljava/lang/String; @@ -1840,6 +1841,7 @@ public final class dev/kord/rest/builder/member/MemberModifyBuilder : dev/kord/r public final fun getVoiceChannelId ()Ldev/kord/common/entity/Snowflake; public final fun setCommunicationDisabledUntil (Lkotlinx/datetime/Instant;)V public final fun setDeafened (Ljava/lang/Boolean;)V + public final fun setFlags (Ldev/kord/common/entity/GuildMemberFlags;)V public final fun setMuted (Ljava/lang/Boolean;)V public final fun setNickname (Ljava/lang/String;)V public fun setReason (Ljava/lang/String;)V @@ -4087,21 +4089,23 @@ public final class dev/kord/rest/json/request/GuildMemberAddRequest$Companion { public final class dev/kord/rest/json/request/GuildMemberModifyRequest { public static final field Companion Ldev/kord/rest/json/request/GuildMemberModifyRequest$Companion; public fun ()V - public synthetic fun (ILdev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;)V - public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (ILdev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V + public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/kord/common/entity/optional/Optional; public final fun component2 ()Ldev/kord/common/entity/optional/Optional; public final fun component3 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component4 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component5 ()Ldev/kord/common/entity/optional/OptionalSnowflake; public final fun component6 ()Ldev/kord/common/entity/optional/Optional; - public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/rest/json/request/GuildMemberModifyRequest; - public static synthetic fun copy$default (Ldev/kord/rest/json/request/GuildMemberModifyRequest;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/rest/json/request/GuildMemberModifyRequest; + public final fun component7 ()Ldev/kord/common/entity/optional/Optional; + public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/rest/json/request/GuildMemberModifyRequest; + public static synthetic fun copy$default (Ldev/kord/rest/json/request/GuildMemberModifyRequest;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/rest/json/request/GuildMemberModifyRequest; public fun equals (Ljava/lang/Object;)Z public final fun getChannelId ()Ldev/kord/common/entity/optional/OptionalSnowflake; public final fun getCommunicationDisabledUntil ()Ldev/kord/common/entity/optional/Optional; public final fun getDeaf ()Ldev/kord/common/entity/optional/OptionalBoolean; + public final fun getFlags ()Ldev/kord/common/entity/optional/Optional; public final fun getMute ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun getNick ()Ldev/kord/common/entity/optional/Optional; public final fun getRoles ()Ldev/kord/common/entity/optional/Optional; diff --git a/rest/src/commonMain/kotlin/builder/member/MemberModifyBuilder.kt b/rest/src/commonMain/kotlin/builder/member/MemberModifyBuilder.kt index 3a2db2bdd07..d5a086de85f 100644 --- a/rest/src/commonMain/kotlin/builder/member/MemberModifyBuilder.kt +++ b/rest/src/commonMain/kotlin/builder/member/MemberModifyBuilder.kt @@ -1,6 +1,7 @@ package dev.kord.rest.builder.member import dev.kord.common.annotation.KordDsl +import dev.kord.common.entity.GuildMemberFlags import dev.kord.common.entity.Snowflake import dev.kord.common.entity.optional.Optional import dev.kord.common.entity.optional.OptionalBoolean @@ -32,12 +33,16 @@ public class MemberModifyBuilder : AuditRequestBuilder private var _roles: Optional?> = Optional.Missing() public var roles: MutableSet? by ::_roles.delegate() + private var _flags: Optional = Optional.Missing() + public var flags: GuildMemberFlags? by ::_flags.delegate() + override fun toRequest(): GuildMemberModifyRequest = GuildMemberModifyRequest( nick = _nickname, channelId = _voiceChannelId, mute = _muted, deaf = _deafened, roles = _roles, - communicationDisabledUntil = _communicationDisabledUntil + communicationDisabledUntil = _communicationDisabledUntil, + flags = _flags, ) } diff --git a/rest/src/commonMain/kotlin/json/request/GuildRequests.kt b/rest/src/commonMain/kotlin/json/request/GuildRequests.kt index d37265b15fd..06486269d29 100644 --- a/rest/src/commonMain/kotlin/json/request/GuildRequests.kt +++ b/rest/src/commonMain/kotlin/json/request/GuildRequests.kt @@ -126,7 +126,8 @@ public data class GuildMemberModifyRequest( @SerialName("channel_id") val channelId: OptionalSnowflake? = OptionalSnowflake.Missing, @SerialName("communication_disabled_until") - val communicationDisabledUntil: Optional = Optional.Missing() + val communicationDisabledUntil: Optional = Optional.Missing(), + val flags: Optional = Optional.Missing(), )