aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord-akairo
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-11-01 15:40:31 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-11-01 15:40:31 -0400
commit13894f2beffc776a56ac03868613b4313dfb57bf (patch)
tree028c229b42c2a74a3c511386f594385d3ed77dd5 /src/lib/extensions/discord-akairo
parent914c4d3cb7f02a0c74b677e67a47fb66a65fb724 (diff)
downloadtanzanite-13894f2beffc776a56ac03868613b4313dfb57bf.tar.gz
tanzanite-13894f2beffc776a56ac03868613b4313dfb57bf.tar.bz2
tanzanite-13894f2beffc776a56ac03868613b4313dfb57bf.zip
convert to esm
Diffstat (limited to 'src/lib/extensions/discord-akairo')
-rw-r--r--src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts137
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts18
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandHandler.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandUtil.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushInhibitor.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushInhibitorHandler.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushListener.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushListenerHandler.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushSlashMessage.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushTask.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushTaskHandler.ts2
13 files changed, 93 insertions, 84 deletions
diff --git a/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts b/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts
index c07644c..f27fb89 100644
--- a/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts
+++ b/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts
@@ -1,3 +1,3 @@
-import { type BushMessage } from '@lib';
+import { type BushMessage } from '#lib';
export type BushArgumentTypeCaster = (message: BushMessage, phrase: string) => any;
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 8f7533c..6b25aaa 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -1,12 +1,24 @@
+import type {
+ BushApplicationCommand,
+ BushBaseGuildEmojiManager,
+ BushChannel,
+ BushChannelManager,
+ BushClientEvents,
+ BushClientUser,
+ BushGuildManager,
+ BushReactionEmoji,
+ BushUserManager,
+ Config
+} from '#lib';
import * as Sentry from '@sentry/node';
import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo';
import {
- DMChannel,
- Intents, Options,
- Structures, version as discordJsVersion,
+ Intents,
+ Options,
+ Structures,
+ version as discordJsVersion,
type Awaitable,
- type Collection,
- type InteractionReplyOptions,
+ type Collection, type DMChannel, type InteractionReplyOptions,
type Message,
type MessageEditOptions,
type MessageOptions,
@@ -18,66 +30,59 @@ import {
} from 'discord.js';
//@ts-ignore: no typings
import eventsIntercept from 'events-intercept';
-import path from 'path';
+import path, { dirname } from 'path';
import readline from 'readline';
-import { Sequelize } from 'sequelize';
-import { abbreviatedNumberTypeCaster } from '../../../arguments/abbreviatedNumber';
-import { contentWithDurationTypeCaster } from '../../../arguments/contentWithDuration';
-import { discordEmojiTypeCaster } from '../../../arguments/discordEmoji';
-import { durationTypeCaster } from '../../../arguments/duration';
-import { durationSecondsTypeCaster } from '../../../arguments/durationSeconds';
-import { globalUserTypeCaster } from '../../../arguments/globalUser';
-import { permissionTypeCaster } from '../../../arguments/permission';
-import { roleWithDurationTypeCaster } from '../../../arguments/roleWithDuation';
-import { snowflakeTypeCaster } from '../../../arguments/snowflake';
-import UpdateCacheTask from '../../../tasks/updateCache';
-import UpdateStatsTask from '../../../tasks/updateStats';
-import { ActivePunishment } from '../../models/ActivePunishment';
-import { Global } from '../../models/Global';
-import { Guild as GuildModel } from '../../models/Guild';
-import { Level } from '../../models/Level';
-import { ModLog } from '../../models/ModLog';
-import { Stat } from '../../models/Stat';
-import { StickyRole } from '../../models/StickyRole';
-import { AllowedMentions } from '../../utils/AllowedMentions';
-import { BushCache } from '../../utils/BushCache';
-import { BushConstants } from '../../utils/BushConstants';
-import { BushLogger } from '../../utils/BushLogger';
-import { Config } from '../../utils/Config';
-import { BushApplicationCommand } from '../discord.js/BushApplicationCommand';
-import { BushBaseGuildEmojiManager } from '../discord.js/BushBaseGuildEmojiManager';
-import { BushButtonInteraction } from '../discord.js/BushButtonInteraction';
-import { BushCategoryChannel } from '../discord.js/BushCategoryChannel';
-import { BushChannel } from '../discord.js/BushChannel';
-import { BushChannelManager } from '../discord.js/BushChannelManager';
-import { BushClientEvents } from '../discord.js/BushClientEvents';
-import { BushClientUser } from '../discord.js/BushClientUser';
-import { BushCommandInteraction } from '../discord.js/BushCommandInteraction';
-import { BushDMChannel } from '../discord.js/BushDMChannel';
-import { BushGuild } from '../discord.js/BushGuild';
-import { BushGuildEmoji } from '../discord.js/BushGuildEmoji';
-import { BushGuildManager } from '../discord.js/BushGuildManager';
-import { BushGuildMember } from '../discord.js/BushGuildMember';
-import { BushMessage } from '../discord.js/BushMessage';
-import { BushMessageReaction } from '../discord.js/BushMessageReaction';
-import { BushNewsChannel } from '../discord.js/BushNewsChannel';
-import { BushPresence } from '../discord.js/BushPresence';
-import { BushReactionEmoji } from '../discord.js/BushReactionEmoji';
-import { BushRole } from '../discord.js/BushRole';
-import { BushSelectMenuInteraction } from '../discord.js/BushSelectMenuInteraction';
-import { BushStoreChannel } from '../discord.js/BushStoreChannel';
-import { BushTextChannel } from '../discord.js/BushTextChannel';
-import { BushThreadChannel } from '../discord.js/BushThreadChannel';
-import { BushThreadMember } from '../discord.js/BushThreadMember';
-import { BushUser } from '../discord.js/BushUser';
-import { BushUserManager } from '../discord.js/BushUserManager';
-import { BushVoiceChannel } from '../discord.js/BushVoiceChannel';
-import { BushVoiceState } from '../discord.js/BushVoiceState';
-import { BushClientUtil } from './BushClientUtil';
-import { BushCommandHandler } from './BushCommandHandler';
-import { BushInhibitorHandler } from './BushInhibitorHandler';
-import { BushListenerHandler } from './BushListenerHandler';
-import { BushTaskHandler } from './BushTaskHandler';
+import type { Sequelize as SequelizeType } from 'sequelize';
+import { fileURLToPath } from 'url';
+import { abbreviatedNumberTypeCaster } from '../../../arguments/abbreviatedNumber.js';
+import { contentWithDurationTypeCaster } from '../../../arguments/contentWithDuration.js';
+import { discordEmojiTypeCaster } from '../../../arguments/discordEmoji.js';
+import { durationTypeCaster } from '../../../arguments/duration.js';
+import { durationSecondsTypeCaster } from '../../../arguments/durationSeconds.js';
+import { globalUserTypeCaster } from '../../../arguments/globalUser.js';
+import { permissionTypeCaster } from '../../../arguments/permission.js';
+import { roleWithDurationTypeCaster } from '../../../arguments/roleWithDuration.js';
+import { snowflakeTypeCaster } from '../../../arguments/snowflake.js';
+import UpdateCacheTask from '../../../tasks/updateCache.js';
+import UpdateStatsTask from '../../../tasks/updateStats.js';
+import { ActivePunishment } from '../../models/ActivePunishment.js';
+import { Global } from '../../models/Global.js';
+import { Guild as GuildModel } from '../../models/Guild.js';
+import { Level } from '../../models/Level.js';
+import { ModLog } from '../../models/ModLog.js';
+import { Stat } from '../../models/Stat.js';
+import { StickyRole } from '../../models/StickyRole.js';
+import { AllowedMentions } from '../../utils/AllowedMentions.js';
+import { BushCache } from '../../utils/BushCache.js';
+import { BushConstants } from '../../utils/BushConstants.js';
+import { BushLogger } from '../../utils/BushLogger.js';
+import { BushButtonInteraction } from '../discord.js/BushButtonInteraction.js';
+import { BushCategoryChannel } from '../discord.js/BushCategoryChannel.js';
+import { BushCommandInteraction } from '../discord.js/BushCommandInteraction.js';
+import { BushDMChannel } from '../discord.js/BushDMChannel.js';
+import { BushGuild } from '../discord.js/BushGuild.js';
+import { BushGuildEmoji } from '../discord.js/BushGuildEmoji.js';
+import { BushGuildMember } from '../discord.js/BushGuildMember.js';
+import { BushMessage } from '../discord.js/BushMessage.js';
+import { BushMessageReaction } from '../discord.js/BushMessageReaction.js';
+import { BushNewsChannel } from '../discord.js/BushNewsChannel.js';
+import { BushPresence } from '../discord.js/BushPresence.js';
+import { BushRole } from '../discord.js/BushRole.js';
+import { BushSelectMenuInteraction } from '../discord.js/BushSelectMenuInteraction.js';
+import { BushStoreChannel } from '../discord.js/BushStoreChannel.js';
+import { BushTextChannel } from '../discord.js/BushTextChannel.js';
+import { BushThreadChannel } from '../discord.js/BushThreadChannel.js';
+import { BushThreadMember } from '../discord.js/BushThreadMember.js';
+import { BushUser } from '../discord.js/BushUser.js';
+import { BushVoiceChannel } from '../discord.js/BushVoiceChannel.js';
+import { BushVoiceState } from '../discord.js/BushVoiceState.js';
+import { BushClientUtil } from './BushClientUtil.js';
+import { BushCommandHandler } from './BushCommandHandler.js';
+import { BushInhibitorHandler } from './BushInhibitorHandler.js';
+import { BushListenerHandler } from './BushListenerHandler.js';
+import { BushTaskHandler } from './BushTaskHandler.js';
+const { Sequelize } = (await import('sequelize')).default;
+
export type BushReplyMessageType = string | MessagePayload | ReplyMessageOptions;
export type BushEditMessageType = string | MessageEditOptions | MessagePayload;
@@ -110,6 +115,8 @@ const rl = readline.createInterface({
type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B;
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Ready> {
public static init(): void {
Structures.extend('GuildEmoji', () => BushGuildEmoji);
@@ -150,7 +157,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
public contextMenuCommandHandler: ContextMenuCommandHandler;
public declare util: BushClientUtil;
public declare ownerID: Snowflake[];
- public db: Sequelize;
+ public db: SequelizeType;
public logger = BushLogger;
public constants = BushConstants;
public cache = BushCache;
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 4507458..594c9af 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -4,12 +4,19 @@ import {
Global,
type BushCache,
type BushClient,
+ type BushInspectOptions,
type BushMessage,
+ type BushNewsChannel,
+ type BushSlashEditMessageType,
type BushSlashMessage,
+ type BushSlashSendMessageType,
+ type BushTextChannel,
type BushUser,
+ type BushUserResolvable,
+ type CodeBlockLang,
type Pronoun,
type PronounCode
-} from '@lib';
+} from '#lib';
import { exec } from 'child_process';
import { ClientUtil, Util as AkairoUtil } from 'discord-akairo';
import { APIMessage } from 'discord-api-types';
@@ -33,13 +40,8 @@ import humanizeDuration from 'humanize-duration';
import _ from 'lodash';
import moment from 'moment';
import { inspect, promisify } from 'util';
-import CommandErrorListener from '../../../listeners/commands/commandError';
-import { Format } from '../../common/Format';
-import { BushInspectOptions } from '../../common/typings/BushInspectOptions';
-import { CodeBlockLang } from '../../common/typings/CodeBlockLang';
-import { BushNewsChannel } from '../discord.js/BushNewsChannel';
-import { BushTextChannel } from '../discord.js/BushTextChannel';
-import { BushSlashEditMessageType, BushSlashSendMessageType, BushUserResolvable } from './BushClient';
+import CommandErrorListener from '../../../listeners/commands/commandError.js';
+import { Format } from '../../common/Format.js';
export class BushClientUtil extends ClientUtil {
/**
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts
index 40c5974..b079649 100644
--- a/src/lib/extensions/discord-akairo/BushCommand.ts
+++ b/src/lib/extensions/discord-akairo/BushCommand.ts
@@ -1,4 +1,4 @@
-import { type BushClient, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '@lib';
+import { type BushClient, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '#lib';
import { Command, type ArgumentOptions, type ArgumentPromptOptions, type ArgumentTypeCaster, type CommandOptions } from 'discord-akairo';
import { type PermissionResolvable, type Snowflake } from 'discord.js';
diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
index 09cb303..2a74aa4 100644
--- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
@@ -1,4 +1,4 @@
-import { type BushClient, type BushCommand, type BushMessage, type BushSlashMessage } from '@lib';
+import { type BushClient, type BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { CommandHandler, type Category, type CommandHandlerEvents, type CommandHandlerOptions } from 'discord-akairo';
import { type Collection, type PermissionString } from 'discord.js';
diff --git a/src/lib/extensions/discord-akairo/BushCommandUtil.ts b/src/lib/extensions/discord-akairo/BushCommandUtil.ts
index 04533bd..f7dd631 100644
--- a/src/lib/extensions/discord-akairo/BushCommandUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushCommandUtil.ts
@@ -1,4 +1,4 @@
-import { type BushCommand, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '@lib';
+import { type BushCommand, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '#lib';
import { CommandUtil, type ParsedComponentData } from 'discord-akairo';
import { type Collection, type Snowflake } from 'discord.js';
diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts
index 638f663..78563c9 100644
--- a/src/lib/extensions/discord-akairo/BushInhibitor.ts
+++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts
@@ -1,4 +1,4 @@
-import { type BushClient, type BushCommand, type BushMessage, type BushSlashMessage } from '@lib';
+import { type BushClient, type BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { Inhibitor } from 'discord-akairo';
export class BushInhibitor extends Inhibitor {
diff --git a/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts b/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts
index 4984934..a607bf7 100644
--- a/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushInhibitorHandler.ts
@@ -1,4 +1,4 @@
-import { type BushClient } from '@lib';
+import { type BushClient } from '#lib';
import { InhibitorHandler } from 'discord-akairo';
export class BushInhibitorHandler extends InhibitorHandler {
diff --git a/src/lib/extensions/discord-akairo/BushListener.ts b/src/lib/extensions/discord-akairo/BushListener.ts
index e3c845c..28aefe5 100644
--- a/src/lib/extensions/discord-akairo/BushListener.ts
+++ b/src/lib/extensions/discord-akairo/BushListener.ts
@@ -1,4 +1,4 @@
-import { type BushClient } from '@lib';
+import { type BushClient } from '#lib';
import { Listener } from 'discord-akairo';
import type EventEmitter from 'events';
diff --git a/src/lib/extensions/discord-akairo/BushListenerHandler.ts b/src/lib/extensions/discord-akairo/BushListenerHandler.ts
index f5354e4..5a556c3 100644
--- a/src/lib/extensions/discord-akairo/BushListenerHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushListenerHandler.ts
@@ -1,4 +1,4 @@
-import { type BushClient } from '@lib';
+import { type BushClient } from '#lib';
import { ListenerHandler } from 'discord-akairo';
export class BushListenerHandler extends ListenerHandler {
diff --git a/src/lib/extensions/discord-akairo/BushSlashMessage.ts b/src/lib/extensions/discord-akairo/BushSlashMessage.ts
index fd248b1..4e0c297 100644
--- a/src/lib/extensions/discord-akairo/BushSlashMessage.ts
+++ b/src/lib/extensions/discord-akairo/BushSlashMessage.ts
@@ -1,4 +1,4 @@
-import { type BushClient, type BushCommandUtil, type BushGuild, type BushGuildMember, type BushUser } from '@lib';
+import { type BushClient, type BushCommandUtil, type BushGuild, type BushGuildMember, type BushUser } from '#lib';
import { AkairoMessage } from 'discord-akairo';
import { type CommandInteraction } from 'discord.js';
diff --git a/src/lib/extensions/discord-akairo/BushTask.ts b/src/lib/extensions/discord-akairo/BushTask.ts
index 299e977..4a2068d 100644
--- a/src/lib/extensions/discord-akairo/BushTask.ts
+++ b/src/lib/extensions/discord-akairo/BushTask.ts
@@ -1,4 +1,4 @@
-import { type BushClient } from '@lib';
+import { type BushClient } from '#lib';
import { Task, type TaskOptions } from 'discord-akairo';
export class BushTask extends Task {
diff --git a/src/lib/extensions/discord-akairo/BushTaskHandler.ts b/src/lib/extensions/discord-akairo/BushTaskHandler.ts
index 8531ff1..d5ccad6 100644
--- a/src/lib/extensions/discord-akairo/BushTaskHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushTaskHandler.ts
@@ -1,4 +1,4 @@
-import { type BushClient } from '@lib';
+import { type BushClient } from '#lib';
import { TaskHandler, type AkairoHandlerOptions } from 'discord-akairo';
export type BushTaskHandlerOptions = AkairoHandlerOptions;