Skip to content

Commit b3efeaf

Browse files
authored
Deprecate application command events (#927)
See discord/discord-api-docs#3690
1 parent 4ad225c commit b3efeaf

File tree

6 files changed

+112
-0
lines changed

6 files changed

+112
-0
lines changed

core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,21 @@ import dev.kord.core.entity.application.*
55
import dev.kord.core.event.Event
66

77

8+
@Deprecated(
9+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
10+
"details.",
11+
level = DeprecationLevel.WARNING,
12+
)
813
public sealed interface ApplicationCommandCreateEvent : Event {
914
public val command: GuildApplicationCommand
1015
}
1116

17+
@Suppress("DEPRECATION")
18+
@Deprecated(
19+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
20+
"details.",
21+
level = DeprecationLevel.WARNING,
22+
)
1223
public class ChatInputCommandCreateEvent(
1324
override val command: GuildChatInputCommand,
1425
override val kord: Kord,
@@ -17,6 +28,12 @@ public class ChatInputCommandCreateEvent(
1728
) : ApplicationCommandCreateEvent
1829

1930

31+
@Suppress("DEPRECATION")
32+
@Deprecated(
33+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
34+
"details.",
35+
level = DeprecationLevel.WARNING,
36+
)
2037
public class UserCommandCreateEvent(
2138
override val command: GuildUserCommand,
2239
override val kord: Kord,
@@ -25,6 +42,12 @@ public class UserCommandCreateEvent(
2542
) : ApplicationCommandCreateEvent
2643

2744

45+
@Suppress("DEPRECATION")
46+
@Deprecated(
47+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
48+
"details.",
49+
level = DeprecationLevel.WARNING,
50+
)
2851
public class MessageCommandCreateEvent(
2952
override val command: GuildMessageCommand,
3053
override val kord: Kord,
@@ -33,6 +56,12 @@ public class MessageCommandCreateEvent(
3356
) : ApplicationCommandCreateEvent
3457

3558

59+
@Suppress("DEPRECATION")
60+
@Deprecated(
61+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
62+
"details.",
63+
level = DeprecationLevel.WARNING,
64+
)
3665
public class UnknownApplicationCommandCreateEvent(
3766
override val command: UnknownGuildApplicationCommand,
3867
override val kord: Kord,

core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,21 @@ import dev.kord.core.entity.application.*
55
import dev.kord.core.event.Event
66

77

8+
@Deprecated(
9+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
10+
"details.",
11+
level = DeprecationLevel.WARNING,
12+
)
813
public sealed interface ApplicationCommandDeleteEvent : Event {
914
public val command: GuildApplicationCommand
1015
}
1116

17+
@Suppress("DEPRECATION")
18+
@Deprecated(
19+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
20+
"details.",
21+
level = DeprecationLevel.WARNING,
22+
)
1223
public class ChatInputCommandDeleteEvent(
1324
override val command: GuildChatInputCommand,
1425
override val kord: Kord,
@@ -17,6 +28,12 @@ public class ChatInputCommandDeleteEvent(
1728
) : ApplicationCommandDeleteEvent
1829

1930

31+
@Suppress("DEPRECATION")
32+
@Deprecated(
33+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
34+
"details.",
35+
level = DeprecationLevel.WARNING,
36+
)
2037
public class UserCommandDeleteEvent(
2138
override val command: GuildUserCommand,
2239
override val kord: Kord,
@@ -25,6 +42,12 @@ public class UserCommandDeleteEvent(
2542
) : ApplicationCommandDeleteEvent
2643

2744

45+
@Suppress("DEPRECATION")
46+
@Deprecated(
47+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
48+
"details.",
49+
level = DeprecationLevel.WARNING,
50+
)
2851
public class MessageCommandDeleteEvent(
2952
override val command: GuildMessageCommand,
3053
override val kord: Kord,
@@ -33,6 +56,12 @@ public class MessageCommandDeleteEvent(
3356
) : ApplicationCommandDeleteEvent
3457

3558

59+
@Suppress("DEPRECATION")
60+
@Deprecated(
61+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
62+
"details.",
63+
level = DeprecationLevel.WARNING,
64+
)
3665
public class UnknownApplicationCommandDeleteEvent(
3766
override val command: UnknownGuildApplicationCommand,
3867
override val kord: Kord,

core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,21 @@ import dev.kord.core.entity.application.*
55
import dev.kord.core.event.Event
66

77

8+
@Deprecated(
9+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
10+
"details.",
11+
level = DeprecationLevel.WARNING,
12+
)
813
public sealed interface ApplicationCommandUpdateEvent : Event {
914
public val command: GuildApplicationCommand
1015
}
1116

17+
@Suppress("DEPRECATION")
18+
@Deprecated(
19+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
20+
"details.",
21+
level = DeprecationLevel.WARNING,
22+
)
1223
public class ChatInputCommandUpdateEvent(
1324
override val command: GuildChatInputCommand,
1425
override val kord: Kord,
@@ -17,6 +28,12 @@ public class ChatInputCommandUpdateEvent(
1728
) : ApplicationCommandUpdateEvent
1829

1930

31+
@Suppress("DEPRECATION")
32+
@Deprecated(
33+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
34+
"details.",
35+
level = DeprecationLevel.WARNING,
36+
)
2037
public class UserCommandUpdateEvent(
2138
override val command: GuildUserCommand,
2239
override val kord: Kord,
@@ -25,13 +42,25 @@ public class UserCommandUpdateEvent(
2542
) : ApplicationCommandUpdateEvent
2643

2744

45+
@Suppress("DEPRECATION")
46+
@Deprecated(
47+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
48+
"details.",
49+
level = DeprecationLevel.WARNING,
50+
)
2851
public class MessageCommandUpdateEvent(
2952
override val command: GuildMessageCommand,
3053
override val kord: Kord,
3154
override val shard: Int,
3255
override val customContext: Any?,
3356
) : ApplicationCommandUpdateEvent
3457

58+
@Suppress("DEPRECATION")
59+
@Deprecated(
60+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
61+
"details.",
62+
level = DeprecationLevel.WARNING,
63+
)
3564
public class UnknownApplicationCommandUpdateEvent(
3665
override val command: UnknownGuildApplicationCommand,
3766
override val kord: Kord,

core/src/commonMain/kotlin/gateway/handler/InteractionEventHandler.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import dev.kord.core.event.Event as CoreEvent
1616

1717
internal class InteractionEventHandler : BaseGatewayEventHandler() {
1818

19+
@Suppress("DEPRECATION")
1920
override suspend fun handle(event: Event, shard: Int, kord: Kord, context: LazyContext?): CoreEvent? =
2021
when (event) {
2122
is InteractionCreate -> handle(event, shard, kord, context)
@@ -53,6 +54,7 @@ internal class InteractionEventHandler : BaseGatewayEventHandler() {
5354
return coreEvent
5455
}
5556

57+
@Suppress("DEPRECATION")
5658
private suspend fun handle(
5759
event: ApplicationCommandCreate,
5860
shard: Int,
@@ -71,6 +73,7 @@ internal class InteractionEventHandler : BaseGatewayEventHandler() {
7173
}
7274

7375

76+
@Suppress("DEPRECATION")
7477
private suspend fun handle(
7578
event: ApplicationCommandUpdate,
7679
shard: Int,
@@ -89,6 +92,7 @@ internal class InteractionEventHandler : BaseGatewayEventHandler() {
8992
return coreEvent
9093
}
9194

95+
@Suppress("DEPRECATION")
9296
private suspend fun handle(
9397
event: ApplicationCommandDelete,
9498
shard: Int,

gateway/src/commonMain/kotlin/Event.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,13 @@ public sealed class Event {
189189
// them too.
190190
// See https://github.com/discord/discord-api-docs/pull/3691
191191
"APPLICATION_COMMAND_CREATE" ->
192+
@Suppress("DEPRECATION")
192193
ApplicationCommandCreate(decode(DiscordApplicationCommand.serializer()), sequence)
193194
"APPLICATION_COMMAND_UPDATE" ->
195+
@Suppress("DEPRECATION")
194196
ApplicationCommandUpdate(decode(DiscordApplicationCommand.serializer()), sequence)
195197
"APPLICATION_COMMAND_DELETE" ->
198+
@Suppress("DEPRECATION")
196199
ApplicationCommandDelete(decode(DiscordApplicationCommand.serializer()), sequence)
197200
else -> {
198201
jsonLogger.debug { "Unknown gateway event name: $eventName" }
@@ -501,14 +504,29 @@ public data class WebhooksUpdate(val webhooksUpdateData: DiscordWebhooksUpdateDa
501504
public data class InteractionCreate(val interaction: DiscordInteraction, override val sequence: Int?) : DispatchEvent()
502505

503506

507+
@Deprecated(
508+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
509+
"details.",
510+
level = DeprecationLevel.WARNING,
511+
)
504512
public data class ApplicationCommandCreate(val application: DiscordApplicationCommand, override val sequence: Int?) :
505513
DispatchEvent()
506514

507515

516+
@Deprecated(
517+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
518+
"details.",
519+
level = DeprecationLevel.WARNING,
520+
)
508521
public data class ApplicationCommandUpdate(val application: DiscordApplicationCommand, override val sequence: Int?) :
509522
DispatchEvent()
510523

511524

525+
@Deprecated(
526+
"This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " +
527+
"details.",
528+
level = DeprecationLevel.WARNING,
529+
)
512530
public data class ApplicationCommandDelete(val application: DiscordApplicationCommand, override val sequence: Int?) :
513531
DispatchEvent()
514532

gateway/src/commonTest/kotlin/json/DispatchEventDeserializationTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ class DispatchEventDeserializationTest {
774774
""""default_member_permissions":null,"version":"0"}"""
775775

776776
@Test
777+
@Suppress("DEPRECATION")
777778
fun test_ApplicationCommandCreate_deserialization() = testDispatchEventDeserialization(
778779
eventName = "APPLICATION_COMMAND_CREATE",
779780
eventConstructor = ::ApplicationCommandCreate,
@@ -782,6 +783,7 @@ class DispatchEventDeserializationTest {
782783
)
783784

784785
@Test
786+
@Suppress("DEPRECATION")
785787
fun test_ApplicationCommandUpdate_deserialization() = testDispatchEventDeserialization(
786788
eventName = "APPLICATION_COMMAND_UPDATE",
787789
eventConstructor = ::ApplicationCommandUpdate,
@@ -790,6 +792,7 @@ class DispatchEventDeserializationTest {
790792
)
791793

792794
@Test
795+
@Suppress("DEPRECATION")
793796
fun test_ApplicationCommandDelete_deserialization() = testDispatchEventDeserialization(
794797
eventName = "APPLICATION_COMMAND_DELETE",
795798
eventConstructor = ::ApplicationCommandDelete,

0 commit comments

Comments
 (0)