mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
refactor: imports
This commit is contained in:
parent
ea8174a5f2
commit
de34034ecc
49
mod.ts
49
mod.ts
@ -1,24 +1,37 @@
|
|||||||
export * from "./session/mod.ts";
|
|
||||||
export * from "./util/mod.ts";
|
|
||||||
export * from "./vendor/external.ts";
|
|
||||||
export * from "./structures/User.ts";
|
|
||||||
export * from "./structures/Role.ts";
|
|
||||||
export * from "./structures/Base.ts";
|
|
||||||
export * from "./structures/Guild.ts";
|
|
||||||
export * from "./structures/Member.ts";
|
|
||||||
export * from "./structures/Message.ts";
|
|
||||||
export * from "./structures/BaseGuild.ts";
|
|
||||||
export * from "./structures/Attachment.ts";
|
|
||||||
export * from "./structures/AnonymousGuild.ts";
|
export * from "./structures/AnonymousGuild.ts";
|
||||||
|
export * from "./structures/Attachment.ts";
|
||||||
|
export * from "./structures/Base.ts";
|
||||||
|
export * from "./structures/BaseGuild.ts";
|
||||||
|
export * from "./structures/Channel.ts";
|
||||||
export * from "./structures/DMChannel.ts";
|
export * from "./structures/DMChannel.ts";
|
||||||
export * from "./structures/TextChannel.ts";
|
|
||||||
export * from "./structures/VoiceChannel.ts";
|
|
||||||
export * from "./structures/ThreadChannel.ts";
|
|
||||||
export * from "./structures/NewsChannel.ts";
|
|
||||||
export * from "./structures/Emoji.ts";
|
export * from "./structures/Emoji.ts";
|
||||||
export * from "./structures/VoiceChannel.ts";
|
export * from "./structures/Guild.ts";
|
||||||
|
export * from "./structures/GuildChannel.ts";
|
||||||
export * from "./structures/GuildEmoji.ts";
|
export * from "./structures/GuildEmoji.ts";
|
||||||
export * from "./structures/WelcomeChannel.ts";
|
|
||||||
export * from "./structures/WelcomeScreen.ts";
|
|
||||||
export * from "./structures/Invite.ts";
|
export * from "./structures/Invite.ts";
|
||||||
export * from "./structures/InviteGuild.ts";
|
export * from "./structures/InviteGuild.ts";
|
||||||
|
export * from "./structures/Member.ts";
|
||||||
|
export * from "./structures/Message.ts";
|
||||||
|
export * from "./structures/NewsChannel.ts";
|
||||||
|
export * from "./structures/Permissions.ts";
|
||||||
|
export * from "./structures/Role.ts";
|
||||||
|
export * from "./structures/TextChannel.ts";
|
||||||
|
export * from "./structures/ThreadChannel.ts";
|
||||||
|
export * from "./structures/User.ts";
|
||||||
|
export * from "./structures/VoiceChannel.ts";
|
||||||
|
export * from "./structures/WelcomeChannel.ts";
|
||||||
|
export * from "./structures/WelcomeScreen.ts";
|
||||||
|
|
||||||
|
export * from "./session/Session.ts";
|
||||||
|
export * from "./session/Events.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";
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import type { DiscordGetGatewayBot, GatewayBot, GatewayIntents } from "../vendor/external.ts";
|
import type { DiscordGetGatewayBot, GatewayBot, GatewayIntents } from "../vendor/external.ts";
|
||||||
import type { DiscordRawEventHandler, Events } from "./Events.ts";
|
import type { DiscordRawEventHandler, Events } from "./Events.ts";
|
||||||
|
|
||||||
import { EventEmitter, Routes, Snowflake } from "../util/mod.ts";
|
import { Snowflake } from "../util/Snowflake.ts";
|
||||||
|
import { EventEmitter } from "../util/EventEmmiter.ts";
|
||||||
import { createGatewayManager, createRestManager } from "../vendor/external.ts";
|
import { createGatewayManager, createRestManager } from "../vendor/external.ts";
|
||||||
|
|
||||||
import * as Actions from "../handlers/HandlerManager.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
import * as Actions from "../handlers/Actions.ts";
|
||||||
|
|
||||||
export interface RestOptions {
|
export interface RestOptions {
|
||||||
secretKey?: string;
|
secretKey?: string;
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
export * from "./Session.ts";
|
|
||||||
export * from "./Events.ts";
|
|
@ -2,7 +2,7 @@ import type { Model } from "./Base.ts";
|
|||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordGuild, GuildNsfwLevel, VerificationLevels } from "../vendor/external.ts";
|
import type { DiscordGuild, GuildNsfwLevel, VerificationLevels } from "../vendor/external.ts";
|
||||||
import { iconHashToBigInt } from "../util/hash.ts";
|
import { iconHashToBigInt } from "../util/hash.ts";
|
||||||
import { BaseGuild } from "./BaseGuild.ts";
|
import BaseGuild from "./BaseGuild.ts";
|
||||||
|
|
||||||
export class AnonymousGuild extends BaseGuild implements Model {
|
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: Partial<DiscordGuild>); // TODO: Improve this type (name and id are required)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { Snowflake } from "../util/mod.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/mod.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a Discord data model
|
* Represents a Discord data model
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Model } from "./Base.ts";
|
import type { Model } from "./Base.ts";
|
||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import { ChannelTypes, DiscordChannel } from "../mod.ts";
|
import type { ChannelTypes, DiscordChannel } from "../vendor/external.ts";
|
||||||
|
|
||||||
export abstract class Channel implements Model {
|
export abstract class Channel implements Model {
|
||||||
constructor(session: Session, data: DiscordChannel) {
|
constructor(session: Session, data: DiscordChannel) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordChannel } from "../vendor/external.ts";
|
import type { DiscordChannel } from "../vendor/external.ts";
|
||||||
import { Channel } from "./Channel.ts";
|
import Channel from "./Channel.ts";
|
||||||
import { Routes } from "../util/mod.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
export class DMChannel extends Channel {
|
export class DMChannel extends Channel {
|
||||||
constructor(session: Session, data: DiscordChannel) {
|
constructor(session: Session, data: DiscordChannel) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { DiscordEmoji } from "../mod.ts";
|
import type { DiscordEmoji } from "../vendor/external.ts";
|
||||||
|
|
||||||
export class Emoji {
|
export class Emoji {
|
||||||
constructor(session: Session, data: DiscordEmoji) {
|
constructor(session: Session, data: DiscordEmoji) {
|
||||||
|
@ -9,12 +9,12 @@ import {
|
|||||||
} from "../vendor/external.ts";
|
} from "../vendor/external.ts";
|
||||||
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
|
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
|
||||||
import { urlToBase64 } from "../util/urlToBase64.ts";
|
import { urlToBase64 } from "../util/urlToBase64.ts";
|
||||||
import { Member } from "./Member.ts";
|
import Member from "./Member.ts";
|
||||||
import { BaseGuild } from "./BaseGuild.ts";
|
import BaseGuild from "./BaseGuild.ts";
|
||||||
import { Role } from "./Role.ts";
|
import Role from "./Role.ts";
|
||||||
import { GuildEmoji } from "./GuildEmoji.ts";
|
import GuildEmoji from "./GuildEmoji.ts";
|
||||||
import { Invite } from "./Invite.ts";
|
import Invite from "./Invite.ts";
|
||||||
import { Routes } from "../util/mod.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
export interface CreateRole {
|
export interface CreateRole {
|
||||||
name?: string;
|
name?: string;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordChannel } from "../vendor/external.ts";
|
import type { DiscordChannel } from "../vendor/external.ts";
|
||||||
import { Channel } from "./Channel.ts";
|
import Channel from "./Channel.ts";
|
||||||
import { Routes } from "../util/mod.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
export abstract class GuildChannel extends Channel {
|
export abstract class GuildChannel extends Channel {
|
||||||
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
||||||
|
@ -2,10 +2,10 @@ import type { Snowflake } from "../util/Snowflake.ts";
|
|||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordEmoji } from "../vendor/external.ts";
|
import type { DiscordEmoji } from "../vendor/external.ts";
|
||||||
import type { ModifyGuildEmoji } from "./Guild.ts";
|
import type { ModifyGuildEmoji } from "./Guild.ts";
|
||||||
import { Guild } from "./Guild.ts";
|
import Guild from "./Guild.ts";
|
||||||
import { Emoji } from "./Emoji.ts";
|
import Emoji from "./Emoji.ts";
|
||||||
import { User } from "./User.ts";
|
import User from "./User.ts";
|
||||||
import { Routes } from "../util/mod.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
export class GuildEmoji extends Emoji {
|
export class GuildEmoji extends Emoji {
|
||||||
constructor(session: Session, data: DiscordEmoji, guildId: Snowflake) {
|
constructor(session: Session, data: DiscordEmoji, guildId: Snowflake) {
|
||||||
|
@ -4,8 +4,8 @@ import type { Session } from "../session/Session.ts";
|
|||||||
import type { DiscordMember, MakeRequired } from "../vendor/external.ts";
|
import type { DiscordMember, MakeRequired } from "../vendor/external.ts";
|
||||||
import type { ImageFormat, ImageSize } from "../util/shared/images.ts";
|
import type { ImageFormat, ImageSize } from "../util/shared/images.ts";
|
||||||
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
|
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
|
||||||
import { Routes } from "../util/mod.ts";
|
import User from "./User.ts";
|
||||||
import { User } from "./User.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @link https://discord.com/developers/docs/resources/guild#create-guild-ban
|
* @link https://discord.com/developers/docs/resources/guild#create-guild-ban
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import type { Model } from "./Base.ts";
|
import type { Model } from "./Base.ts";
|
||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/mod.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { AllowedMentionsTypes, DiscordMessage } from "../vendor/external.ts";
|
import type { AllowedMentionsTypes, DiscordMessage } from "../vendor/external.ts";
|
||||||
import { User } from "./User.ts";
|
import { MessageFlags } from "../util/shared/flags.ts";
|
||||||
import { Member } from "./Member.ts";
|
import User from "./User.ts";
|
||||||
import { Attachment } from "./Attachment.ts";
|
import Member from "./Member.ts";
|
||||||
import { MessageFlags, Routes } from "../util/mod.ts";
|
import Attachment from "./Attachment.ts";
|
||||||
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @link https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
* @link https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordChannel } from "../vendor/external.ts";
|
import type { DiscordChannel } from "../vendor/external.ts";
|
||||||
import { TextChannel } from "./TextChannel.ts";
|
import TextChannel from "./TextChannel.ts";
|
||||||
|
|
||||||
export class NewsChannel extends TextChannel {
|
export class NewsChannel extends TextChannel {
|
||||||
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { Model } from "./Base.ts";
|
import type { Model } from "./Base.ts";
|
||||||
import type { DiscordRole } from "../vendor/external.ts";
|
import type { DiscordRole } from "../vendor/external.ts";
|
||||||
|
import type { Session } from "../session/Session.ts";
|
||||||
import { Snowflake } from "../util/Snowflake.ts";
|
import { Snowflake } from "../util/Snowflake.ts";
|
||||||
import { Session } from "../session/Session.ts";
|
|
||||||
import { iconHashToBigInt } from "../util/hash.ts";
|
import { iconHashToBigInt } from "../util/hash.ts";
|
||||||
import { Permissions } from "./Permissions.ts";
|
import Permissions from "./Permissions.ts";
|
||||||
import { Guild } from "./Guild.ts";
|
import Guild from "./Guild.ts";
|
||||||
|
|
||||||
export class Role implements Model {
|
export class Role implements Model {
|
||||||
constructor(session: Session, data: DiscordRole, guildId: Snowflake) {
|
constructor(session: Session, data: DiscordRole, guildId: Snowflake) {
|
||||||
@ -21,9 +21,11 @@ export class Role implements Model {
|
|||||||
this.permissions = new Permissions(BigInt(data.permissions));
|
this.permissions = new Permissions(BigInt(data.permissions));
|
||||||
}
|
}
|
||||||
|
|
||||||
session: Session;
|
readonly session: Session;
|
||||||
id: Snowflake;
|
readonly id: Snowflake;
|
||||||
guildId: Snowflake;
|
|
||||||
|
readonly guildId: Snowflake;
|
||||||
|
|
||||||
hoist: boolean;
|
hoist: boolean;
|
||||||
iconHash?: bigint;
|
iconHash?: bigint;
|
||||||
color: number;
|
color: number;
|
||||||
|
@ -2,12 +2,12 @@ import type { Session } from "../session/Session.ts";
|
|||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { GetMessagesOptions } from "../util/Routes.ts";
|
import type { GetMessagesOptions } from "../util/Routes.ts";
|
||||||
import type { DiscordChannel, DiscordInvite, DiscordMessage, TargetTypes } from "../vendor/external.ts";
|
import type { DiscordChannel, DiscordInvite, DiscordMessage, TargetTypes } from "../vendor/external.ts";
|
||||||
import { GuildChannel } from "./GuildChannel.ts";
|
import GuildChannel from "./GuildChannel.ts";
|
||||||
import { Guild } from "./Guild.ts";
|
import Guild from "./Guild.ts";
|
||||||
import { ThreadChannel } from "./ThreadChannel.ts";
|
import ThreadChannel from "./ThreadChannel.ts";
|
||||||
import { Message } from "./Message.ts";
|
import Message from "./Message.ts";
|
||||||
import { Invite } from "./Invite.ts";
|
import Invite from "./Invite.ts";
|
||||||
import { Routes } from "../util/mod.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the options object to create an invitation
|
* Represents the options object to create an invitation
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordChannel } from "../vendor/external.ts";
|
import type { DiscordChannel } from "../vendor/external.ts";
|
||||||
import { GuildChannel } from "./GuildChannel.ts";
|
import GuildChannel from "./GuildChannel.ts";
|
||||||
|
|
||||||
export class ThreadChannel extends GuildChannel {
|
export class ThreadChannel extends GuildChannel {
|
||||||
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { Model } from "./Base.ts";
|
import type { Model } from "./Base.ts";
|
||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/mod.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordUser } from "../vendor/external.ts";
|
import type { DiscordUser } from "../vendor/external.ts";
|
||||||
import type { ImageFormat, ImageSize } from "../util/shared/images.ts";
|
import type { ImageFormat, ImageSize } from "../util/shared/images.ts";
|
||||||
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
|
import { iconBigintToHash, iconHashToBigInt } from "../util/hash.ts";
|
||||||
import { Routes } from "../util/mod.ts";
|
import * as Routes from "../util/Routes.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a user
|
* Represents a user
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Snowflake } from "../util/Snowflake.ts";
|
import type { Snowflake } from "../util/Snowflake.ts";
|
||||||
import type { Session } from "../session/Session.ts";
|
import type { Session } from "../session/Session.ts";
|
||||||
import type { DiscordChannel, VideoQualityModes } from "../vendor/external.ts";
|
import type { DiscordChannel, VideoQualityModes } from "../vendor/external.ts";
|
||||||
import { GuildChannel } from "./GuildChannel.ts";
|
import GuildChannel from "./GuildChannel.ts";
|
||||||
|
|
||||||
export class VoiceChannel extends GuildChannel {
|
export class VoiceChannel extends GuildChannel {
|
||||||
constructor(session: Session, guildId: Snowflake, data: DiscordChannel) {
|
constructor(session: Session, guildId: Snowflake, data: DiscordChannel) {
|
||||||
|
@ -12,7 +12,7 @@ session.on("ready", (_shardId, payload) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
session.on("messageCreate", (message) => {
|
session.on("messageCreate", (message) => {
|
||||||
if (message.content.startsWith("!ping")) {
|
if (message.content.startsWith("&ping")) {
|
||||||
message.reply({ content: "pong!" });
|
message.reply({ content: "pong!" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
export * from "./EventEmmiter.ts";
|
|
||||||
export * from "./Snowflake.ts";
|
|
||||||
export * from "./hash.ts";
|
|
||||||
export * from "./shared/flags.ts";
|
|
||||||
export * from "./shared/images.ts";
|
|
||||||
export * as Routes from "./Routes.ts";
|
|
Loading…
x
Reference in New Issue
Block a user