From 98544fa56aa7d6e98b23ead4e898a5f8424a437a Mon Sep 17 00:00:00 2001 From: advaith Date: Thu, 6 Jun 2024 15:16:37 -0700 Subject: [PATCH] fix(APIGuildMember): make user required and omit in messages (#998) --- deno/gateway/v10.ts | 2 +- deno/gateway/v9.ts | 2 +- deno/payloads/v10/guild.ts | 2 +- deno/payloads/v9/guild.ts | 2 +- gateway/v10.ts | 2 +- gateway/v9.ts | 2 +- payloads/v10/guild.ts | 2 +- payloads/v9/guild.ts | 2 +- tests/v10/messageCreate.test-d.ts | 6 ++++++ 9 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 tests/v10/messageCreate.test-d.ts diff --git a/deno/gateway/v10.ts b/deno/gateway/v10.ts index d375667b8..3767ac2b5 100644 --- a/deno/gateway/v10.ts +++ b/deno/gateway/v10.ts @@ -1407,7 +1407,7 @@ export interface GatewayMessageEventExtraFields { * * See https://discord.com/developers/docs/resources/guild#guild-member-object */ - member?: APIGuildMember; + member?: Omit; /** * Users specifically mentioned in the message * diff --git a/deno/gateway/v9.ts b/deno/gateway/v9.ts index a2c7913dd..47f10ba33 100644 --- a/deno/gateway/v9.ts +++ b/deno/gateway/v9.ts @@ -1406,7 +1406,7 @@ export interface GatewayMessageEventExtraFields { * * See https://discord.com/developers/docs/resources/guild#guild-member-object */ - member?: APIGuildMember; + member?: Omit; /** * Users specifically mentioned in the message * diff --git a/deno/payloads/v10/guild.ts b/deno/payloads/v10/guild.ts index ee4f51bc6..ed5f845c1 100644 --- a/deno/payloads/v10/guild.ts +++ b/deno/payloads/v10/guild.ts @@ -621,7 +621,7 @@ export interface APIGuildMember { * * See https://discord.com/developers/docs/resources/user#user-object */ - user?: APIUser; + user: APIUser; /** * This users guild nickname */ diff --git a/deno/payloads/v9/guild.ts b/deno/payloads/v9/guild.ts index 51bc1f246..cd396ffb9 100644 --- a/deno/payloads/v9/guild.ts +++ b/deno/payloads/v9/guild.ts @@ -613,7 +613,7 @@ export interface APIGuildMember { * * See https://discord.com/developers/docs/resources/user#user-object */ - user?: APIUser; + user: APIUser; /** * This users guild nickname */ diff --git a/gateway/v10.ts b/gateway/v10.ts index e9e216748..9a8d6dadd 100644 --- a/gateway/v10.ts +++ b/gateway/v10.ts @@ -1407,7 +1407,7 @@ export interface GatewayMessageEventExtraFields { * * See https://discord.com/developers/docs/resources/guild#guild-member-object */ - member?: APIGuildMember; + member?: Omit; /** * Users specifically mentioned in the message * diff --git a/gateway/v9.ts b/gateway/v9.ts index 5af589e85..24f2f7ad4 100644 --- a/gateway/v9.ts +++ b/gateway/v9.ts @@ -1406,7 +1406,7 @@ export interface GatewayMessageEventExtraFields { * * See https://discord.com/developers/docs/resources/guild#guild-member-object */ - member?: APIGuildMember; + member?: Omit; /** * Users specifically mentioned in the message * diff --git a/payloads/v10/guild.ts b/payloads/v10/guild.ts index c0a0c4491..9a9db2714 100644 --- a/payloads/v10/guild.ts +++ b/payloads/v10/guild.ts @@ -621,7 +621,7 @@ export interface APIGuildMember { * * See https://discord.com/developers/docs/resources/user#user-object */ - user?: APIUser; + user: APIUser; /** * This users guild nickname */ diff --git a/payloads/v9/guild.ts b/payloads/v9/guild.ts index e09774d2f..62e8d7703 100644 --- a/payloads/v9/guild.ts +++ b/payloads/v9/guild.ts @@ -613,7 +613,7 @@ export interface APIGuildMember { * * See https://discord.com/developers/docs/resources/user#user-object */ - user?: APIUser; + user: APIUser; /** * This users guild nickname */ diff --git a/tests/v10/messageCreate.test-d.ts b/tests/v10/messageCreate.test-d.ts new file mode 100644 index 000000000..bc313f28b --- /dev/null +++ b/tests/v10/messageCreate.test-d.ts @@ -0,0 +1,6 @@ +import { expectError } from 'tsd'; +import { GatewayMessageCreateDispatch } from '../../v10'; + +declare const messageCreateDispatch: GatewayMessageCreateDispatch; + +expectError(messageCreateDispatch.d.member?.user);