diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-10 22:12:23 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-10 22:12:23 -0500 |
commit | 9923f0751396decaa6febcaa54da9b6ad9b596b1 (patch) | |
tree | 5022a611ae156ff2cd6edb8c124113b539845213 | |
parent | 8928d95b87e036f731c7a65d8646d75f5bb42c93 (diff) | |
download | tanzanite-9923f0751396decaa6febcaa54da9b6ad9b596b1.tar.gz tanzanite-9923f0751396decaa6febcaa54da9b6ad9b596b1.tar.bz2 tanzanite-9923f0751396decaa6febcaa54da9b6ad9b596b1.zip |
fixed lots of shit I think
-rw-r--r-- | src/commands/config/config.ts | 26 | ||||
-rw-r--r-- | src/commands/config/disable.ts | 4 | ||||
-rw-r--r-- | src/commands/dev/reload.ts | 2 | ||||
-rw-r--r-- | src/commands/info/botInfo.ts | 2 | ||||
-rw-r--r-- | src/commands/info/guildInfo.ts | 40 | ||||
-rw-r--r-- | src/commands/info/icon.ts | 2 | ||||
-rw-r--r-- | src/commands/info/pronouns.ts | 4 | ||||
-rw-r--r-- | src/commands/info/snowflake.ts | 58 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 8 | ||||
-rw-r--r-- | src/commands/leveling/level.ts | 9 | ||||
-rw-r--r-- | src/commands/utilities/wolframAlpha.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 4 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 2 | ||||
-rw-r--r-- | src/lib/models/ActivePunishment.ts | 2 | ||||
-rw-r--r-- | src/lib/models/ModLog.ts | 1 | ||||
-rw-r--r-- | src/lib/models/Stat.ts | 1 | ||||
-rw-r--r-- | src/lib/models/StickyRole.ts | 1 | ||||
-rw-r--r-- | src/lib/models/__helpers.ts | 1 | ||||
-rw-r--r-- | src/lib/utils/BushConstants.ts | 12 | ||||
-rw-r--r-- | tsconfig.json | 31 |
20 files changed, 112 insertions, 100 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 99a1147..7811663 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -1,19 +1,19 @@ import { BushCommand, guildSettingsObj, settingsArr, type BushMessage, type BushSlashMessage, type GuildSettings } from '#lib'; import { type ArgumentOptions, type Flag } from 'discord-akairo'; import { - Channel, - Formatters, - GuildMember, - MessageActionRow, - MessageButton, - MessageEmbed, - MessageSelectMenu, - Role, - User, - type Message, - type MessageComponentInteraction, - type MessageOptions, - type Snowflake + Channel, + Formatters, + GuildMember, + MessageActionRow, + MessageButton, + MessageEmbed, + MessageSelectMenu, + Role, + User, + type Message, + type MessageComponentInteraction, + type MessageOptions, + type Snowflake } from 'discord.js'; import _ from 'lodash'; diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index a04850c..83b4608 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -79,7 +79,7 @@ export default class DisableCommand extends BushCommand { .catch(() => false); if (!success) return await message.util.reply({ - content: `${util.emojis.error} There was an error globally **${action.substr( + content: `${util.emojis.error} There was an error globally **${action.substring( 0, action.length - 2 )}ing** the **${commandID}** command.`, @@ -87,7 +87,7 @@ export default class DisableCommand extends BushCommand { }); else return await message.util.reply({ - content: `${util.emojis.success} Successfully **${action.substr( + content: `${util.emojis.success} Successfully **${action.substring( 0, action.length - 2 )}ed** the **${commandID}** command globally.`, diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index cbabb48..f9b1867 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -40,7 +40,7 @@ export default class ReloadCommand extends BushCommand { let output: { stdout: string; stderr: string }; try { const s = new Date(); - output = await util.shell(`yarn build-${/* fast ? 'esbuild' : */ 'tsc'}`); + output = await util.shell(`yarn build:${/* fast ? 'esbuild' : */ 'tsc'}`); await Promise.all([ client.commandHandler.reloadAll(), client.listenerHandler.reloadAll(), diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index f100317..04a1b14 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,7 +1,7 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import { MessageEmbed, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; -import prettyBytes from 'pretty-bytes'; +const {default: prettyBytes} = await import('pretty-bytes') export default class BotInfoCommand extends BushCommand { public constructor() { diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index facbb45..ef1c232 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -1,5 +1,5 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import { Guild, MessageEmbed, type BaseGuildVoiceChannel, type GuildPreview, type Snowflake, type Vanity } from 'discord.js'; +import { Constants, Guild, MessageEmbed, type BaseGuildVoiceChannel, type GuildPreview, type Snowflake, type Vanity } from 'discord.js'; export default class GuildInfoCommand extends BushCommand { public constructor() { @@ -65,15 +65,18 @@ export default class GuildInfoCommand extends BushCommand { if (guild.premiumTier !== 'NONE') emojis.push(otherEmojis[`BOOST_${guild.premiumTier}`]); await guild.fetch(); const channels = guild.channels.cache; - const channelTypes = [ - `${otherEmojis.TEXT} ${channels.filter((channel) => channel.type === 'GUILD_TEXT').size.toLocaleString()}`, - `${otherEmojis.NEWS} ${channels.filter((channel) => channel.type === 'GUILD_NEWS').size.toLocaleString()}`, - `${otherEmojis.VOICE} ${channels.filter((channel) => channel.type === 'GUILD_VOICE').size.toLocaleString()}`, - `${otherEmojis.STAGE} ${channels.filter((channel) => channel.type === 'GUILD_STAGE_VOICE').size.toLocaleString()}`, - `${otherEmojis.STORE} ${channels.filter((channel) => channel.type === 'GUILD_STORE').size.toLocaleString()}`, - `${otherEmojis.CATEGORY} ${channels.filter((channel) => channel.type === 'GUILD_CATEGORY').size.toLocaleString()}`, - `${otherEmojis.THREAD} ${channels.filter((channel) => channel.type.includes('_THREAD')).size.toLocaleString()}` - ]; + + type ChannelType = 'GUILD_TEXT'|'GUILD_NEWS'|'GUILD_VOICE'|'GUILD_STAGE_VOICE'|'GUILD_STORE'|'GUILD_CATEGORY'|'THREAD' + const channelTypes = ([ + 'GUILD_TEXT', + 'GUILD_VOICE', + 'GUILD_STAGE_VOICE', + 'GUILD_STORE', + 'GUILD_CATEGORY', + 'THREAD', + ] as ChannelType[]).map( + (type)=>`${otherEmojis[type]} ${channels.filter((channel) => channel.type.includes(type)).size.toLocaleString()}` + ) const guildRegions = [ ...new Set( @@ -82,7 +85,7 @@ export default class GuildInfoCommand extends BushCommand { ] as RTCRegion[]; guildAbout.push( - `**Owner:** ${guild.members.cache.get(guild.ownerId)?.user.tag}`, + `**Owner:** ${util.discord.escapeMarkdown(guild.members.cache.get(guild.ownerId)?.user.tag ?? '¯\\_(ツ)_/¯')}`, `**Created** ${util.timestamp(guild.createdAt)} (${util.dateDelta(guild.createdAt)})`, `**Members:** ${guild.memberCount.toLocaleString() ?? 0} (${util.emojis.onlineCircle} ${ guild.approximatePresenceCount?.toLocaleString() ?? 0 @@ -91,9 +94,7 @@ export default class GuildInfoCommand extends BushCommand { ); if (guild.premiumSubscriptionCount) guildAbout.push( - `**Boosts:** Level ${guild.premiumTier == 'NONE' ? 0 : guild.premiumTier[5]} with ${ - guild.premiumSubscriptionCount ?? 0 - } boosts` + `**Boosts:** Level ${Constants.PremiumTiers[guild.premiumTier]} with ${guild.premiumSubscriptionCount ?? 0} boosts` ); if (guild.me?.permissions.has('MANAGE_GUILD') && guild.vanityURLCode) { const vanityInfo: Vanity = await guild.fetchVanityData(); @@ -104,16 +105,15 @@ export default class GuildInfoCommand extends BushCommand { if (guild.banner) guildAbout.push(`**Banner:** [link](${guild.bannerURL({ size: 4096, format: 'png' })})`); if (guild.splash) guildAbout.push(`**Splash:** [link](${guild.splashURL({ size: 4096, format: 'png' })})`); + enum EmojiTierMap { TIER_3 = 500, TIER_2 = 300, TIER_1 = 100, NONE = 50 } + enum StickerTierMap { TIER_3 = 60, TIER_2 = 30, TIER_1 = 15, NONE = 0 } + guildStats.push( `**Channels:** ${guild.channels.cache.size.toLocaleString()} / 500 (${channelTypes.join(', ')})`, // subtract 1 for @everyone role `**Roles:** ${((guild.roles.cache.size ?? 0) - 1).toLocaleString()} / 250`, - `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${ - guild.premiumTier === 'TIER_3' ? 500 : guild.premiumTier === 'TIER_2' ? 300 : guild.premiumTier === 'TIER_1' ? 100 : 50 - }`, - `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${ - guild.premiumTier === 'TIER_3' ? 60 : guild.premiumTier === 'TIER_2' ? 30 : guild.premiumTier === 'TIER_1' ? 15 : 0 - }` + `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${EmojiTierMap[guild.premiumTier]}`, + `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${StickerTierMap[guild.premiumTier]}` ); guildSecurity.push( diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index fa4968c..2a04a65 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -29,7 +29,7 @@ export default class IconCommand extends BushCommand { format: 'png' })! ) - .setTitle(message.guild!.name); + .setTitle(util.discord.escapeMarkdown(message.guild!.name)); await message.util.reply({ embeds: [embed] }); } } diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index fbbc5af..a7df5aa 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -44,7 +44,7 @@ export default class PronounsCommand extends BushCommand { const pronouns = await util.getPronounsOf(user); if (!pronouns) { return await message.util.reply( - `${author ? 'You do' : `${user.tag} does`} not appear to have any pronouns set. Please${ + `${author ? 'You do' : `${util.discord.escapeMarkdown(user.tag)} does`} not appear to have any pronouns set. Please${ author ? '' : ' tell them to' } go to https://pronoundb.org/ and set ${author ? 'your' : 'their'} pronouns.` ); @@ -52,7 +52,7 @@ export default class PronounsCommand extends BushCommand { return await message.util.reply({ embeds: [ new MessageEmbed({ - title: `${author ? 'Your' : `${user.tag}'s`} pronouns:`, + title: `${author ? 'Your' : `${util.discord.escapeMarkdown(user.tag)}'s`} pronouns:`, description: pronouns, footer: { text: 'Data provided by https://pronoundb.org/' diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index a6de675..3b1a073 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -1,20 +1,18 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import { - MessageEmbed, - SnowflakeUtil, - VoiceChannel, - type CategoryChannel, - type Channel, - type DeconstructedSnowflake, - type DMChannel, - type Emoji, - type Guild, - type NewsChannel, - type Role, - type Snowflake, - type StageChannel, - type TextChannel, - type User + MessageEmbed, + SnowflakeUtil, + VoiceChannel, + type CategoryChannel, + type Channel, + type DeconstructedSnowflake, + type DMChannel, type Guild, + type NewsChannel, + type Role, + type Snowflake, + type StageChannel, + type TextChannel, + type User } from 'discord.js'; export default class SnowflakeCommand extends BushCommand { @@ -61,8 +59,8 @@ export default class SnowflakeCommand extends BushCommand { const channelInfo = [`**Type:** ${channel.type}`]; if (['dm', 'group'].includes(channel.type)) { const _channel = channel as DMChannel; - channelInfo.push(`**Recipient:** ${_channel.recipient.tag} (${_channel.recipient.id})`); - snowflakeEmbed.setTitle(`:snowflake: DM with ${(channel as DMChannel).recipient.tag} \`[Channel]\``); + channelInfo.push(`**Recipient:** ${util.discord.escapeMarkdown(_channel.recipient.tag)} (${_channel.recipient.id})`); + snowflakeEmbed.setTitle(`:snowflake: DM with ${util.discord.escapeMarkdown((channel as DMChannel).recipient.tag)} \`[Channel]\``); } else if ( [ 'GUILD_CATEGORY', @@ -78,10 +76,10 @@ export default class SnowflakeCommand extends BushCommand { ) { const _channel = channel as TextChannel | VoiceChannel | NewsChannel | StageChannel | CategoryChannel | StageChannel; channelInfo.push( - `**Channel Name:** <#${_channel.id}> (${_channel.name})`, - `**Channel's Server:** ${_channel.guild.name} (${_channel.guild.id})` + `**Channel Name:** <#${_channel.id}> (${util.discord.escapeMarkdown(_channel.name)})`, + `**Channel's Server:** ${util.discord.escapeMarkdown(_channel.guild.name)} (${_channel.guild.id})` ); - snowflakeEmbed.setTitle(`:snowflake: ${_channel.name} \`[Channel]\``); + snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(_channel.name)} \`[Channel]\``); } snowflakeEmbed.addField('» Channel Info', channelInfo.join('\n')); } @@ -90,39 +88,39 @@ export default class SnowflakeCommand extends BushCommand { if (client.guilds.cache.has(snowflake)) { const guild: Guild = client.guilds.cache.get(snowflake)!; const guildInfo = [ - `**Name:** ${guild.name}`, - `**Owner:** ${client.users.cache.get(guild.ownerId)?.tag ?? '¯\\_(ツ)_/¯'} (${guild.ownerId})`, + `**Name:** ${util.discord.escapeMarkdown(guild.name)}`, + `**Owner:** ${util.discord.escapeMarkdown(client.users.cache.get(guild.ownerId)?.tag ?? '¯\\_(ツ)_/¯')} (${guild.ownerId})`, `**Members:** ${guild.memberCount?.toLocaleString()}` ]; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048, dynamic: true })!); snowflakeEmbed.addField('» Server Info', guildInfo.join('\n')); - snowflakeEmbed.setTitle(`:snowflake: ${guild.name} \`[Server]\``); + snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(guild.name)} \`[Server]\``); } // User const fetchedUser = await client.users.fetch(`${snowflake}`).catch(() => undefined); if (client.users.cache.has(snowflake) || fetchedUser) { const user: User = (client.users.cache.get(snowflake) ?? fetchedUser)!; - const userInfo = [`**Name:** <@${user.id}> (${user.tag})`]; + const userInfo = [`**Name:** <@${user.id}> (${util.discord.escapeMarkdown(user.tag)})`]; if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048, dynamic: true })!); snowflakeEmbed.addField('» User Info', userInfo.join('\n')); - snowflakeEmbed.setTitle(`:snowflake: ${user.tag} \`[User]\``); + snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(user.tag)} \`[User]\``); } // Emoji if (client.emojis.cache.has(snowflake)) { - const emoji: Emoji = client.emojis.cache.get(snowflake)!; - const emojiInfo = [`**Name:** ${emoji.name}`, `**Animated:** ${emoji.animated}`]; + const emoji = client.emojis.cache.get(snowflake)!; + const emojiInfo = [`**Name:** ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')}`, `**Animated:** ${emoji.animated}`]; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); snowflakeEmbed.addField('» Emoji Info', emojiInfo.join('\n')); - snowflakeEmbed.setTitle(`:snowflake: ${emoji.name} \`[Emoji]\``); + snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} \`[Emoji]\``); } // Role if (message.guild && message.guild.roles.cache.has(snowflake)) { const role: Role = message.guild.roles.cache.get(snowflake)!; const roleInfo = [ - `**Name:** <@&${role.id}> (${role.name})`, + `**Name:** <@&${role.id}> (${util.discord.escapeMarkdown(role.name)})`, `**Members:** ${role.members.size}`, `**Hoisted:** ${role.hoist}`, `**Managed:** ${role.managed}`, @@ -131,7 +129,7 @@ export default class SnowflakeCommand extends BushCommand { ]; if (role.color) snowflakeEmbed.setColor(role.color); snowflakeEmbed.addField('» Role Info', roleInfo.join('\n')); - snowflakeEmbed.setTitle(`:snowflake: ${role.name} \`[Role]\``); + snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(role.name)} \`[Role]\``); } // SnowflakeInfo diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 2b87d0b..49c23c9 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -52,9 +52,9 @@ export default class UserInfoCommand extends BushCommand { await user.fetch(true); // gets banner info and accent color const userEmbed: MessageEmbed = new MessageEmbed() - .setTitle(user.tag) + .setTitle(util.discord.escapeMarkdown(user.tag)) .setThumbnail( - user.avatarURL({ size: 2048, format: 'png', dynamic: true }) ?? 'https://cdn.discordapp.com/embed/avatars/0.png' + user.displayAvatarURL({ size: 2048, format: 'png', dynamic: true }) ) .setTimestamp(); @@ -112,7 +112,7 @@ export default class UserInfoCommand extends BushCommand { serverUserInfo.push(`**General Deletions:** 1⅓`); if (['384620942577369088', '496409778822709251'].includes(user.id) && message.guild?.id == client.consts.mappings.guilds.bush) serverUserInfo.push(`**General Deletions:** ⅓`); - if (member?.nickname) serverUserInfo.push(`**Nickname:** ${member?.nickname}`); + if (member?.nickname) serverUserInfo.push(`**Nickname:** ${util.discord.escapeMarkdown(member?.nickname)}`); if (serverUserInfo.length) userEmbed.addField('» Server Info', serverUserInfo.join('\n')).setColor(member?.displayColor ?? util.colors.default); @@ -137,7 +137,7 @@ export default class UserInfoCommand extends BushCommand { presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${util.oxford(devices, 'and', '')}`); if (activitiesNames.length) presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`); - if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${customStatus}`); + if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${util.discord.escapeMarkdown(customStatus)}`); userEmbed.addField('» Presence', presenceInfo.join('\n')); enum statusEmojis { diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index 0da0bf0..ea77124 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -11,8 +11,11 @@ import { import canvas from 'canvas'; import { MessageAttachment } from 'discord.js'; import got from 'got'; -import { join } from 'path'; -import SimplifyNumber from 'simplify-number'; +import { dirname, join } from 'path'; +import { fileURLToPath } from 'url'; + +// idk why I need to do default twice, it is being weird +const { default: SimplifyNumber } = ((await import('simplify-number')).default as unknown as typeof import('simplify-number')); export default class LevelCommand extends BushCommand { public constructor() { @@ -89,7 +92,7 @@ export default class LevelCommand extends BushCommand { gray = '#23272A', highlight = user.hexAccentColor ?? '#5865F2'; // Load roboto font - canvas.registerFont(join(__dirname, '..', '..', '..', '..', 'lib', 'assets', 'Roboto-Regular.ttf'), { + canvas.registerFont(join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', 'lib', 'assets', 'Roboto-Regular.ttf'), { family: 'Roboto' }); // Create image canvas diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index bc5f939..aba0f57 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -1,6 +1,6 @@ import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import { MessageEmbed, type MessageOptions } from 'discord.js'; -import WolframAlphaAPI from 'wolfram-alpha-api'; +const {default: WolframAlphaAPI} = (await import("wolfram-alpha-api")).default as unknown as typeof import( "wolfram-alpha-api") export default class WolframAlphaCommand extends BushCommand { public constructor() { diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index c2d8970..39eff3b 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -30,7 +30,7 @@ import { } from 'discord.js'; //@ts-ignore: no typings import eventsIntercept from 'events-intercept'; -import path, { dirname } from 'path'; +import path from 'path'; import readline from 'readline'; import type { Sequelize as SequelizeType } from 'sequelize'; import { fileURLToPath } from 'url'; @@ -114,7 +114,7 @@ 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)); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Ready> { public declare channels: BushChannelManager; diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 594c9af..f619b4b 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -36,12 +36,12 @@ import { type UserResolvable } from 'discord.js'; import got from 'got'; -import humanizeDuration from 'humanize-duration'; import _ from 'lodash'; import moment from 'moment'; import { inspect, promisify } from 'util'; import CommandErrorListener from '../../../listeners/commands/commandError.js'; import { Format } from '../../common/Format.js'; +const { default: humanizeDuration } = await import ('humanize-duration') export class BushClientUtil extends ClientUtil { /** diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index 23dd33b..ec1b500 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -2,10 +2,8 @@ import { type Snowflake } from 'discord.js'; import { nanoid } from 'nanoid'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; - const { DataTypes } = (await import('sequelize')).default - export enum ActivePunishmentType { BAN = 'BAN', MUTE = 'MUTE', diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index 757ee66..bb1be8c 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -3,7 +3,6 @@ import { nanoid } from 'nanoid'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonBoolean } from './__helpers.js'; - const { DataTypes } = (await import('sequelize')).default export enum ModLogType { diff --git a/src/lib/models/Stat.ts b/src/lib/models/Stat.ts index c5f02b8..31111df 100644 --- a/src/lib/models/Stat.ts +++ b/src/lib/models/Stat.ts @@ -1,7 +1,6 @@ import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonBigint } from './__helpers.js'; - const { DataTypes } = (await import('sequelize')).default type Environment = 'production' | 'development' | 'beta'; diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index a6f604d..63c9726 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -2,7 +2,6 @@ import { type Snowflake } from 'discord.js'; import { type Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel.js'; import { jsonArray } from './__helpers.js'; - const { DataTypes } = (await import('sequelize')).default export interface StickyRoleModel { diff --git a/src/lib/models/__helpers.ts b/src/lib/models/__helpers.ts index 3b7f4a4..8c98d5b 100644 --- a/src/lib/models/__helpers.ts +++ b/src/lib/models/__helpers.ts @@ -2,7 +2,6 @@ import { type Model } from 'sequelize'; const { DataTypes } = (await import('sequelize')).default - export function jsonParseGet(this: Model, key: string): any { return JSON.parse(this.getDataValue(key)); } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index cc7673e..c48f7d7 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -199,12 +199,12 @@ export class BushConstants { BOOST_TIER_1: '<:boostitle:853363736679940127>', BOOST_TIER_2: '<:boostitle:853363752728789075>', BOOST_TIER_3: '<:boostitle:853363769132056627>', - TEXT: '<:text:853375537791893524>', - NEWS: '<:announcements:853375553531674644>', - VOICE: '<:voice:853375566735212584>', - STAGE: '<:stage:853375583521210468>', - STORE: '<:store:853375601175691266>', - CATEGORY: '<:category:853375615260819476>', + GUILD_TEXT: '<:text:853375537791893524>', + GUILD_NEWS: '<:announcements:853375553531674644>', + GUILD_VOICE: '<:voice:853375566735212584>', + GUILD_STAGE_VOICE: '<:stage:853375583521210468>', + GUILD_STORE: '<:store:853375601175691266>', + GUILD_CATEGORY: '<:category:853375615260819476>', THREAD: '<:thread:865033845753249813>' }, diff --git a/tsconfig.json b/tsconfig.json index 482709d..bdaa1ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,13 @@ "target": "ESNext", "moduleResolution": "Node", "outDir": "dist", - "lib": ["esnext", "esnext.array", "esnext.asyncIterable", "esnext.intl", "esnext.symbol"], + "lib": [ + "esnext", + "esnext.array", + "esnext.asyncIterable", + "esnext.intl", + "esnext.symbol" + ], "sourceMap": true, // "inlineSourceMap": true, // "inlineSources": true, @@ -20,15 +26,26 @@ "forceConsistentCasingInFileNames": true, "noEmitHelpers": true, "importHelpers": true, - "esModuleInterop": true, + "allowSyntheticDefaultImports": true, // "importsNotUsedAsValues": "error", "preserveValueImports": true, "removeComments": true, "paths": { - "#lib": ["./src/lib/index.js"], - "#root/*": ["./*"] + "#lib": [ + "./src/lib/index.js" + ], + "#root/*": [ + "./*" + ] } }, - "include": ["src/**/*.ts", "lib/**/*.ts", "ecosystem.config.cjs"], - "exclude": ["dist", "node_modules"] -} + "include": [ + "src/**/*.ts", + "lib/**/*.ts", + "ecosystem.config.cjs" + ], + "exclude": [ + "dist", + "node_modules" + ] +}
\ No newline at end of file |