mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +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) {
|
constructor(session: Session, data: DiscordComponent) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.customId = data.custom_id;
|
this.customId = data.custom_id;
|
||||||
this.type = data.type
|
this.type = data.type;
|
||||||
this.components = data.components?.map((component) => new Component(session, component));
|
this.components = data.components?.map((component) => new Component(session, component));
|
||||||
this.disabled = !!data.disabled;
|
this.disabled = !!data.disabled;
|
||||||
|
|
||||||
|
@ -72,7 +72,8 @@ export class Guild extends BaseGuild implements Model {
|
|||||||
this.vefificationLevel = data.verification_level;
|
this.vefificationLevel = data.verification_level;
|
||||||
this.defaultMessageNotificationLevel = data.default_message_notifications;
|
this.defaultMessageNotificationLevel = data.default_message_notifications;
|
||||||
this.explicitContentFilterLevel = data.explicit_content_filter;
|
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.roles = data.roles.map((role) => new Role(session, role, data.id));
|
||||||
this.emojis = data.emojis.map((guildEmoji) => new GuildEmoji(session, guildEmoji, 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));
|
return invites.map((invite) => new Invite(this.session, invite));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bans the member
|
* Bans the member
|
||||||
*/
|
*/
|
||||||
|
@ -2,11 +2,11 @@ import type { Model } from "./Base.ts";
|
|||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type {
|
import type {
|
||||||
DiscordMessage,
|
|
||||||
DiscordInteraction,
|
DiscordInteraction,
|
||||||
InteractionTypes,
|
DiscordMessage,
|
||||||
InteractionResponseTypes,
|
|
||||||
FileContent,
|
FileContent,
|
||||||
|
InteractionResponseTypes,
|
||||||
|
InteractionTypes,
|
||||||
} from "../vendor/external.ts";
|
} from "../vendor/external.ts";
|
||||||
import type { MessageFlags } from "../util/shared/flags.ts";
|
import type { MessageFlags } from "../util/shared/flags.ts";
|
||||||
import type { AllowedMentions } from "./Message.ts";
|
import type { AllowedMentions } from "./Message.ts";
|
||||||
@ -34,8 +34,8 @@ export interface InteractionApplicationCommandCallbackData {
|
|||||||
|
|
||||||
/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice */
|
/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice */
|
||||||
export interface ApplicationCommandOptionChoice {
|
export interface ApplicationCommandOptionChoice {
|
||||||
name: string;
|
name: string;
|
||||||
value: string | number;
|
value: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Interaction implements Model {
|
export class Interaction implements Model {
|
||||||
@ -43,7 +43,7 @@ export class Interaction implements Model {
|
|||||||
this.session = session;
|
this.session = session;
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.token = data.token;
|
this.token = data.token;
|
||||||
this.type = data.type
|
this.type = data.type;
|
||||||
this.guildId = data.guild_id;
|
this.guildId = data.guild_id;
|
||||||
this.channelId = data.channel_id;
|
this.channelId = data.channel_id;
|
||||||
this.applicationId = data.application_id;
|
this.applicationId = data.application_id;
|
||||||
@ -52,8 +52,7 @@ export class Interaction implements Model {
|
|||||||
|
|
||||||
if (!data.guild_id) {
|
if (!data.guild_id) {
|
||||||
this.user = new User(session, data.user!);
|
this.user = new User(session, data.user!);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.member = new Member(session, data.member!, data.guild_id);
|
this.member = new Member(session, data.member!, data.guild_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,11 +103,11 @@ export class Interaction implements Model {
|
|||||||
file: data?.files,
|
file: data?.files,
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
// remove authorization header
|
// remove authorization header
|
||||||
Authorization: "",
|
Authorization: "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -123,21 +122,21 @@ export class Interaction implements Model {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
...toSend,
|
...toSend,
|
||||||
file: data?.files
|
file: data?.files,
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
// remove authorization header
|
// remove authorization header
|
||||||
Authorization: "",
|
Authorization: "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return new Message(this.session, result);
|
return new Message(this.session, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
inGuild(): this is Interaction & { user: undefined, guildId: Snowflake, member: Member } {
|
inGuild(): this is Interaction & { user: undefined; guildId: Snowflake; member: Member } {
|
||||||
return "guildId" in this;
|
return !!this.guildId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ export class Member implements Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ban(options: CreateGuildBan): Promise<Member> {
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
async kick(options: { reason?: string }): Promise<Member> {
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user