mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
fix: fmt
This commit is contained in:
parent
94852eae76
commit
94cfd9805c
4
egg.json
4
egg.json
@ -4,8 +4,8 @@
|
||||
"entry": "./mod.ts",
|
||||
"description": "A brand new bleeding edge non bloated Discord library",
|
||||
"homepage": "https://github.com/oasisjs/biscuit",
|
||||
"version": "0.1.1",
|
||||
"releaseType": "patch",
|
||||
"version": "0.2.0",
|
||||
"releaseType": "minor",
|
||||
"unstable": false,
|
||||
"unlisted": false,
|
||||
"files": [
|
||||
|
@ -1,29 +1,29 @@
|
||||
import type { Snowflake } from "./Snowflake.ts";
|
||||
import { baseEndpoints as Endpoints } from "../discordeno/mod.ts";
|
||||
|
||||
export function USER_AVATAR(userId: Snowflake, icon: string): string {
|
||||
export function USER_AVATAR(userId: Snowflake, icon: string): string {
|
||||
return `${Endpoints.CDN_URL}/avatars/${userId}/${icon}`;
|
||||
}
|
||||
|
||||
export function EMOJI_URL(id: Snowflake, animated = false): string {
|
||||
export function EMOJI_URL(id: Snowflake, animated = false): string {
|
||||
return `https://cdn.discordapp.com/emojis/${id}.${animated ? "gif" : "png"}`;
|
||||
}
|
||||
|
||||
export function USER_DEFAULT_AVATAR(
|
||||
/** user discriminator */
|
||||
altIcon: number,
|
||||
): string {
|
||||
): string {
|
||||
return `${Endpoints.CDN_URL}/embed/avatars/${altIcon}.png`;
|
||||
}
|
||||
|
||||
export function GUILD_BANNER(guildId: Snowflake, icon: string): string {
|
||||
export function GUILD_BANNER(guildId: Snowflake, icon: string): string {
|
||||
return `${Endpoints.CDN_URL}/banners/${guildId}/${icon}`;
|
||||
}
|
||||
|
||||
export function GUILD_SPLASH(guildId: Snowflake, icon: string): string {
|
||||
export function GUILD_SPLASH(guildId: Snowflake, icon: string): string {
|
||||
return `${Endpoints.CDN_URL}/splashes/${guildId}/${icon}`;
|
||||
}
|
||||
|
||||
export function GUILD_ICON(guildId: Snowflake, icon: string): string {
|
||||
export function GUILD_ICON(guildId: Snowflake, icon: string): string {
|
||||
return `${Endpoints.CDN_URL}/icons/${guildId}/${icon}`;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export function USER(userId?: Snowflake): string {
|
||||
return `/users/${userId}`;
|
||||
}
|
||||
|
||||
export function GATEWAY_BOT(): string {
|
||||
export function GATEWAY_BOT(): string {
|
||||
return "/gateway/bot";
|
||||
}
|
||||
|
||||
@ -31,28 +31,28 @@ export interface GetMessagesOptions {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export function CHANNEL(channelId: Snowflake): string {
|
||||
export function CHANNEL(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}`;
|
||||
}
|
||||
|
||||
export function CHANNEL_INVITES(channelId: Snowflake): string {
|
||||
export function CHANNEL_INVITES(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/invites`;
|
||||
}
|
||||
|
||||
export function CHANNEL_TYPING(channelId: Snowflake): string {
|
||||
export function CHANNEL_TYPING(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/typing`;
|
||||
}
|
||||
|
||||
export function CHANNEL_CREATE_THREAD(channelId: Snowflake): string {
|
||||
export function CHANNEL_CREATE_THREAD(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/threads`;
|
||||
}
|
||||
|
||||
export function MESSAGE_CREATE_THREAD(channelId: Snowflake, messageId: Snowflake): string {
|
||||
export function MESSAGE_CREATE_THREAD(channelId: Snowflake, messageId: Snowflake): string {
|
||||
return `/channels/${channelId}/messages/${messageId}/threads`;
|
||||
}
|
||||
|
||||
/** used to send messages */
|
||||
export function CHANNEL_MESSAGES(channelId: Snowflake, options?: GetMessagesOptions): string {
|
||||
export function CHANNEL_MESSAGES(channelId: Snowflake, options?: GetMessagesOptions): string {
|
||||
let url = `/channels/${channelId}/messages?`;
|
||||
|
||||
if (options) {
|
||||
@ -66,17 +66,17 @@ export function CHANNEL_MESSAGES(channelId: Snowflake, options?: GetMessagesOpti
|
||||
}
|
||||
|
||||
/** used to edit messages */
|
||||
export function CHANNEL_MESSAGE(channelId: Snowflake, messageId: Snowflake): string {
|
||||
export function CHANNEL_MESSAGE(channelId: Snowflake, messageId: Snowflake): string {
|
||||
return `/channels/${channelId}/messages/${messageId}`;
|
||||
}
|
||||
|
||||
/** used to kick members */
|
||||
export function GUILD_MEMBER(guildId: Snowflake, userId: Snowflake): string {
|
||||
export function GUILD_MEMBER(guildId: Snowflake, userId: Snowflake): string {
|
||||
return `/guilds/${guildId}/members/${userId}`;
|
||||
}
|
||||
|
||||
/** used to ban members */
|
||||
export function GUILD_BAN(guildId: Snowflake, userId: Snowflake): string {
|
||||
export function GUILD_BAN(guildId: Snowflake, userId: Snowflake): string {
|
||||
return `/guilds/${guildId}/bans/${userId}`;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ export interface GetBans {
|
||||
}
|
||||
|
||||
/** used to unban members */
|
||||
export function GUILD_BANS(guildId: Snowflake, options?: GetBans): string {
|
||||
export function GUILD_BANS(guildId: Snowflake, options?: GetBans): string {
|
||||
let url = `/guilds/${guildId}/bans?`;
|
||||
|
||||
if (options) {
|
||||
@ -99,11 +99,11 @@ export function GUILD_BANS(guildId: Snowflake, options?: GetBans): string {
|
||||
return url;
|
||||
}
|
||||
|
||||
export function GUILD_ROLE(guildId: Snowflake, roleId: Snowflake): string {
|
||||
export function GUILD_ROLE(guildId: Snowflake, roleId: Snowflake): string {
|
||||
return `/guilds/${guildId}/roles/${roleId}`;
|
||||
}
|
||||
|
||||
export function GUILD_ROLES(guildId: Snowflake): string {
|
||||
export function GUILD_ROLES(guildId: Snowflake): string {
|
||||
return `/guilds/${guildId}/roles`;
|
||||
}
|
||||
|
||||
@ -111,11 +111,11 @@ export function USER_DM() {
|
||||
return `/users/@me/channels`;
|
||||
}
|
||||
|
||||
export function GUILD_EMOJIS(guildId: Snowflake): string {
|
||||
export function GUILD_EMOJIS(guildId: Snowflake): string {
|
||||
return `/guilds/${guildId}/emojis`;
|
||||
}
|
||||
|
||||
export function GUILD_EMOJI(guildId: Snowflake, emojiId: Snowflake): string {
|
||||
export function GUILD_EMOJI(guildId: Snowflake, emojiId: Snowflake): string {
|
||||
return `/guilds/${guildId}/emojis/${emojiId}`;
|
||||
}
|
||||
|
||||
@ -125,18 +125,18 @@ export interface GetInvite {
|
||||
scheduledEventId?: Snowflake;
|
||||
}
|
||||
|
||||
export function GUILDS(): string {
|
||||
export function GUILDS(): string {
|
||||
return `/guilds`;
|
||||
}
|
||||
|
||||
export function AUTO_MODERATION_RULES(guildId: Snowflake, ruleId?: Snowflake): string {
|
||||
export function AUTO_MODERATION_RULES(guildId: Snowflake, ruleId?: Snowflake): string {
|
||||
if (ruleId) {
|
||||
return `/guilds/${guildId}/auto-moderation/rules/${ruleId}`;
|
||||
}
|
||||
return `/guilds/${guildId}/auto-moderation/rules`;
|
||||
}
|
||||
|
||||
export function INVITE(inviteCode: string, options?: GetInvite): string {
|
||||
export function INVITE(inviteCode: string, options?: GetInvite): string {
|
||||
let url = `/invites/${inviteCode}?`;
|
||||
|
||||
if (options) {
|
||||
@ -148,11 +148,11 @@ export function INVITE(inviteCode: string, options?: GetInvite): string {
|
||||
return url;
|
||||
}
|
||||
|
||||
export function GUILD_INVITES(guildId: Snowflake): string {
|
||||
export function GUILD_INVITES(guildId: Snowflake): string {
|
||||
return `/guilds/${guildId}/invites`;
|
||||
}
|
||||
|
||||
export function INTERACTION_ID_TOKEN(interactionId: Snowflake, token: string): string {
|
||||
export function INTERACTION_ID_TOKEN(interactionId: Snowflake, token: string): string {
|
||||
return `/interactions/${interactionId}/${token}/callback`;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ export function WEBHOOK_MESSAGE(
|
||||
webhookId: Snowflake,
|
||||
token: string,
|
||||
messageId: Snowflake,
|
||||
options?: { threadId?: Snowflake }
|
||||
options?: { threadId?: Snowflake },
|
||||
): string {
|
||||
let url = `/webhooks/${webhookId}/${token}/messages/${messageId}?`;
|
||||
|
||||
@ -181,7 +181,7 @@ export function WEBHOOK_MESSAGE(
|
||||
return url;
|
||||
}
|
||||
|
||||
export function WEBHOOK_TOKEN(webhookId: Snowflake, token?: string): string {
|
||||
export function WEBHOOK_TOKEN(webhookId: Snowflake, token?: string): string {
|
||||
if (!token) return `/webhooks/${webhookId}`;
|
||||
return `/webhooks/${webhookId}/${token}`;
|
||||
}
|
||||
@ -191,7 +191,7 @@ export interface WebhookOptions {
|
||||
threadId?: Snowflake;
|
||||
}
|
||||
|
||||
export function WEBHOOK(webhookId: Snowflake, token: string, options?: WebhookOptions): string {
|
||||
export function WEBHOOK(webhookId: Snowflake, token: string, options?: WebhookOptions): string {
|
||||
let url = `/webhooks/${webhookId}/${token}`;
|
||||
|
||||
if (options?.wait) url += `?wait=${options.wait}`;
|
||||
@ -201,7 +201,7 @@ export function WEBHOOK(webhookId: Snowflake, token: string, options?: WebhookOp
|
||||
return url;
|
||||
}
|
||||
|
||||
export function USER_NICK(guildId: Snowflake): string {
|
||||
export function USER_NICK(guildId: Snowflake): string {
|
||||
return `/guilds/${guildId}/members/@me`;
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ export interface GetGuildPruneCountQuery {
|
||||
includeRoles?: Snowflake | Snowflake[];
|
||||
}
|
||||
|
||||
export function GUILD_PRUNE(guildId: Snowflake, options?: GetGuildPruneCountQuery): string {
|
||||
export function GUILD_PRUNE(guildId: Snowflake, options?: GetGuildPruneCountQuery): string {
|
||||
let url = `/guilds/${guildId}/prune?`;
|
||||
|
||||
if (options?.days) url += `days=${options.days}`;
|
||||
@ -222,15 +222,15 @@ export function GUILD_PRUNE(guildId: Snowflake, options?: GetGuildPruneCountQuer
|
||||
return url;
|
||||
}
|
||||
|
||||
export function CHANNEL_PIN(channelId: Snowflake, messageId: Snowflake): string {
|
||||
export function CHANNEL_PIN(channelId: Snowflake, messageId: Snowflake): string {
|
||||
return `/channels/${channelId}/pins/${messageId}`;
|
||||
}
|
||||
|
||||
export function CHANNEL_PINS(channelId: Snowflake): string {
|
||||
export function CHANNEL_PINS(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/pins`;
|
||||
}
|
||||
|
||||
export function CHANNEL_MESSAGE_REACTION_ME(channelId: Snowflake, messageId: Snowflake, emoji: string): string {
|
||||
export function CHANNEL_MESSAGE_REACTION_ME(channelId: Snowflake, messageId: Snowflake, emoji: string): string {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}/@me`;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ export function CHANNEL_MESSAGE_REACTION(
|
||||
messageId: Snowflake,
|
||||
emoji: string,
|
||||
options?: GetReactions,
|
||||
): string {
|
||||
): string {
|
||||
let url = `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}?`;
|
||||
|
||||
if (options?.after) url += `after=${options.after}`;
|
||||
@ -269,27 +269,27 @@ export function CHANNEL_MESSAGE_REACTION(
|
||||
return url;
|
||||
}
|
||||
|
||||
export function CHANNEL_MESSAGE_CROSSPOST(channelId: Snowflake, messageId: Snowflake): string {
|
||||
export function CHANNEL_MESSAGE_CROSSPOST(channelId: Snowflake, messageId: Snowflake): string {
|
||||
return `/channels/${channelId}/messages/${messageId}/crosspost`;
|
||||
}
|
||||
|
||||
export function GUILD_MEMBER_ROLE(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake): string {
|
||||
export function GUILD_MEMBER_ROLE(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake): string {
|
||||
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}`;
|
||||
}
|
||||
|
||||
export function CHANNEL_WEBHOOKS(channelId: Snowflake): string {
|
||||
export function CHANNEL_WEBHOOKS(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/webhooks`;
|
||||
}
|
||||
|
||||
export function THREAD_START_PUBLIC(channelId: Snowflake, messageId: Snowflake): string {
|
||||
export function THREAD_START_PUBLIC(channelId: Snowflake, messageId: Snowflake): string {
|
||||
return `/channels/${channelId}/messages/${messageId}/threads`;
|
||||
}
|
||||
|
||||
export function THREAD_START_PRIVATE(channelId: Snowflake): string {
|
||||
export function THREAD_START_PRIVATE(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/threads`;
|
||||
}
|
||||
|
||||
export function THREAD_ACTIVE(guildId: Snowflake): string {
|
||||
export function THREAD_ACTIVE(guildId: Snowflake): string {
|
||||
return `/guilds/${guildId}/threads/active`;
|
||||
}
|
||||
|
||||
@ -298,23 +298,23 @@ export interface ListArchivedThreads {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export function THREAD_ME(channelId: Snowflake): string {
|
||||
export function THREAD_ME(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/thread-members/@me`;
|
||||
}
|
||||
|
||||
export function THREAD_MEMBERS(channelId: Snowflake): string {
|
||||
export function THREAD_MEMBERS(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/thread-members`;
|
||||
}
|
||||
|
||||
export function THREAD_USER(channelId: Snowflake, userId: Snowflake): string {
|
||||
export function THREAD_USER(channelId: Snowflake, userId: Snowflake): string {
|
||||
return `/channels/${channelId}/thread-members/${userId}`;
|
||||
}
|
||||
|
||||
export function THREAD_ARCHIVED(channelId: Snowflake): string {
|
||||
export function THREAD_ARCHIVED(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/threads/archived`;
|
||||
}
|
||||
|
||||
export function THREAD_ARCHIVED_PUBLIC(channelId: Snowflake, options?: ListArchivedThreads): string {
|
||||
export function THREAD_ARCHIVED_PUBLIC(channelId: Snowflake, options?: ListArchivedThreads): string {
|
||||
let url = `/channels/${channelId}/threads/archived/public?`;
|
||||
|
||||
if (options) {
|
||||
@ -325,7 +325,7 @@ export function THREAD_ARCHIVED_PUBLIC(channelId: Snowflake, options?: ListArchi
|
||||
return url;
|
||||
}
|
||||
|
||||
export function THREAD_ARCHIVED_PRIVATE(channelId: Snowflake, options?: ListArchivedThreads): string {
|
||||
export function THREAD_ARCHIVED_PRIVATE(channelId: Snowflake, options?: ListArchivedThreads): string {
|
||||
let url = `/channels/${channelId}/threads/archived/private?`;
|
||||
|
||||
if (options) {
|
||||
@ -336,7 +336,7 @@ export function THREAD_ARCHIVED_PRIVATE(channelId: Snowflake, options?: ListArch
|
||||
return url;
|
||||
}
|
||||
|
||||
export function THREAD_ARCHIVED_PRIVATE_JOINED(channelId: Snowflake, options?: ListArchivedThreads): string {
|
||||
export function THREAD_ARCHIVED_PRIVATE_JOINED(channelId: Snowflake, options?: ListArchivedThreads): string {
|
||||
let url = `/channels/${channelId}/users/@me/threads/archived/private?`;
|
||||
|
||||
if (options) {
|
||||
@ -347,29 +347,33 @@ export function THREAD_ARCHIVED_PRIVATE_JOINED(channelId: Snowflake, options?: L
|
||||
return url;
|
||||
}
|
||||
|
||||
export function FORUM_START(channelId: Snowflake): string {
|
||||
export function FORUM_START(channelId: Snowflake): string {
|
||||
return `/channels/${channelId}/threads?has_message=true`;
|
||||
}
|
||||
|
||||
export function STAGE_INSTANCES(): string {
|
||||
export function STAGE_INSTANCES(): string {
|
||||
return `/stage-instances`;
|
||||
}
|
||||
|
||||
export function STAGE_INSTANCE(channelId: Snowflake): string {
|
||||
export function STAGE_INSTANCE(channelId: Snowflake): string {
|
||||
return `/stage-instances/${channelId}`;
|
||||
}
|
||||
|
||||
export function APPLICATION_COMMANDS(appId: Snowflake, commandId?: Snowflake): string {
|
||||
export function APPLICATION_COMMANDS(appId: Snowflake, commandId?: Snowflake): string {
|
||||
if (commandId) return `/applications/${appId}/commands/${commandId}`;
|
||||
return `/applications/${appId}/commands`;
|
||||
}
|
||||
|
||||
export function GUILD_APPLICATION_COMMANDS(appId: Snowflake, guildId: Snowflake, commandId?: Snowflake): string {
|
||||
export function GUILD_APPLICATION_COMMANDS(appId: Snowflake, guildId: Snowflake, commandId?: Snowflake): string {
|
||||
if (commandId) return `/applications/${appId}/guilds/${guildId}/commands/${commandId}`;
|
||||
return `/applications/${appId}/guilds/${guildId}/commands`;
|
||||
}
|
||||
|
||||
export function GUILD_APPLICATION_COMMANDS_PERMISSIONS(appId: Snowflake, guildId: Snowflake, commandId?: Snowflake): string {
|
||||
export function GUILD_APPLICATION_COMMANDS_PERMISSIONS(
|
||||
appId: Snowflake,
|
||||
guildId: Snowflake,
|
||||
commandId?: Snowflake,
|
||||
): string {
|
||||
if (commandId) return `/applications/${appId}/guilds/${guildId}/commands/${commandId}/permissions`;
|
||||
return `/applications/${appId}/guilds/${guildId}/commands/permissions`;
|
||||
}
|
||||
@ -378,7 +382,7 @@ export function APPLICATION_COMMANDS_LOCALIZATIONS(
|
||||
appId: Snowflake,
|
||||
commandId: Snowflake,
|
||||
withLocalizations?: boolean,
|
||||
): string {
|
||||
): string {
|
||||
let url = `/applications/${appId}/commands/${commandId}?`;
|
||||
|
||||
if (withLocalizations !== undefined) {
|
||||
@ -393,7 +397,7 @@ export function GUILD_APPLICATION_COMMANDS_LOCALIZATIONS(
|
||||
guildId: Snowflake,
|
||||
commandId: Snowflake,
|
||||
withLocalizations?: boolean,
|
||||
): string {
|
||||
): string {
|
||||
let url = `/applications/${appId}/guilds/${guildId}/commands/${commandId}?`;
|
||||
|
||||
if (withLocalizations !== undefined) {
|
||||
@ -403,15 +407,15 @@ export function GUILD_APPLICATION_COMMANDS_LOCALIZATIONS(
|
||||
return url;
|
||||
}
|
||||
|
||||
export function STICKER(id: Snowflake): string {
|
||||
export function STICKER(id: Snowflake): string {
|
||||
return `stickers/${id}`;
|
||||
}
|
||||
|
||||
export function STICKER_PACKS(): string {
|
||||
export function STICKER_PACKS(): string {
|
||||
return `stickers-packs`;
|
||||
}
|
||||
|
||||
export function GUILD_STICKERS(guildId: Snowflake, stickerId?: Snowflake): string {
|
||||
export function GUILD_STICKERS(guildId: Snowflake, stickerId?: Snowflake): string {
|
||||
if (stickerId) return `/guilds/${guildId}/stickers/${stickerId}`;
|
||||
return `/guilds/${guildId}/stickers`;
|
||||
}
|
||||
|
@ -201,11 +201,11 @@ export class Session extends EventEmitter {
|
||||
return super.emit(event, ...params);
|
||||
}
|
||||
|
||||
async editProfile(nick?: string, avatarURL?: string | null ): Promise<User> {
|
||||
async editProfile(nick?: string, avatarURL?: string | null): Promise<User> {
|
||||
const avatar = avatarURL ? await urlToBase64(avatarURL) : avatarURL;
|
||||
const user = await this.rest.runMethod<DiscordUser>(this.rest, 'PATCH', Routes.USER(), {
|
||||
const user = await this.rest.runMethod<DiscordUser>(this.rest, "PATCH", Routes.USER(), {
|
||||
username: nick,
|
||||
avatar: avatar
|
||||
avatar: avatar,
|
||||
});
|
||||
return new User(this, user);
|
||||
}
|
||||
@ -273,7 +273,10 @@ export class Session extends EventEmitter {
|
||||
return new User(this, user);
|
||||
}
|
||||
|
||||
createApplicationCommand(options: CreateApplicationCommand | CreateContextApplicationCommand, guildId?: Snowflake): Promise<DiscordApplicationCommand> {
|
||||
createApplicationCommand(
|
||||
options: CreateApplicationCommand | CreateContextApplicationCommand,
|
||||
guildId?: Snowflake,
|
||||
): Promise<DiscordApplicationCommand> {
|
||||
return this.rest.runMethod<DiscordApplicationCommand>(
|
||||
this.rest,
|
||||
"POST",
|
||||
@ -353,7 +356,10 @@ export class Session extends EventEmitter {
|
||||
);
|
||||
}
|
||||
|
||||
fetchApplicationCommandPermission(guildId: Snowflake, id: Snowflake): Promise<DiscordGuildApplicationCommandPermissions> {
|
||||
fetchApplicationCommandPermission(
|
||||
guildId: Snowflake,
|
||||
id: Snowflake,
|
||||
): Promise<DiscordGuildApplicationCommandPermissions> {
|
||||
return this.rest.runMethod<DiscordGuildApplicationCommandPermissions>(
|
||||
this.rest,
|
||||
"GET",
|
||||
|
@ -41,7 +41,7 @@ export interface AllowedMentions {
|
||||
/**
|
||||
* @link https://github.com/denoland/deno_doc/blob/main/lib/types.d.ts
|
||||
* channelId is optional when creating a reply, but will always be present when receiving an event/response that includes this data model.
|
||||
* */
|
||||
*/
|
||||
export interface CreateMessageReference {
|
||||
messageId: Snowflake;
|
||||
channelId?: Snowflake;
|
||||
@ -82,7 +82,7 @@ export type EmojiResolvable = string | {
|
||||
|
||||
/**
|
||||
* A partial {@link User} to represent the author of a message sent by a webhook
|
||||
* */
|
||||
*/
|
||||
export interface WebhookAuthor {
|
||||
id: string;
|
||||
username: string;
|
||||
@ -108,7 +108,7 @@ export class Message implements Model {
|
||||
users: data.mentions?.map((user) => new User(session, user)) ?? [],
|
||||
roleIds: data.mention_roles ?? [],
|
||||
channels: data.mention_channels?.map((channel) => ChannelFactory.from(session, channel)) ?? [],
|
||||
}
|
||||
};
|
||||
|
||||
if (!data.webhook_id) {
|
||||
this.author = new User(session, data.author);
|
||||
@ -335,7 +335,7 @@ export class Message implements Model {
|
||||
|
||||
/**
|
||||
* Pins this message
|
||||
* */
|
||||
*/
|
||||
async pin(): Promise<void> {
|
||||
await this.session.rest.runMethod<undefined>(
|
||||
this.session.rest,
|
||||
@ -346,7 +346,7 @@ export class Message implements Model {
|
||||
|
||||
/**
|
||||
* Unpins this message
|
||||
* */
|
||||
*/
|
||||
async unpin(): Promise<void> {
|
||||
await this.session.rest.runMethod<undefined>(
|
||||
this.session.rest,
|
||||
@ -487,7 +487,7 @@ export class Message implements Model {
|
||||
|
||||
/**
|
||||
* same as Message.removeReaction but removes using a unicode emoji
|
||||
* */
|
||||
*/
|
||||
async removeReactionEmoji(reaction: EmojiResolvable): Promise<void> {
|
||||
const r = typeof reaction === "string" ? reaction : `${reaction.name}:${reaction.id}`;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { Model } from "./Base.ts";
|
||||
import type { Snowflake } from "../Snowflake.ts";
|
||||
import type { Session } from "../Session.ts";
|
||||
import type { DiscordUser, UserFlags, PremiumTypes } from "../../discordeno/mod.ts";
|
||||
import type { DiscordUser, PremiumTypes, UserFlags } from "../../discordeno/mod.ts";
|
||||
import type { ImageFormat, ImageSize } from "../Util.ts";
|
||||
import Util from "../Util.ts";
|
||||
import * as Routes from "../Routes.ts";
|
||||
|
@ -1,10 +1,17 @@
|
||||
import type { Model } from "./Base.ts";
|
||||
import type { Session } from "../Session.ts";
|
||||
import type { Snowflake } from "../Snowflake.ts";
|
||||
import type { DiscordMessageComponents, DiscordEmbed, DiscordMessage, DiscordWebhook, FileContent, WebhookTypes } from "../../discordeno/mod.ts";
|
||||
import type {
|
||||
DiscordEmbed,
|
||||
DiscordMessage,
|
||||
DiscordMessageComponents,
|
||||
DiscordWebhook,
|
||||
FileContent,
|
||||
WebhookTypes,
|
||||
} from "../../discordeno/mod.ts";
|
||||
import type { WebhookOptions } from "../Routes.ts";
|
||||
import type { Attachment } from "./Attachment.ts";
|
||||
import type { CreateMessage, AllowedMentions } from "./Message.ts";
|
||||
import type { AllowedMentions, CreateMessage } from "./Message.ts";
|
||||
import Util from "../Util.ts";
|
||||
import User from "./User.ts";
|
||||
import Message from "./Message.ts";
|
||||
@ -12,7 +19,7 @@ import * as Routes from "../Routes.ts";
|
||||
|
||||
/**
|
||||
* @link https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params
|
||||
* */
|
||||
*/
|
||||
export interface EditWebhookMessage {
|
||||
content?: string;
|
||||
embeds?: DiscordEmbed[];
|
||||
@ -60,7 +67,9 @@ export class Webhook implements Model {
|
||||
guildId?: Snowflake;
|
||||
user?: User;
|
||||
|
||||
async execute(options?: WebhookOptions & CreateMessage & { avatarUrl?: string; username?: string }): Promise<(Message | undefined)> {
|
||||
async execute(
|
||||
options?: WebhookOptions & CreateMessage & { avatarUrl?: string; username?: string },
|
||||
): Promise<(Message | undefined)> {
|
||||
if (!this.token) {
|
||||
return;
|
||||
}
|
||||
@ -88,7 +97,7 @@ export class Webhook implements Model {
|
||||
}),
|
||||
});
|
||||
|
||||
return (options?.wait ?? true) ? new Message(this.session, await(message)) : undefined;
|
||||
return (options?.wait ?? true) ? new Message(this.session, await (message)) : undefined;
|
||||
}
|
||||
|
||||
async fetch(): Promise<Webhook> {
|
||||
@ -127,7 +136,10 @@ export class Webhook implements Model {
|
||||
);
|
||||
}
|
||||
|
||||
async editMessage(messageId?: Snowflake, options?: EditWebhookMessage & { threadId?: Snowflake }): Promise<Message> {
|
||||
async editMessage(
|
||||
messageId?: Snowflake,
|
||||
options?: EditWebhookMessage & { threadId?: Snowflake },
|
||||
): Promise<Message> {
|
||||
if (!this.token) {
|
||||
throw new Error("No token found");
|
||||
}
|
||||
@ -162,7 +174,7 @@ export class Webhook implements Model {
|
||||
ephemeral: attachment.ephemeral,
|
||||
};
|
||||
}),
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return new Message(this.session, message);
|
||||
|
@ -12,22 +12,22 @@ export class SelectMenuOptionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
setValue(value: string): SelectMenuOptionBuilder {
|
||||
setValue(value: string): SelectMenuOptionBuilder {
|
||||
this.#data.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
setDescription(description: string): SelectMenuOptionBuilder {
|
||||
setDescription(description: string): SelectMenuOptionBuilder {
|
||||
this.#data.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
setDefault(Default = true): SelectMenuOptionBuilder {
|
||||
setDefault(Default = true): SelectMenuOptionBuilder {
|
||||
this.#data.default = Default;
|
||||
return this;
|
||||
}
|
||||
|
||||
setEmoji(emoji: ComponentEmoji): SelectMenuOptionBuilder {
|
||||
setEmoji(emoji: ComponentEmoji): SelectMenuOptionBuilder {
|
||||
this.#data.emoji = emoji;
|
||||
return this;
|
||||
}
|
||||
|
@ -17,10 +17,8 @@ export class TextInput extends BaseComponent implements TextInputComponent {
|
||||
this.placeholder = data.placeholder;
|
||||
this.value = data.value;
|
||||
|
||||
|
||||
this.minLength = data.min_length;
|
||||
this.maxLength = data.max_length;
|
||||
|
||||
}
|
||||
|
||||
readonly session: Session;
|
||||
|
@ -23,7 +23,7 @@ import { Snowflake } from "../Snowflake.ts";
|
||||
import Util from "../Util.ts";
|
||||
import * as Routes from "../Routes.ts";
|
||||
import WelcomeScreen from "./WelcomeScreen.ts";
|
||||
import { GuildChannel, ThreadChannel, ReturnThreadsArchive } from "./channels.ts";
|
||||
import { GuildChannel, ReturnThreadsArchive, ThreadChannel } from "./channels.ts";
|
||||
import ThreadMember from "./ThreadMember.ts";
|
||||
import Member from "./Member.ts";
|
||||
import Role from "./Role.ts";
|
||||
@ -320,7 +320,7 @@ 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.premiumTier = data.premium_tier
|
||||
this.premiumTier = data.premium_tier;
|
||||
|
||||
this.members = new Map(
|
||||
data.members?.map((member) => [data.id, new Member(session, { ...member, user: member.user! }, data.id)]),
|
||||
@ -628,7 +628,7 @@ export class Guild extends BaseGuild implements Model {
|
||||
return result.pruned;
|
||||
}
|
||||
|
||||
async getActiveThreads(): Promise<Omit<ReturnThreadsArchive, 'hasMore'>> {
|
||||
async getActiveThreads(): Promise<Omit<ReturnThreadsArchive, "hasMore">> {
|
||||
const { threads, members } = await this.session.rest.runMethod<DiscordListActiveThreads>(
|
||||
this.session.rest,
|
||||
"GET",
|
||||
|
@ -1,10 +1,6 @@
|
||||
import type { Model } from "../Base.ts";
|
||||
import type { Session } from "../../Session.ts";
|
||||
import type {
|
||||
DiscordInteraction,
|
||||
DiscordMessage,
|
||||
DiscordMessageComponents,
|
||||
} from "../../../discordeno/mod.ts";
|
||||
import type { DiscordInteraction, DiscordMessage, DiscordMessageComponents } from "../../../discordeno/mod.ts";
|
||||
import type CommandInteraction from "./CommandInteraction.ts";
|
||||
import type PingInteraction from "./PingInteraction.ts";
|
||||
import type ComponentInteraction from "./ComponentInteraction.ts";
|
||||
@ -13,7 +9,7 @@ import type AutoCompleteInteraction from "./AutoCompleteInteraction.ts";
|
||||
import type { CreateMessage } from "../Message.ts";
|
||||
import type { MessageFlags } from "../../Util.ts";
|
||||
import type { EditWebhookMessage } from "../Webhook.ts";
|
||||
import { InteractionTypes, InteractionResponseTypes } from "../../../discordeno/mod.ts";
|
||||
import { InteractionResponseTypes, InteractionTypes } from "../../../discordeno/mod.ts";
|
||||
import { Snowflake } from "../../Snowflake.ts";
|
||||
import User from "../User.ts";
|
||||
import Member from "../Member.ts";
|
||||
@ -22,7 +18,6 @@ import Permsisions from "../Permissions.ts";
|
||||
import Webhook from "../Webhook.ts";
|
||||
import * as Routes from "../../Routes.ts";
|
||||
|
||||
|
||||
/**
|
||||
* @link https://discord.com/developers/docs/interactions/slash-commands#interaction-response
|
||||
*/
|
||||
@ -157,7 +152,7 @@ export abstract class BaseInteraction implements Model {
|
||||
};
|
||||
}),
|
||||
message_id: options.messageId,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (!message || !options.messageId) {
|
||||
@ -184,7 +179,7 @@ export abstract class BaseInteraction implements Model {
|
||||
token: this.token,
|
||||
},
|
||||
messageId,
|
||||
options
|
||||
options,
|
||||
);
|
||||
|
||||
return message;
|
||||
@ -194,10 +189,10 @@ export abstract class BaseInteraction implements Model {
|
||||
await Webhook.prototype.deleteMessage.call(
|
||||
{
|
||||
id: this.session.applicationId,
|
||||
token: this.token
|
||||
token: this.token,
|
||||
},
|
||||
messageId,
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@ -208,7 +203,7 @@ export abstract class BaseInteraction implements Model {
|
||||
token: this.token,
|
||||
},
|
||||
messageId,
|
||||
options
|
||||
options,
|
||||
);
|
||||
|
||||
return message;
|
||||
@ -219,7 +214,9 @@ export abstract class BaseInteraction implements Model {
|
||||
// deno-fmt-ignore
|
||||
async respond(resp: InteractionResponse): Promise<Message | undefined>;
|
||||
async respond(resp: { with: InteractionApplicationCommandCallbackData }): Promise<Message | undefined>;
|
||||
async respond(resp: InteractionResponse | { with: InteractionApplicationCommandCallbackData }): Promise<Message | undefined> {
|
||||
async respond(
|
||||
resp: InteractionResponse | { with: InteractionApplicationCommandCallbackData },
|
||||
): Promise<Message | undefined> {
|
||||
const options = "with" in resp ? resp.with : resp.data;
|
||||
const type = "type" in resp ? resp.type : InteractionResponseTypes.ChannelMessageWithSource;
|
||||
|
||||
|
@ -86,7 +86,7 @@ export class CommandInteractionOptionResolver {
|
||||
properties: Array<keyof CommandInteractionOption>,
|
||||
required: boolean,
|
||||
): CommandInteractionOption | void {
|
||||
const option: (CommandInteractionOption | undefined) = this.get(name, required);
|
||||
const option: CommandInteractionOption | undefined = this.get(name, required);
|
||||
|
||||
if (!option) {
|
||||
return;
|
||||
@ -106,7 +106,7 @@ export class CommandInteractionOptionResolver {
|
||||
get(name: string | number, required: true): CommandInteractionOption;
|
||||
get(name: string | number, required: boolean): CommandInteractionOption | undefined;
|
||||
get(name: string | number, required?: boolean) {
|
||||
const option: (CommandInteractionOption | undefined) = this.hoistedOptions.find((o) =>
|
||||
const option: CommandInteractionOption | undefined = this.hoistedOptions.find((o) =>
|
||||
typeof name === "number" ? o.name === name.toString() : o.name === name
|
||||
);
|
||||
|
||||
@ -125,7 +125,12 @@ export class CommandInteractionOptionResolver {
|
||||
getString(name: string | number, required: true): string;
|
||||
getString(name: string | number, required?: boolean): string | undefined;
|
||||
getString(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.String, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(
|
||||
name,
|
||||
ApplicationCommandOptionTypes.String,
|
||||
["Otherwise"],
|
||||
required,
|
||||
);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -134,7 +139,12 @@ export class CommandInteractionOptionResolver {
|
||||
getNumber(name: string | number, required: true): number;
|
||||
getNumber(name: string | number, required?: boolean): number | undefined;
|
||||
getNumber(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.Number, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(
|
||||
name,
|
||||
ApplicationCommandOptionTypes.Number,
|
||||
["Otherwise"],
|
||||
required,
|
||||
);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -143,7 +153,12 @@ export class CommandInteractionOptionResolver {
|
||||
getInteger(name: string | number, required: true): number;
|
||||
getInteger(name: string | number, required?: boolean): number | undefined;
|
||||
getInteger(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.Integer, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(
|
||||
name,
|
||||
ApplicationCommandOptionTypes.Integer,
|
||||
["Otherwise"],
|
||||
required,
|
||||
);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -152,7 +167,12 @@ export class CommandInteractionOptionResolver {
|
||||
getBoolean(name: string | number, required: true): boolean;
|
||||
getBoolean(name: string | number, required?: boolean): boolean | undefined;
|
||||
getBoolean(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.Boolean, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(
|
||||
name,
|
||||
ApplicationCommandOptionTypes.Boolean,
|
||||
["Otherwise"],
|
||||
required,
|
||||
);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -161,7 +181,9 @@ export class CommandInteractionOptionResolver {
|
||||
getUser(name: string | number, required: true): bigint;
|
||||
getUser(name: string | number, required?: boolean): bigint | undefined;
|
||||
getUser(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.User, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(name, ApplicationCommandOptionTypes.User, [
|
||||
"Otherwise",
|
||||
], required);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -170,7 +192,12 @@ export class CommandInteractionOptionResolver {
|
||||
getChannel(name: string | number, required: true): bigint;
|
||||
getChannel(name: string | number, required?: boolean): bigint | undefined;
|
||||
getChannel(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.Channel, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(
|
||||
name,
|
||||
ApplicationCommandOptionTypes.Channel,
|
||||
["Otherwise"],
|
||||
required,
|
||||
);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -179,7 +206,12 @@ export class CommandInteractionOptionResolver {
|
||||
getMentionable(name: string | number, required: true): string;
|
||||
getMentionable(name: string | number, required?: boolean): string | undefined;
|
||||
getMentionable(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.Mentionable, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(
|
||||
name,
|
||||
ApplicationCommandOptionTypes.Mentionable,
|
||||
["Otherwise"],
|
||||
required,
|
||||
);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -188,7 +220,9 @@ export class CommandInteractionOptionResolver {
|
||||
getRole(name: string | number, required: true): bigint;
|
||||
getRole(name: string | number, required?: boolean): bigint | undefined;
|
||||
getRole(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.Role, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(name, ApplicationCommandOptionTypes.Role, [
|
||||
"Otherwise",
|
||||
], required);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
@ -197,14 +231,19 @@ export class CommandInteractionOptionResolver {
|
||||
getAttachment(name: string | number, required: true): string;
|
||||
getAttachment(name: string | number, required?: boolean): string | undefined;
|
||||
getAttachment(name: string | number, required = false) {
|
||||
const option: (CommandInteractionOption | void) = this.getTypedOption(name, ApplicationCommandOptionTypes.Attachment, ["Otherwise"], required);
|
||||
const option: CommandInteractionOption | void = this.getTypedOption(
|
||||
name,
|
||||
ApplicationCommandOptionTypes.Attachment,
|
||||
["Otherwise"],
|
||||
required,
|
||||
);
|
||||
|
||||
return option?.Otherwise ?? undefined;
|
||||
}
|
||||
|
||||
/** searches for the focused option */
|
||||
getFocused(full = false): string | number | bigint | boolean | undefined | CommandInteractionOption {
|
||||
const focusedOption: (CommandInteractionOption | void) = this.hoistedOptions.find((option) => option.focused);
|
||||
const focusedOption: CommandInteractionOption | void = this.hoistedOptions.find((option) => option.focused);
|
||||
|
||||
if (!focusedOption) {
|
||||
throw new TypeError("No option found");
|
||||
|
@ -2,7 +2,7 @@ import type { Model } from "../Base.ts";
|
||||
import type { Snowflake } from "../../Snowflake.ts";
|
||||
import type { Session } from "../../Session.ts";
|
||||
import type { DiscordInteraction, InteractionTypes } from "../../../discordeno/mod.ts";
|
||||
import { MessageComponentTypes, InteractionResponseTypes } from "../../../discordeno/mod.ts";
|
||||
import { InteractionResponseTypes, MessageComponentTypes } from "../../../discordeno/mod.ts";
|
||||
import BaseInteraction from "./BaseInteraction.ts";
|
||||
import Message from "../Message.ts";
|
||||
|
||||
|
@ -12,14 +12,14 @@ import ModalSubmitInteraction from "./ModalSubmitInteraction.ts";
|
||||
|
||||
/**
|
||||
* @link https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure
|
||||
* */
|
||||
*/
|
||||
export interface MessageInteraction {
|
||||
/** id of the interaction */
|
||||
id: Snowflake;
|
||||
id: Snowflake;
|
||||
/** type of interaction */
|
||||
type: InteractionTypes
|
||||
type: InteractionTypes;
|
||||
/** name of the application command, including subcommands and subcommand groups */
|
||||
name: string
|
||||
name: string;
|
||||
/** user who invoked the interaction */
|
||||
user: User;
|
||||
/** member who invoked the interaction in the guild */
|
||||
@ -49,7 +49,11 @@ export class InteractionFactory {
|
||||
}
|
||||
}
|
||||
|
||||
static fromMessage(session: Session, interaction: DiscordMessageInteraction, _guildId?: Snowflake): MessageInteraction {
|
||||
static fromMessage(
|
||||
session: Session,
|
||||
interaction: DiscordMessageInteraction,
|
||||
_guildId?: Snowflake,
|
||||
): MessageInteraction {
|
||||
const obj = {
|
||||
id: interaction.id,
|
||||
type: interaction.type,
|
||||
|
1
packages/cache/Collection.ts
vendored
1
packages/cache/Collection.ts
vendored
@ -1,4 +1,3 @@
|
||||
|
||||
import type { Session, Snowflake } from "./deps.ts";
|
||||
|
||||
export class Collection<V> extends Map<Snowflake, V> {
|
||||
|
26
packages/cache/channels.ts
vendored
26
packages/cache/channels.ts
vendored
@ -1,10 +1,4 @@
|
||||
import type {
|
||||
ChannelInGuild,
|
||||
ChannelWithMessagesInGuild,
|
||||
ChannelTypes,
|
||||
DiscordChannel,
|
||||
Snowflake,
|
||||
} from "./deps.ts";
|
||||
import type { ChannelInGuild, ChannelTypes, ChannelWithMessagesInGuild, DiscordChannel, Snowflake } from "./deps.ts";
|
||||
import type { CachedMessage } from "./messages.ts";
|
||||
import type { CachedGuild } from "./guilds.ts";
|
||||
import type { SessionCache } from "./mod.ts";
|
||||
@ -30,9 +24,12 @@ export interface CachedDMChannel extends DMChannel {
|
||||
|
||||
export function channelBootstrapper(cache: SessionCache, channel: DiscordChannel) {
|
||||
if (!channel.guild_id) {
|
||||
cache.dms.set(channel.id, Object.assign(new DMChannel(cache.session, channel), {
|
||||
messages: new Collection<CachedMessage>(cache.session),
|
||||
}))
|
||||
cache.dms.set(
|
||||
channel.id,
|
||||
Object.assign(new DMChannel(cache.session, channel), {
|
||||
messages: new Collection<CachedMessage>(cache.session),
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -47,24 +44,23 @@ export function channelBootstrapper(cache: SessionCache, channel: DiscordChannel
|
||||
guildId: channel.guild_id!,
|
||||
get guild(): CachedGuild {
|
||||
return cache.guilds.get(this.guildId)!;
|
||||
}
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
guild.channels.set(
|
||||
channel.id,
|
||||
<CachedGuildChannel>Object.assign(
|
||||
<CachedGuildChannel> Object.assign(
|
||||
ChannelFactory.fromGuildChannel(cache.session, channel),
|
||||
{
|
||||
guildId: channel.guild_id!,
|
||||
get guild(): CachedGuild {
|
||||
return cache.guilds.get(this.guildId)!;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
5
packages/cache/guilds.ts
vendored
5
packages/cache/guilds.ts
vendored
@ -1,7 +1,4 @@
|
||||
import type {
|
||||
DiscordGuild,
|
||||
DiscordMemberWithUser,
|
||||
} from "./deps.ts";
|
||||
import type { DiscordGuild, DiscordMemberWithUser } from "./deps.ts";
|
||||
import type { SessionCache } from "./mod.ts";
|
||||
import type { CachedMember } from "./members.ts";
|
||||
import type { CachedUser } from "./users.ts";
|
||||
|
4
packages/cache/messages.ts
vendored
4
packages/cache/messages.ts
vendored
@ -1,11 +1,11 @@
|
||||
import type {
|
||||
DiscordEmoji,
|
||||
DiscordMessage,
|
||||
DiscordMemberWithUser,
|
||||
DiscordMessage,
|
||||
DiscordMessageReactionAdd,
|
||||
DiscordMessageReactionRemove,
|
||||
DiscordMessageReactionRemoveAll,
|
||||
Snowflake
|
||||
Snowflake,
|
||||
} from "./deps.ts";
|
||||
import type { CachedUser } from "./users.ts";
|
||||
import type { SessionCache } from "./mod.ts";
|
||||
|
6
packages/cache/mod.ts
vendored
6
packages/cache/mod.ts
vendored
@ -7,11 +7,7 @@ import { memberBootstrapper } from "./members.ts";
|
||||
import { userBootstrapper } from "./users.ts";
|
||||
import { channelBootstrapper } from "./channels.ts";
|
||||
import { guildBootstrapper } from "./guilds.ts";
|
||||
import {
|
||||
messageBootstrapper,
|
||||
reactionBootstrapper,
|
||||
reactionBootstrapperDeletions
|
||||
} from "./messages.ts";
|
||||
import { messageBootstrapper, reactionBootstrapper, reactionBootstrapperDeletions } from "./messages.ts";
|
||||
|
||||
export const cache_sym = Symbol("@cache");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user