fix(GuildBan): issues

This commit is contained in:
Marcos Susaña 2025-03-09 21:42:36 -04:00
parent 61dc04893d
commit 5f5902b9f6
No known key found for this signature in database
2 changed files with 22 additions and 3 deletions

View File

@ -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<Omit<APIBan, 'id'>> {}
@ -11,10 +11,11 @@ export interface GuildBan extends DiscordBase, ObjectToLower<Omit<APIBan, 'id'>>
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<BanShorter['create']>[2], reason?: string) {

View File

@ -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
*/