feat(_interactions): Support partial guild objects (#1142)

* feat: support partial guild objects

* docs: use `@unstable`
This commit is contained in:
Jiralite
2024-11-13 15:09:19 +00:00
committed by GitHub
parent 3f489f18dc
commit 408165e96f
8 changed files with 76 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ import type {
ChannelType,
ThreadChannelType,
} from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIGuildMember, APIPartialInteractionGuild } from '../guild.ts';
import type { APIEntitlement } from '../monetization.ts';
import type { APIUser } from '../user.ts';
import type { InteractionType } from './responses.ts';
@@ -118,7 +118,11 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
*/
data?: Data;
/**
* The guild it was sent from
* Guild that the interaction was sent from
*/
guild?: APIPartialInteractionGuild;
/**
* Guild that the interaction was sent from
*/
guild_id?: Snowflake;
/**

View File

@@ -283,6 +283,19 @@ export interface APIGuild extends APIPartialGuild {
safety_alerts_channel_id: Snowflake | null;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIPartialInteractionGuild extends Pick<APIGuild, 'features' | 'id'> {
/**
* The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US"
*
* @unstable https://github.com/discord/discord-api-docs/issues/6938
* @default "en-US"
*/
locale: Locale;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/

View File

@@ -9,7 +9,7 @@ import type {
ChannelType,
ThreadChannelType,
} from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIGuildMember, APIPartialInteractionGuild } from '../guild.ts';
import type { APIEntitlement } from '../monetization.ts';
import type { APIUser } from '../user.ts';
import type { InteractionType } from './responses.ts';
@@ -118,7 +118,11 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
*/
data?: Data;
/**
* The guild it was sent from
* Guild that the interaction was sent from
*/
guild?: APIPartialInteractionGuild;
/**
* Guild that the interaction was sent from
*/
guild_id?: Snowflake;
/**

View File

@@ -283,6 +283,19 @@ export interface APIGuild extends APIPartialGuild {
safety_alerts_channel_id: Snowflake | null;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIPartialInteractionGuild extends Pick<APIGuild, 'features' | 'id'> {
/**
* The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US"
*
* @unstable https://github.com/discord/discord-api-docs/issues/6938
* @default "en-US"
*/
locale: Locale;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/

View File

@@ -9,7 +9,7 @@ import type {
ChannelType,
ThreadChannelType,
} from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIGuildMember, APIPartialInteractionGuild } from '../guild';
import type { APIEntitlement } from '../monetization';
import type { APIUser } from '../user';
import type { InteractionType } from './responses';
@@ -118,7 +118,11 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
*/
data?: Data;
/**
* The guild it was sent from
* Guild that the interaction was sent from
*/
guild?: APIPartialInteractionGuild;
/**
* Guild that the interaction was sent from
*/
guild_id?: Snowflake;
/**

View File

@@ -283,6 +283,19 @@ export interface APIGuild extends APIPartialGuild {
safety_alerts_channel_id: Snowflake | null;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIPartialInteractionGuild extends Pick<APIGuild, 'features' | 'id'> {
/**
* The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US"
*
* @unstable https://github.com/discord/discord-api-docs/issues/6938
* @default "en-US"
*/
locale: Locale;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/

View File

@@ -9,7 +9,7 @@ import type {
ChannelType,
ThreadChannelType,
} from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIGuildMember, APIPartialInteractionGuild } from '../guild';
import type { APIEntitlement } from '../monetization';
import type { APIUser } from '../user';
import type { InteractionType } from './responses';
@@ -118,7 +118,11 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
*/
data?: Data;
/**
* The guild it was sent from
* Guild that the interaction was sent from
*/
guild?: APIPartialInteractionGuild;
/**
* Guild that the interaction was sent from
*/
guild_id?: Snowflake;
/**

View File

@@ -283,6 +283,19 @@ export interface APIGuild extends APIPartialGuild {
safety_alerts_channel_id: Snowflake | null;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIPartialInteractionGuild extends Pick<APIGuild, 'features' | 'id'> {
/**
* The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US"
*
* @unstable https://github.com/discord/discord-api-docs/issues/6938
* @default "en-US"
*/
locale: Locale;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/