minor changes (closes #35 and #34)

This commit is contained in:
Yuzu 2022-07-08 01:32:50 -05:00
parent 263e8c53fb
commit 623fa3fb73
129 changed files with 396 additions and 1186 deletions

67
mod.ts
View File

@ -1,65 +1,2 @@
export * from "./structures/Attachment.ts";
export * from "./structures/Base.ts";
export * from "./structures/Embed.ts";
export * from "./structures/Emoji.ts";
export * from "./structures/GuildEmoji.ts";
export * from "./structures/Invite.ts";
export * from "./structures/Member.ts";
export * from "./structures/Message.ts";
export * from "./structures/Permissions.ts";
export * from "./structures/Role.ts";
export * from "./structures/User.ts";
export * from "./structures/WelcomeChannel.ts";
export * from "./structures/WelcomeScreen.ts";
export * from "./structures/channels/BaseChannel.ts";
export * from "./structures/channels/BaseVoiceChannel.ts";
export * from "./structures/channels/ChannelFactory.ts";
export * from "./structures/channels/DMChannel.ts";
export * from "./structures/channels/GuildChannel.ts";
export * from "./structures/channels/NewsChannel.ts";
export * from "./structures/channels/TextChannel.ts";
export * from "./structures/channels/ThreadChannel.ts";
export * from "./structures/channels/StageChannel.ts";
export * from "./structures/channels/VoiceChannel.ts";
export * from "./structures/components/ActionRowComponent.ts";
export * from "./structures/components/ButtonComponent.ts";
export * from "./structures/components/Component.ts";
export * from "./structures/components/LinkButtonComponent.ts";
export * from "./structures/components/SelectMenuComponent.ts";
export * from "./structures/components/TextInputComponent.ts";
export * from "./structures/guilds/AnonymousGuild.ts";
export * from "./structures/guilds/BaseGuild.ts";
export * from "./structures/guilds/Guild.ts";
export * from "./structures/guilds/InviteGuild.ts";
export * from "./structures/builders/EmbedBuilder.ts";
export * from "./structures/builders/InputTextComponentBuilder.ts";
export * from "./structures/builders/MessageActionRow.ts";
export * from "./structures/builders/MessageButton.ts";
export * from "./structures/builders/MessageSelectMenu.ts";
export * from "./structures/builders/SelectMenuOptionBuilder.ts";
export * from "./structures/interactions/AutoCompleteInteraction.ts";
export * from "./structures/interactions/BaseInteraction.ts";
export * from "./structures/interactions/CommandInteraction.ts";
export * from "./structures/interactions/CommandInteractionOptionResolver.ts";
export * from "./structures/interactions/ComponentInteraction.ts";
export * from "./structures/interactions/InteractionFactory.ts";
export * from "./structures/interactions/ModalSubmitInteraction.ts";
export * from "./structures/interactions/PingInteraction.ts";
export * from "./session/Session.ts";
export * from "./util/shared/flags.ts";
export * from "./util/shared/images.ts";
export * from "./util/Snowflake.ts";
export * from "./util/urlToBase64.ts";
export * from "./util/EventEmmiter.ts";
export * from "./util/hash.ts";
export * as Routes from "./util/Routes.ts";
export * as Cdn from "./util/Cdn.ts";
export * from "./vendor/external.ts";
export * from "./packages/biscuit/mod.ts";
export * from "./packages/discordeno/mod.ts";

View File

@ -14,7 +14,6 @@ import type {
DiscordIntegration,
DiscordIntegrationDelete,
DiscordInteraction,
DiscordMemberWithUser,
DiscordMessage,
DiscordMessageDelete,
DiscordMessageReactionAdd,
@ -28,21 +27,26 @@ import type {
DiscordThreadListSync,
DiscordUser,
DiscordWebhookUpdate,
} from "../vendor/external.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { Channel } from "../structures/channels/ChannelFactory.ts";
import type { Interaction } from "../structures/interactions/InteractionFactory.ts";
import ChannelFactory from "../structures/channels/ChannelFactory.ts";
import GuildChannel from "../structures/channels/GuildChannel.ts";
import ThreadChannel from "../structures/channels/ThreadChannel.ts";
import ThreadMember from "../structures/ThreadMember.ts";
import Member from "../structures/Member.ts";
import Message from "../structures/Message.ts";
import User from "../structures/User.ts";
import Integration from "../structures/Integration.ts";
import Guild from "../structures/guilds/Guild.ts";
import InteractionFactory from "../structures/interactions/InteractionFactory.ts";
} from "../discordeno/mod.ts";
import type { Snowflake } from "./Snowflake.ts";
import type { Session } from "./Session.ts";
import type { Channel } from "./structures/channels.ts";
import type { Interaction } from "./structures/interactions/InteractionFactory.ts";
import {
ChannelFactory,
GuildChannel,
ThreadChannel,
} from "./structures/channels.ts";
import ThreadMember from "./structures/ThreadMember.ts";
import Member from "./structures/Member.ts";
import Message from "./structures/Message.ts";
import User from "./structures/User.ts";
import Integration from "./structures/Integration.ts";
import Guild from "./structures/guilds/Guild.ts";
import InteractionFactory from "./structures/interactions/InteractionFactory.ts";
export type RawHandler<T> = (...args: [Session, number, T]) => void;
export type Handler<T extends unknown[]> = (...args: T) => unknown;

View File

@ -1,5 +1,5 @@
import type { Snowflake } from "./Snowflake.ts";
import { baseEndpoints as Endpoints } from "../vendor/external.ts";
import { baseEndpoints as Endpoints } from "../discordeno/mod.ts";
export function USER_AVATAR(userId: Snowflake, icon: string) {
return `${Endpoints.CDN_URL}/avatars/${userId}/${icon}`;

View File

@ -1,13 +1,13 @@
import type { DiscordGetGatewayBot, GatewayBot, GatewayIntents } from "../vendor/external.ts";
import type { DiscordGatewayPayload, Shard } from "../vendor/external.ts";
import type { Events } from "../handlers/Actions.ts";
import type { DiscordGetGatewayBot, GatewayBot, GatewayIntents } from "../discordeno/mod.ts";
import type { DiscordGatewayPayload, Shard } from "../discordeno/mod.ts";
import type { Events } from "./Actions.ts";
import { Snowflake } from "../util/Snowflake.ts";
import { EventEmitter } from "../util/EventEmmiter.ts";
import { createGatewayManager, createRestManager, getBotIdFromToken } from "../vendor/external.ts";
import { Snowflake } from "./Snowflake.ts";
import { EventEmitter } from "./util/EventEmmiter.ts";
import { createGatewayManager, createRestManager, getBotIdFromToken } from "../discordeno/mod.ts";
import * as Routes from "../util/Routes.ts";
import * as Actions from "../handlers/Actions.ts";
import * as Routes from "./Routes.ts";
import * as Actions from "./Actions.ts";
export type DiscordRawEventHandler = (shard: Shard, data: DiscordGatewayPayload) => unknown;

View File

@ -1,9 +1,10 @@
// snowflake type
/** snowflake type */
export type Snowflake = string;
/** Discord epoch */
export const DiscordEpoch = 14200704e5;
// utilities for Snowflakes
/** utilities for Snowflakes */
export const Snowflake = {
snowflakeToTimestamp(id: Snowflake) {
return (Number(id) >> 22) + DiscordEpoch;

83
packages/biscuit/Util.ts Normal file
View File

@ -0,0 +1,83 @@
import type { ButtonBuilder, InputTextBuilder, SelectMenuBuilder } from "./mod.ts";
import type { Permissions } from "./structures/Permissions.ts";
import type { Snowflake } from "./Snowflake.ts";
/*
* @link https://discord.com/developers/docs/resources/channel#message-object-message-flags
*/
export enum MessageFlags {
/** this message has been published to subscribed channels (via Channel Following) */
CrossPosted = 1 << 0,
/** this message originated from a message in another channel (via Channel Following) */
IsCrosspost = 1 << 1,
/** do not include any embeds when serializing this message */
SupressEmbeds = 1 << 2,
/** the source message for this crosspost has been deleted (via Channel Following) */
SourceMessageDeleted = 1 << 3,
/** this message came from the urgent message system */
Urgent = 1 << 4,
/** this message has an associated thread, with the same id as the message */
HasThread = 1 << 5,
/** this message is only visible to the user who invoked the Interaction */
Ephemeral = 1 << 6,
/** this message is an Interaction Response and the bot is "thinking" */
Loading = 1 << 7,
/** this message failed to mention some roles and add their members to the thread */
FailedToMentionSomeRolesInThread = 1 << 8,
}
export type ComponentBuilder =
| InputTextBuilder
| SelectMenuBuilder
| ButtonBuilder;
/***
* Utility type
* */
export type ComponentEmoji = {
id: Snowflake;
name: string;
animated?: boolean;
};
/**
* Utility type
* */
export interface PermissionsOverwrites {
id: Snowflake;
type: 0 | 1;
allow: Permissions;
deny: Permissions;
}
/**
* @link https://discord.com/developers/docs/reference#image-formatting
*/
export type ImageFormat = "jpg" | "jpeg" | "png" | "webp" | "gif" | "json";
/**
* @link https://discord.com/developers/docs/reference#image-formatting
*/
export type ImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
/**
* Utility functions
* */
export class Util {
static formatImageURL(url: string, size: ImageSize = 128, format?: ImageFormat) {
return `${url}.${format || (url.includes("/a_") ? "gif" : "jpg")}?size=${size}`;
}
static iconHashToBigInt(hash: string) {
return BigInt("0x" + (hash.startsWith("a_") ? `a${hash.substring(2)}` : `b${hash}`));
}
static iconBigintToHash(icon: bigint) {
const hash = icon.toString(16);
return hash.startsWith("a") ? `a_${hash.substring(1)}` : hash.substring(1);
}
}
export default Util;

61
packages/biscuit/mod.ts Normal file
View File

@ -0,0 +1,61 @@
// structures
export * from "./structures/Attachment.ts";
export * from "./structures/Base.ts";
export * from "./structures/Embed.ts";
export * from "./structures/Emoji.ts";
export * from "./structures/GuildEmoji.ts";
export * from "./structures/Invite.ts";
export * from "./structures/Member.ts";
export * from "./structures/Message.ts";
export * from "./structures/Permissions.ts";
export * from "./structures/Role.ts";
export * from "./structures/User.ts";
export * from "./structures/WelcomeChannel.ts";
export * from "./structures/WelcomeScreen.ts";
// channels
export * from "./structures/channels.ts";
// components
export * from "./structures/components/ActionRowComponent.ts";
export * from "./structures/components/ButtonComponent.ts";
export * from "./structures/components/Component.ts";
export * from "./structures/components/LinkButtonComponent.ts";
export * from "./structures/components/SelectMenuComponent.ts";
export * from "./structures/components/TextInputComponent.ts";
// guilds
export * from "./structures/guilds/AnonymousGuild.ts";
export * from "./structures/guilds/BaseGuild.ts";
export * from "./structures/guilds/Guild.ts";
export * from "./structures/guilds/InviteGuild.ts";
// builders
export * from "./structures/builders/EmbedBuilder.ts";
export * from "./structures/builders/InputTextComponentBuilder.ts";
export * from "./structures/builders/MessageActionRow.ts";
export * from "./structures/builders/MessageButton.ts";
export * from "./structures/builders/MessageSelectMenu.ts";
export * from "./structures/builders/SelectMenuOptionBuilder.ts";
// interactions
export * from "./structures/interactions/AutoCompleteInteraction.ts";
export * from "./structures/interactions/BaseInteraction.ts";
export * from "./structures/interactions/CommandInteraction.ts";
export * from "./structures/interactions/CommandInteractionOptionResolver.ts";
export * from "./structures/interactions/ComponentInteraction.ts";
export * from "./structures/interactions/InteractionFactory.ts";
export * from "./structures/interactions/ModalSubmitInteraction.ts";
export * from "./structures/interactions/PingInteraction.ts";
// session
export * from "./Session.ts";
// util
export * from "./Util.ts";
export * from "./util/urlToBase64.ts";
export * from "./util/EventEmmiter.ts";
// routes
export * as Routes from "./Routes.ts";
export * as Cdn from "./Cdn.ts";

View File

@ -1,7 +1,7 @@
import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { DiscordAttachment } from "../vendor/external.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
import type { DiscordAttachment } from "../../discordeno/mod.ts";
/**
* Represents an attachment

View File

@ -1,5 +1,5 @@
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
/**
* Represents a Discord data model

View File

@ -1,4 +1,4 @@
import type { DiscordEmbed, EmbedTypes } from "../vendor/external.ts";
import type { DiscordEmbed, EmbedTypes } from "../../discordeno/mod.ts";
export interface Embed {
title?: string;

View File

@ -1,6 +1,6 @@
import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { DiscordEmoji } from "../vendor/external.ts";
import type { Session } from "../Session.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { DiscordEmoji } from "../../discordeno/mod.ts";
export class Emoji {
constructor(session: Session, data: DiscordEmoji) {

View File

@ -1,12 +1,12 @@
import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { DiscordEmoji } from "../vendor/external.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
import type { DiscordEmoji } from "../../discordeno/mod.ts";
import type { ModifyGuildEmoji } from "./guilds/Guild.ts";
import Guild from "./guilds/Guild.ts";
import Emoji from "./Emoji.ts";
import User from "./User.ts";
import * as Routes from "../util/Routes.ts";
import * as Routes from "../Routes.ts";
export class GuildEmoji extends Emoji implements Model {
constructor(session: Session, data: DiscordEmoji, guildId: Snowflake) {

View File

@ -1,7 +1,7 @@
import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { DiscordIntegration, IntegrationExpireBehaviors } from "../vendor/external.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
import type { DiscordIntegration, IntegrationExpireBehaviors } from "../../discordeno/mod.ts";
import User from "./User.ts";
export interface IntegrationAccount {

View File

@ -1,5 +1,5 @@
import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../Session.ts";
import type { Snowflake } from "../Snowflake.ts";
import type {
DiscordChannel,
DiscordInvite,
@ -8,13 +8,13 @@ import type {
ScheduledEventEntityType,
ScheduledEventPrivacyLevel,
ScheduledEventStatus,
} from "../vendor/external.ts";
import { TargetTypes } from "../vendor/external.ts";
} from "../../discordeno/mod.ts";
import { TargetTypes } from "../../discordeno/mod.ts";
import { GuildChannel } from "./channels.ts";
import { Member } from "./Member.ts";
import InviteGuild from "./guilds/InviteGuild.ts";
import User from "./User.ts";
import Guild from "./guilds/Guild.ts";
import { GuildChannel } from "./channels/GuildChannel.ts";
import { Member } from "./Member.ts";
export interface InviteStageInstance {
/** The members speaking in the Stage */

View File

@ -1,14 +1,13 @@
import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { DiscordMemberWithUser } from "../vendor/external.ts";
import type { ImageFormat, ImageSize } from "../util/shared/images.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
import type { DiscordMemberWithUser } from "../../discordeno/mod.ts"
import type { ImageFormat, ImageSize } from "../Util.ts";
import type { CreateGuildBan, ModifyGuildMember } from "./guilds/Guild.ts";
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
import { formatImageURL } from "../util/shared/images.ts";
import Util from "../Util.ts";
import User from "./User.ts";
import Guild from "./guilds/Guild.ts";
import * as Routes from "../util/Routes.ts";
import * as Routes from "../Routes.ts";
/**
* Represents a guild member
@ -20,7 +19,7 @@ export class Member implements Model {
this.session = session;
this.user = new User(session, data.user);
this.guildId = guildId;
this.avatarHash = data.avatar ? iconHashToBigInt(data.avatar) : undefined;
this.avatarHash = data.avatar ? Util.iconHashToBigInt(data.avatar) : undefined;
this.nickname = data.nick ? data.nick : undefined;
this.joinedTimestamp = Number.parseInt(data.joined_at);
this.roles = data.roles;
@ -107,10 +106,10 @@ export class Member implements Model {
if (!this.avatarHash) {
url = Routes.USER_DEFAULT_AVATAR(Number(this.user.discriminator) % 5);
} else {
url = Routes.USER_AVATAR(this.user.id, iconBigintToHash(this.avatarHash));
url = Routes.USER_AVATAR(this.user.id, Util.iconBigintToHash(this.avatarHash));
}
return formatImageURL(url, options.size, options.format);
return Util.formatImageURL(url, options.size, options.format);
}
toString() {

View File

@ -1,5 +1,5 @@
import type { Model } from "./Base.ts";
import type { Session } from "../session/Session.ts";
import type { Session } from "../Session.ts";
import type {
AllowedMentionsTypes,
DiscordEmbed,
@ -8,19 +8,19 @@ import type {
FileContent,
MessageActivityTypes,
MessageTypes,
} from "../vendor/external.ts";
} from "../../discordeno/mod.ts";
import type { Component } from "./components/Component.ts";
import type { GetReactions } from "../util/Routes.ts";
import { MessageFlags } from "../util/shared/flags.ts";
import { iconHashToBigInt } from "../util/hash.ts";
import { Snowflake } from "../util/Snowflake.ts";
import type { GetReactions } from "../Routes.ts";
import { MessageFlags } from "../Util.ts";
import { Snowflake } from "../Snowflake.ts";
import { ThreadChannel } from "./channels.ts";
import Util from "../Util.ts";
import User from "./User.ts";
import Member from "./Member.ts";
import Attachment from "./Attachment.ts";
import ComponentFactory from "./components/ComponentFactory.ts";
import MessageReaction from "./MessageReaction.ts";
// import ThreadChannel from "./channels/ThreadChannel.ts";
import * as Routes from "../util/Routes.ts";
import * as Routes from "../Routes.ts";
/**
* @link https://discord.com/developers/docs/resources/channel#allowed-mentions-object
@ -103,7 +103,7 @@ export class Message implements Model {
this.embeds = data.embeds;
if (data.thread && data.guild_id) {
// this.thread = new ThreadChannel(session, data.thread, data.guild_id);
this.thread = new ThreadChannel(session, data.thread, data.guild_id);
}
// webhook handling
@ -112,7 +112,7 @@ export class Message implements Model {
id: data.webhook_id!,
username: data.author.username,
discriminator: data.author.discriminator,
avatar: data.author.avatar ? iconHashToBigInt(data.author.avatar) : undefined,
avatar: data.author.avatar ? Util.iconHashToBigInt(data.author.avatar) : undefined,
};
}
@ -153,7 +153,7 @@ export class Message implements Model {
attachments: Attachment[];
embeds: DiscordEmbed[];
member?: Member;
// thread?: ThreadChannel;
thread?: ThreadChannel;
components: Component[];
webhook?: WebhookAuthor;
@ -186,6 +186,11 @@ export class Message implements Model {
return `https://discord.com/channels/${this.guildId ?? "@me"}/${this.channelId}/${this.id}`;
}
/** Compatibility with Discordeno */
get isBot() {
return this.author.bot;
}
async pin() {
await this.session.rest.runMethod<undefined>(
this.session.rest,

View File

@ -1,5 +1,5 @@
import type { Session } from "../session/Session.ts";
import type { DiscordReaction } from "../vendor/external.ts";
import type { Session } from "../Session.ts";
import type { DiscordReaction } from "../../discordeno/mod.ts";
import Emoji from "./Emoji.ts";
/**

View File

@ -1,4 +1,4 @@
import { BitwisePermissionFlags } from "../vendor/external.ts";
import { BitwisePermissionFlags } from "../../discordeno/mod.ts";
export type PermissionString = keyof typeof BitwisePermissionFlags;
export type PermissionResolvable =

View File

@ -1,10 +1,10 @@
import type { Model } from "./Base.ts";
import type { DiscordRole } from "../vendor/external.ts";
import type { Session } from "../session/Session.ts";
import { Snowflake } from "../util/Snowflake.ts";
import { iconHashToBigInt } from "../util/hash.ts";
import type { DiscordRole } from "../../discordeno/mod.ts";
import type { Session } from "../Session.ts";
import { Snowflake } from "../Snowflake.ts";
import Permissions from "./Permissions.ts";
import Guild, { ModifyGuildRole } from "./guilds/Guild.ts";
import Util from "../Util.ts";
import Guild, { type ModifyGuildRole } from "./guilds/Guild.ts";
export class Role implements Model {
constructor(session: Session, data: DiscordRole, guildId: Snowflake) {
@ -12,7 +12,7 @@ export class Role implements Model {
this.id = data.id;
this.guildId = guildId;
this.hoist = data.hoist;
this.iconHash = data.icon ? iconHashToBigInt(data.icon) : undefined;
this.iconHash = data.icon ? Util.iconHashToBigInt(data.icon) : undefined;
this.color = data.color;
this.name = data.name;
this.unicodeEmoji = data.unicode_emoji;

View File

@ -1,8 +1,8 @@
import type { Model } from "./Base.ts";
import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { DiscordStageInstance as DiscordAutoClosingStageInstance } from "../vendor/external.ts";
import * as Routes from "../util/Routes.ts";
import type { Session } from "../Session.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { DiscordStageInstance as DiscordAutoClosingStageInstance } from "../../discordeno/mod.ts";
import * as Routes from "../Routes.ts";
interface DiscordStageInstance extends DiscordAutoClosingStageInstance {
privacy_level: PrivacyLevels;

View File

@ -1,8 +1,8 @@
import type { Model } from "./Base.ts";
import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { DiscordThreadMember } from "../vendor/external.ts";
import * as Routes from "../util/Routes.ts";
import type { Session } from "../Session.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { DiscordThreadMember } from "../../discordeno/mod.ts";
import * as Routes from "../Routes.ts";
/**
* A member that comes from a thread

View File

@ -1,11 +1,10 @@
import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { DiscordUser } from "../vendor/external.ts";
import type { ImageFormat, ImageSize } from "../util/shared/images.ts";
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
import { formatImageURL } from "../util/shared/images.ts";
import * as Routes from "../util/Routes.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
import type { DiscordUser } from "../../discordeno/mod.ts";
import type { ImageFormat, ImageSize } from "../Util.ts";
import Util from "../Util.ts";
import * as Routes from "../Routes.ts";
/**
* Represents a user
@ -18,7 +17,7 @@ export class User implements Model {
this.username = data.username;
this.discriminator = data.discriminator;
this.avatarHash = data.avatar ? iconHashToBigInt(data.avatar) : undefined;
this.avatarHash = data.avatar ? Util.iconHashToBigInt(data.avatar) : undefined;
this.accentColor = data.accent_color;
this.bot = !!data.bot;
this.system = !!data.system;
@ -48,10 +47,10 @@ export class User implements Model {
if (!this.avatarHash) {
url = Routes.USER_DEFAULT_AVATAR(Number(this.discriminator) % 5);
} else {
url = Routes.USER_AVATAR(this.id, iconBigintToHash(this.avatarHash));
url = Routes.USER_AVATAR(this.id, Util.iconBigintToHash(this.avatarHash));
}
return formatImageURL(url, options.size, options.format);
return Util.formatImageURL(url, options.size, options.format);
}
toString() {

View File

@ -1,13 +1,13 @@
import type { Model } from "./Base.ts";
import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { DiscordMessage, DiscordWebhook, WebhookTypes } from "../vendor/external.ts";
import type { WebhookOptions } from "../util/Routes.ts";
import type { Session } from "../Session.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { DiscordMessage, DiscordWebhook, WebhookTypes } from "../../discordeno/mod.ts";
import type { WebhookOptions } from "../Routes.ts";
import type { CreateMessage } from "./Message.ts";
import { iconHashToBigInt } from "../util/hash.ts";
import Util from "../Util.ts";
import User from "./User.ts";
import Message from "./Message.ts";
import * as Routes from "../util/Routes.ts";
import * as Routes from "../Routes.ts";
export class Webhook implements Model {
constructor(session: Session, data: DiscordWebhook) {
@ -17,7 +17,7 @@ export class Webhook implements Model {
this.token = data.token;
if (data.avatar) {
this.avatar = iconHashToBigInt(data.avatar);
this.avatar = Util.iconHashToBigInt(data.avatar);
}
if (data.user) {

View File

@ -1,7 +1,7 @@
import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { DiscordWelcomeScreenChannel } from "../vendor/external.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
import type { DiscordWelcomeScreenChannel } from "../../discordeno/mod.ts";
import Emoji from "./Emoji.ts";
/**

View File

@ -1,5 +1,5 @@
import type { Session } from "../session/Session.ts";
import type { DiscordWelcomeScreen } from "../vendor/external.ts";
import type { Session } from "../Session.ts";
import type { DiscordWelcomeScreen } from "../../discordeno/mod.ts";
import WelcomeChannel from "./WelcomeChannel.ts";
/**

View File

@ -1,4 +1,4 @@
import type { DiscordEmbed, DiscordEmbedField, DiscordEmbedProvider } from "../../vendor/external.ts";
import type { DiscordEmbed, DiscordEmbedField, DiscordEmbedProvider } from "../../../discordeno/mod.ts";
export interface EmbedFooter {
text: string;

View File

@ -1,4 +1,4 @@
import { DiscordInputTextComponent, MessageComponentTypes, TextStyles } from "../../vendor/external.ts";
import type { DiscordInputTextComponent, MessageComponentTypes, TextStyles } from "../../../discordeno/mod.ts";
export class InputTextBuilder {
constructor() {

View File

@ -1,7 +1,7 @@
import { MessageComponentTypes } from "../../vendor/external.ts";
import { AnyComponentBuilder } from "../../util/builders.ts";
import type { MessageComponentTypes } from "../../../discordeno/mod.ts";
import type { ComponentBuilder } from "../../Util.ts";
export class ActionRowBuilder<T extends AnyComponentBuilder> {
export class ActionRowBuilder<T extends ComponentBuilder> {
constructor() {
this.components = [] as T[];
this.type = 1;

View File

@ -1,5 +1,5 @@
import { ButtonStyles, type DiscordButtonComponent, MessageComponentTypes } from "../../vendor/external.ts";
import { ComponentEmoji } from "../../util/builders.ts";
import type { ButtonStyles, DiscordButtonComponent, MessageComponentTypes } from "../../../discordeno/mod.ts";
import type { ComponentEmoji } from "../../Util.ts";
export class ButtonBuilder {
constructor() {

View File

@ -1,5 +1,5 @@
import { type DiscordSelectMenuComponent, MessageComponentTypes } from "../../vendor/external.ts";
import { SelectMenuOptionBuilder } from "./SelectMenuOptionBuilder.ts";
import type { DiscordSelectMenuComponent, MessageComponentTypes } from "../../../discordeno/mod.ts";
import type { SelectMenuOptionBuilder } from "./SelectMenuOptionBuilder.ts";
export class SelectMenuBuilder {
constructor() {

View File

@ -1,5 +1,5 @@
import type { DiscordSelectOption } from "../../vendor/external.ts";
import type { ComponentEmoji } from "../../util/builders.ts";
import type { DiscordSelectOption } from "../../../discordeno/mod.ts";
import type { ComponentEmoji } from "../../Util.ts";
export class SelectMenuOptionBuilder {
constructor() {

View File

@ -1,7 +1,8 @@
/** Types */
import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../Snowflake.ts";
import type { Session } from "../Session.ts";
import type { PermissionsOverwrites } from "../Util.ts";
/** External from vendor */
import {
@ -14,22 +15,21 @@ import {
DiscordWebhook,
TargetTypes,
DiscordInviteMetadata,
DiscordThreadMember,
DiscordListArchivedThreads
} from "../vendor/external.ts";
DiscordThreadMember,
DiscordListArchivedThreads
} from "../../discordeno/mod.ts";
/** Functions and others */
import { calculateShardId } from "../vendor/gateway/calculateShardId.ts";
import { calculateShardId } from "../../discordeno/gateway/calculateShardId.ts";
import { urlToBase64 } from "../util/urlToBase64.ts";
/** Classes and routes */
import * as Routes from "../util/Routes.ts";
import * as Routes from "../Routes.ts";
import Message, { CreateMessage, EditMessage, ReactionResolvable } from "./Message.ts";
import Invite from "./Invite.ts";
import Webhook from "./Webhook.ts";
import User from "./User.ts";
import ThreadMember from "./ThreadMember.ts";
import { PermissionsOverwrites } from "../util/permissions.ts";
export abstract class BaseChannel implements Model {
constructor(session: Session, data: DiscordChannel) {

View File

@ -1,7 +1,7 @@
import type { Session } from "../../session/Session.ts";
import type { DiscordComponent } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { DiscordComponent } from "../../../discordeno/mod.ts";
import type { ActionRowComponent, Component } from "./Component.ts";
import { ButtonStyles, MessageComponentTypes } from "../../vendor/external.ts";
import { ButtonStyles, MessageComponentTypes } from "../../../discordeno/mod.ts";
import BaseComponent from "./Component.ts";
import Button from "./ButtonComponent.ts";
import LinkButton from "./LinkButtonComponent.ts";

View File

@ -1,7 +1,7 @@
import type { Session } from "../../session/Session.ts";
import type { ButtonStyles, DiscordComponent } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { ButtonStyles, DiscordComponent } from "../../../discordeno/mod.ts";
import type { ButtonComponent } from "./Component.ts";
import { MessageComponentTypes } from "../../vendor/external.ts";
import { MessageComponentTypes } from "../../../discordeno/mod.ts";
import BaseComponent from "./Component.ts";
import Emoji from "../Emoji.ts";

View File

@ -1,5 +1,5 @@
import type Emoji from "../Emoji.ts";
import { ButtonStyles, MessageComponentTypes, TextStyles } from "../../vendor/external.ts";
import { ButtonStyles, MessageComponentTypes, TextStyles } from "../../../discordeno/mod.ts";
export class BaseComponent {
constructor(type: MessageComponentTypes) {

View File

@ -1,7 +1,7 @@
import type { Session } from "../../session/Session.ts";
import type { DiscordComponent } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { DiscordComponent } from "../../../discordeno/mod.ts"
import type { Component } from "./Component.ts";
import { ButtonStyles, MessageComponentTypes } from "../../vendor/external.ts";
import { ButtonStyles, MessageComponentTypes } from "../../../discordeno/mod.ts";
import ActionRow from "./ActionRowComponent.ts";
import Button from "./ButtonComponent.ts";
import LinkButton from "./ButtonComponent.ts";

View File

@ -1,7 +1,7 @@
import type { Session } from "../../session/Session.ts";
import type { ButtonStyles, DiscordComponent } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { ButtonStyles, DiscordComponent } from "../../../discordeno/mod.ts";
import type { LinkButtonComponent } from "./Component.ts";
import { MessageComponentTypes } from "../../vendor/external.ts";
import { MessageComponentTypes } from "../../../discordeno/mod.ts";
import BaseComponent from "./Component.ts";
import Emoji from "../Emoji.ts";

View File

@ -1,7 +1,7 @@
import type { Session } from "../../session/Session.ts";
import type { DiscordComponent } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { DiscordComponent } from "../../../discordeno/mod.ts";
import type { SelectMenuComponent, SelectMenuOption } from "./Component.ts";
import { MessageComponentTypes } from "../../vendor/external.ts";
import { MessageComponentTypes } from "../../../discordeno/mod.ts";
import BaseComponent from "./Component.ts";
import Emoji from "../Emoji.ts";

View File

@ -1,7 +1,7 @@
import type { Session } from "../../session/Session.ts";
import type { DiscordComponent } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { DiscordComponent } from "../../../discordeno/mod.ts";
import type { TextInputComponent } from "./Component.ts";
import { MessageComponentTypes, TextStyles } from "../../vendor/external.ts";
import { MessageComponentTypes, TextStyles } from "../../../discordeno/mod.ts";
import BaseComponent from "./Component.ts";
export class TextInput extends BaseComponent implements TextInputComponent {

View File

@ -1,19 +1,18 @@
import type { Model } from "../Base.ts";
import type { Session } from "../../session/Session.ts";
import type { DiscordGuild, GuildNsfwLevel, VerificationLevels } from "../../vendor/external.ts";
import type { ImageFormat, ImageSize } from "../../util/shared/images.ts";
import { iconBigintToHash, iconHashToBigInt } from "../../util/hash.ts";
import { formatImageURL } from "../../util/shared/images.ts";
import type { Session } from "../../Session.ts";
import type { DiscordGuild, GuildNsfwLevel, VerificationLevels } from "../../../discordeno/mod.ts";
import type { ImageFormat, ImageSize } from "../../Util.ts";
import Util from "../../Util.ts";
import BaseGuild from "./BaseGuild.ts";
import * as Routes from "../../util/Routes.ts";
import * as Routes from "../../Routes.ts";
export class AnonymousGuild extends BaseGuild implements Model {
constructor(session: Session, data: Partial<DiscordGuild>); // TODO: Improve this type (name and id are required)
constructor(session: Session, data: DiscordGuild) {
super(session, data);
this.splashHash = data.splash ? iconHashToBigInt(data.splash) : undefined;
this.bannerHash = data.banner ? iconHashToBigInt(data.banner) : undefined;
this.splashHash = data.splash ? Util.iconHashToBigInt(data.splash) : undefined;
this.bannerHash = data.banner ? Util.iconHashToBigInt(data.banner) : undefined;
this.verificationLevel = data.verification_level;
this.vanityUrlCode = data.vanity_url_code ? data.vanity_url_code : undefined;
@ -33,8 +32,8 @@ export class AnonymousGuild extends BaseGuild implements Model {
splashURL(options: { size?: ImageSize; format?: ImageFormat } = { size: 128 }) {
if (this.splashHash) {
return formatImageURL(
Routes.GUILD_SPLASH(this.id, iconBigintToHash(this.splashHash)),
return Util.formatImageURL(
Routes.GUILD_SPLASH(this.id, Util.iconBigintToHash(this.splashHash)),
options.size,
options.format,
);
@ -44,7 +43,7 @@ export class AnonymousGuild extends BaseGuild implements Model {
bannerURL(options: { size?: ImageSize; format?: ImageFormat } = { size: 128 }) {
if (this.bannerHash) {
return formatImageURL(
Routes.GUILD_BANNER(this.id, iconBigintToHash(this.bannerHash)),
Routes.GUILD_BANNER(this.id, Util.iconBigintToHash(this.bannerHash)),
options.size,
options.format,
);

View File

@ -1,12 +1,11 @@
import type { Model } from "../Base.ts";
import type { Session } from "../../session/Session.ts";
import type { DiscordGuild } from "../../vendor/external.ts";
import type { ImageFormat, ImageSize } from "../../util/shared/images.ts";
import { formatImageURL } from "../../util/shared/images.ts";
import { iconBigintToHash, iconHashToBigInt } from "../../util/hash.ts";
import { GuildFeatures } from "../../vendor/external.ts";
import { Snowflake } from "../../util/Snowflake.ts";
import * as Routes from "../../util/Routes.ts";
import type { Session } from "../../Session.ts";
import type { DiscordGuild } from "../../../discordeno/mod.ts";
import type { ImageFormat, ImageSize } from "../../Util.ts";
import { GuildFeatures } from "../../../discordeno/mod.ts";
import { Snowflake } from "../../Snowflake.ts";
import Util from "../../Util.ts";
import * as Routes from "../../Routes.ts";
/**
* Class for {@link Guild} and {@link AnonymousGuild}
@ -17,7 +16,7 @@ export abstract class BaseGuild implements Model {
this.id = data.id;
this.name = data.name;
this.iconHash = data.icon ? iconHashToBigInt(data.icon) : undefined;
this.iconHash = data.icon ? Util.iconHashToBigInt(data.icon) : undefined;
this.features = data.features;
}
@ -47,8 +46,8 @@ export abstract class BaseGuild implements Model {
iconURL(options: { size?: ImageSize; format?: ImageFormat } = { size: 128 }) {
if (this.iconHash) {
return formatImageURL(
Routes.GUILD_ICON(this.id, iconBigintToHash(this.iconHash)),
return Util.formatImageURL(
Routes.GUILD_ICON(this.id, Util.iconBigintToHash(this.iconHash)),
options.size,
options.format,
);

View File

@ -1,6 +1,6 @@
import type { Model } from "../Base.ts";
import type { Snowflake } from "../../util/Snowflake.ts";
import type { Session } from "../../session/Session.ts";
import type { Snowflake } from "../../Snowflake.ts";
import type { Session } from "../../Session.ts";
import type {
ChannelTypes,
DiscordEmoji,
@ -14,23 +14,23 @@ import type {
MakeRequired,
SystemChannelFlags,
VideoQualityModes,
} from "../../vendor/external.ts";
import type { GetInvite } from "../../util/Routes.ts";
} from "../../../discordeno/mod.ts";
import type { GetInvite } from "../../Routes.ts";
import {
DefaultMessageNotificationLevels,
ExplicitContentFilterLevels,
VerificationLevels,
} from "../../vendor/external.ts";
import { iconBigintToHash, iconHashToBigInt } from "../../util/hash.ts";
} from "../../../discordeno/mod.ts";
import { encode as _encode, urlToBase64 } from "../../util/urlToBase64.ts";
import { ThreadChannel } from "../channels.ts";
import Util from "../../Util.ts";
import Member from "../Member.ts";
import BaseGuild from "./BaseGuild.ts";
import Role from "../Role.ts";
import GuildEmoji from "../GuildEmoji.ts";
import Invite from "../Invite.ts";
import ThreadMember from "../ThreadMember.ts";
import ThreadChannel from "../channels/ThreadChannel.ts";
import * as Routes from "../../util/Routes.ts";
import * as Routes from "../../Routes.ts";
export interface CreateRole {
name?: string;
@ -200,8 +200,8 @@ export class Guild extends BaseGuild implements Model {
constructor(session: Session, data: DiscordGuild) {
super(session, data);
this.splashHash = data.splash ? iconHashToBigInt(data.splash) : undefined;
this.discoverySplashHash = data.discovery_splash ? iconHashToBigInt(data.discovery_splash) : undefined;
this.splashHash = data.splash ? Util.iconHashToBigInt(data.splash) : undefined;
this.discoverySplashHash = data.discovery_splash ? Util.iconHashToBigInt(data.discovery_splash) : undefined;
this.ownerId = data.owner_id;
this.widgetEnabled = !!data.widget_enabled;
this.widgetChannelId = data.widget_channel_id ? data.widget_channel_id : undefined;
@ -282,7 +282,7 @@ export class Guild extends BaseGuild implements Model {
if (typeof options.iconHash === "string") {
icon = options.iconHash;
} else {
icon = iconBigintToHash(options.iconHash);
icon = Util.iconBigintToHash(options.iconHash);
}
}
@ -519,7 +519,7 @@ export class Guild extends BaseGuild implements Model {
verification_level: options.verificationLevel,
icon: "iconURL" in options
? options.iconURL || urlToBase64(options.iconURL!)
: options.iconHash || iconBigintToHash(options.iconHash!),
: options.iconHash || Util.iconBigintToHash(options.iconHash!),
channels: options.channels?.map((channel) => ({
name: channel.name,
nsfw: channel.nsfw,
@ -561,17 +561,17 @@ export class Guild extends BaseGuild implements Model {
verification_level: options.verificationLevel,
icon: "iconURL" in options
? options.iconURL || urlToBase64(options.iconURL!)
: options.iconHash || iconBigintToHash(options.iconHash!),
: options.iconHash || Util.iconBigintToHash(options.iconHash!),
// extra props
splash: "splashURL" in options
? options.splashURL || urlToBase64(options.splashURL!)
: options.splashHash || iconBigintToHash(options.iconHash!),
: options.splashHash || Util.iconBigintToHash(options.iconHash!),
banner: "bannerURL" in options
? options.bannerURL || urlToBase64(options.bannerURL!)
: options.bannerHash || iconBigintToHash(options.bannerHash!),
: options.bannerHash || Util.iconBigintToHash(options.bannerHash!),
discovery_splash: "discoverySplashURL" in options
? options.discoverySplashURL || urlToBase64(options.discoverySplashURL!)
: options.discoverySplashHash || iconBigintToHash(options.discoverySplashHash!),
: options.discoverySplashHash || Util.iconBigintToHash(options.discoverySplashHash!),
owner_id: options.ownerId,
rules_channel_id: options.rulesChannelId,
public_updates_channel_id: options.publicUpdatesChannelId,

View File

@ -1,6 +1,6 @@
import type { Model } from "../Base.ts";
import type { Session } from "../../session/Session.ts";
import type { DiscordGuild } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { DiscordGuild } from "../../../discordeno/mod.ts";
import AnonymousGuild from "./AnonymousGuild.ts";
import WelcomeScreen from "../WelcomeScreen.ts";

View File

@ -1,11 +1,11 @@
import type { Model } from "../Base.ts";
import type { Snowflake } from "../../util/Snowflake.ts";
import type { Session } from "../../session/Session.ts";
import type { ApplicationCommandTypes, DiscordInteraction, InteractionTypes } from "../../vendor/external.ts";
import type { Snowflake } from "../../Snowflake.ts";
import type { Session } from "../../Session.ts";
import type { ApplicationCommandTypes, DiscordInteraction, InteractionTypes } from "../../../discordeno/mod.ts";
import type { ApplicationCommandOptionChoice } from "./CommandInteraction.ts";
import { InteractionResponseTypes } from "../../vendor/external.ts";
import { InteractionResponseTypes } from "../../../discordeno/mod.ts";
import BaseInteraction from "./BaseInteraction.ts";
import * as Routes from "../../util/Routes.ts";
import * as Routes from "../../Routes.ts";
export class AutoCompleteInteraction extends BaseInteraction implements Model {
constructor(session: Session, data: DiscordInteraction) {

View File

@ -1,10 +1,10 @@
import type { Model } from "../Base.ts";
import type { Session } from "../../session/Session.ts";
import type { DiscordInteraction } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { DiscordInteraction } from "../../../discordeno/mod.ts";
import type CommandInteraction from "./CommandInteraction.ts";
import type PingInteraction from "./PingInteraction.ts";
import { InteractionTypes } from "../../vendor/external.ts";
import { Snowflake } from "../../util/Snowflake.ts";
import { InteractionTypes } from "../../../discordeno/mod.ts";
import { Snowflake } from "../../Snowflake.ts";
import User from "../User.ts";
import Member from "../Member.ts";
import Permsisions from "../Permissions.ts";

View File

@ -1,15 +1,15 @@
import type { Model } from "../Base.ts";
import type { Snowflake } from "../../util/Snowflake.ts";
import type { Session } from "../../session/Session.ts";
import type { Snowflake } from "../../Snowflake.ts";
import type { Session } from "../../Session.ts";
import type {
ApplicationCommandTypes,
DiscordInteraction,
DiscordMemberWithUser,
InteractionTypes,
} from "../../vendor/external.ts";
} from "../../../discordeno/mod.ts";
import type { CreateMessage } from "../Message.ts";
import type { MessageFlags } from "../../util/shared/flags.ts";
import { InteractionResponseTypes } from "../../vendor/external.ts";
import type { MessageFlags } from "../../Util.ts";
import { InteractionResponseTypes } from "../../../discordeno/mod.ts";
import BaseInteraction from "./BaseInteraction.ts";
import CommandInteractionOptionResolver from "./CommandInteractionOptionResolver.ts";
import Attachment from "../Attachment.ts";
@ -18,7 +18,7 @@ import Member from "../Member.ts";
import Message from "../Message.ts";
import Role from "../Role.ts";
import Webhook from "../Webhook.ts";
import * as Routes from "../../util/Routes.ts";
import * as Routes from "../../Routes.ts";
/**
* @link https://discord.com/developers/docs/interactions/slash-commands#interaction-response

View File

@ -1,5 +1,5 @@
import type { DiscordInteractionDataOption, DiscordInteractionDataResolved } from "../../vendor/external.ts";
import { ApplicationCommandOptionTypes } from "../../vendor/external.ts";
import type { DiscordInteractionDataOption, DiscordInteractionDataResolved } from "../../../discordeno/mod.ts";
import { ApplicationCommandOptionTypes } from "../../../discordeno/mod.ts";
export function transformOasisInteractionDataOption(o: DiscordInteractionDataOption): CommandInteractionOption {
const output: CommandInteractionOption = { ...o, Otherwise: o.value as string | boolean | number | undefined };

View File

@ -1,8 +1,8 @@
import type { Model } from "../Base.ts";
import type { Snowflake } from "../../util/Snowflake.ts";
import type { Session } from "../../session/Session.ts";
import type { DiscordInteraction, InteractionTypes } from "../../vendor/external.ts";
import { MessageComponentTypes } from "../../vendor/external.ts";
import type { Snowflake } from "../../Snowflake.ts";
import type { Session } from "../../Session.ts";
import type { DiscordInteraction, InteractionTypes } from "../../../discordeno/mod.ts";
import { MessageComponentTypes } from "../../../discordeno/mod.ts";
import BaseInteraction from "./BaseInteraction.ts";
import Message from "../Message.ts";

View File

@ -1,6 +1,6 @@
import type { Session } from "../../session/Session.ts";
import type { DiscordInteraction } from "../../vendor/external.ts";
import { InteractionTypes } from "../../vendor/external.ts";
import type { Session } from "../../Session.ts";
import type { DiscordInteraction } from "../../../discordeno/mod.ts";
import { InteractionTypes } from "../../../discordeno/mod.ts";
import CommandInteraction from "./CommandInteraction.ts";
import ComponentInteraction from "./ComponentInteraction.ts";
import PingInteraction from "./PingInteraction.ts";

View File

@ -1,12 +1,12 @@
import type { Model } from "../Base.ts";
import type { Snowflake } from "../../util/Snowflake.ts";
import type { Session } from "../../session/Session.ts";
import type { Snowflake } from "../../Snowflake.ts";
import type { Session } from "../../Session.ts";
import type {
DiscordInteraction,
DiscordMessageComponents,
InteractionTypes,
MessageComponentTypes,
} from "../../vendor/external.ts";
} from "../../../discordeno/mod.ts";
import BaseInteraction from "./BaseInteraction.ts";
import Message from "../Message.ts";

View File

@ -1,10 +1,10 @@
import type { Model } from "../Base.ts";
import type { Snowflake } from "../../util/Snowflake.ts";
import type { Session } from "../../session/Session.ts";
import type { ApplicationCommandTypes, DiscordInteraction, InteractionTypes } from "../../vendor/external.ts";
import { InteractionResponseTypes } from "../../vendor/external.ts";
import type { Snowflake } from "../../Snowflake.ts";
import type { Session } from "../../Session.ts";
import type { ApplicationCommandTypes, DiscordInteraction, InteractionTypes } from "../../../discordeno/mod.ts";
import { InteractionResponseTypes } from "../../../discordeno/mod.ts";
import BaseInteraction from "./BaseInteraction.ts";
import * as Routes from "../../util/Routes.ts";
import * as Routes from "../../Routes.ts";
export class PingInteraction extends BaseInteraction implements Model {
constructor(session: Session, data: DiscordInteraction) {

View File

@ -0,0 +1,2 @@
export * from "../mod.ts";
export * from "../../discordeno/mod.ts";

View File

@ -7,71 +7,29 @@ export async function urlToBase64(url: string) {
}
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-fmt-ignore
const base64abc = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"+",
"/",
"A", "B", "C",
"D", "E", "F",
"G", "H", "I",
"J", "K", "L",
"M", "N", "O",
"P", "Q", "R",
"S", "T", "U",
"V", "W", "X",
"Y", "Z", "a",
"b", "c", "d",
"e", "f", "g",
"h", "i", "j",
"k", "l", "m",
"n", "o", "p",
"q", "r", "s",
"t", "u", "v",
"w", "x", "y",
"z", "0", "1",
"2", "3", "4",
"5", "6", "7",
"8", "9", "+", "/",
];
/**

Some files were not shown because too many files have changed in this diff Show More