From 42e5c9f62b787cf798fdd227e9c3722e32c5d5ec Mon Sep 17 00:00:00 2001 From: Yuzu Date: Fri, 1 Jul 2022 10:12:48 -0500 Subject: [PATCH] fix: idk --- structures/Component.ts | 2 +- structures/Guild.ts | 4 ++-- structures/Interaction.ts | 29 ++++++++++++++--------------- structures/Member.ts | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/structures/Component.ts b/structures/Component.ts index 4999b8c..02daff5 100644 --- a/structures/Component.ts +++ b/structures/Component.ts @@ -6,7 +6,7 @@ export class Component { constructor(session: Session, data: DiscordComponent) { this.session = session; this.customId = data.custom_id; - this.type = data.type + this.type = data.type; this.components = data.components?.map((component) => new Component(session, component)); this.disabled = !!data.disabled; diff --git a/structures/Guild.ts b/structures/Guild.ts index 936e3f3..0fe06e5 100644 --- a/structures/Guild.ts +++ b/structures/Guild.ts @@ -72,7 +72,8 @@ export class Guild extends BaseGuild implements Model { this.vefificationLevel = data.verification_level; this.defaultMessageNotificationLevel = data.default_message_notifications; this.explicitContentFilterLevel = data.explicit_content_filter; - this.members = data.members?.map((member) => new Member(session, { ...member, user: member.user! }, data.id)) ?? []; + this.members = data.members?.map((member) => new Member(session, { ...member, user: member.user! }, data.id)) ?? + []; this.roles = data.roles.map((role) => new Role(session, role, data.id)); this.emojis = data.emojis.map((guildEmoji) => new GuildEmoji(session, guildEmoji, data.id)); } @@ -201,7 +202,6 @@ export class Guild extends BaseGuild implements Model { return invites.map((invite) => new Invite(this.session, invite)); } - /** * Bans the member */ diff --git a/structures/Interaction.ts b/structures/Interaction.ts index 29a6744..59b589c 100644 --- a/structures/Interaction.ts +++ b/structures/Interaction.ts @@ -2,11 +2,11 @@ import type { Model } from "./Base.ts"; import type { Snowflake } from "../util/Snowflake.ts"; import type { Session } from "../session/Session.ts"; import type { - DiscordMessage, DiscordInteraction, - InteractionTypes, - InteractionResponseTypes, + DiscordMessage, FileContent, + InteractionResponseTypes, + InteractionTypes, } from "../vendor/external.ts"; import type { MessageFlags } from "../util/shared/flags.ts"; import type { AllowedMentions } from "./Message.ts"; @@ -34,8 +34,8 @@ export interface InteractionApplicationCommandCallbackData { /** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice */ export interface ApplicationCommandOptionChoice { - name: string; - value: string | number; + name: string; + value: string | number; } export class Interaction implements Model { @@ -43,7 +43,7 @@ export class Interaction implements Model { this.session = session; this.id = data.id; this.token = data.token; - this.type = data.type + this.type = data.type; this.guildId = data.guild_id; this.channelId = data.channel_id; this.applicationId = data.application_id; @@ -52,8 +52,7 @@ export class Interaction implements Model { if (!data.guild_id) { this.user = new User(session, data.user!); - } - else { + } else { this.member = new Member(session, data.member!, data.guild_id); } } @@ -104,11 +103,11 @@ export class Interaction implements Model { file: data?.files, }, headers: { - // remove authorization header - Authorization: "", + // remove authorization header + Authorization: "", }, }), - } + }, ); return; @@ -123,21 +122,21 @@ export class Interaction implements Model { method: "POST", body: { ...toSend, - file: data?.files + file: data?.files, }, headers: { // remove authorization header Authorization: "", }, }), - } + }, ); return new Message(this.session, result); } - inGuild(): this is Interaction & { user: undefined, guildId: Snowflake, member: Member } { - return "guildId" in this; + inGuild(): this is Interaction & { user: undefined; guildId: Snowflake; member: Member } { + return !!this.guildId; } } diff --git a/structures/Member.ts b/structures/Member.ts index 9d12de1..d4ef440 100644 --- a/structures/Member.ts +++ b/structures/Member.ts @@ -57,13 +57,13 @@ export class Member implements Model { } async ban(options: CreateGuildBan): Promise { - await Guild.prototype.banMember.call({ id: this.guildId }, this.user.id, options); + await Guild.prototype.banMember.call({ id: this.guildId, session: this.session }, this.user.id, options); return this; } async kick(options: { reason?: string }): Promise { - await Guild.prototype.kickMember.call({ id: this.guildId }, this.user.id, options); + await Guild.prototype.kickMember.call({ id: this.guildId, session: this.session }, this.user.id, options); return this; }