mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 21:16:09 +00:00
fix: idk
This commit is contained in:
parent
fcf8c60cca
commit
42e5c9f62b
@ -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;
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,13 @@ export class Member implements Model {
|
||||
}
|
||||
|
||||
async ban(options: CreateGuildBan): Promise<Member> {
|
||||
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<Member> {
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user