diff --git a/src/structures/GuildBan.ts b/src/structures/GuildBan.ts index d0ae6f6..2685481 100644 --- a/src/structures/GuildBan.ts +++ b/src/structures/GuildBan.ts @@ -3,7 +3,7 @@ import type { GuildBanStructure, GuildStructure } from '../client'; import type { UsingClient } from '../commands'; import { Formatter, type MethodContext, type ObjectToLower } from '../common'; import type { BanShorter } from '../common/shorters/bans'; -import type { APIBan, RESTGetAPIGuildBansQuery } from '../types'; +import type { APIBan, ActuallyBan, RESTGetAPIGuildBansQuery } from '../types'; import { DiscordBase } from './extra/DiscordBase'; export interface GuildBan extends DiscordBase, ObjectToLower> {} @@ -11,10 +11,11 @@ export interface GuildBan extends DiscordBase, ObjectToLower> export class GuildBan extends DiscordBase { constructor( client: UsingClient, - data: APIBan, + data: APIBan | ActuallyBan, readonly guildId: string, ) { - super(client, { ...data, id: data.user.id }); + const id = 'user' in data ? data.user.id : data.id; + super(client, { ...data, id }); } create(body?: Parameters[2], reason?: string) { diff --git a/src/types/payloads/guild.ts b/src/types/payloads/guild.ts index df2967a..550c8bd 100644 --- a/src/types/payloads/guild.ts +++ b/src/types/payloads/guild.ts @@ -861,6 +861,24 @@ export interface APIBan { user: APIUser; } +/** + * @unstable Intended for future use, but not yet documented + */ +export interface ActuallyBan { + /** + * The reason for the ban + */ + reason: string | null; + /** + * The banned user + */ + id: string; + /** + * The guild this ban is for + */ + guild_id: string; +} + /** * https://discord.com/developers/docs/resources/guild#guild-widget-object */