aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/info/help.ts14
-rw-r--r--src/commands/utilities/highlight-!.ts7
-rw-r--r--src/commands/utilities/uuid.ts2
-rw-r--r--src/lib/common/typings/BushInspectOptions.ts7
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts4
-rw-r--r--src/lib/utils/BushConstants.ts6
-rw-r--r--src/lib/utils/BushUtils.ts66
-rw-r--r--src/tasks/cache/cpuUsage.ts (renamed from src/tasks/cpuUsage.ts)0
-rw-r--r--src/tasks/cache/updateCache.ts (renamed from src/tasks/updateCache.ts)4
-rw-r--r--src/tasks/cache/updateHighlightCache.ts (renamed from src/tasks/updateHighlightCache.ts)2
-rw-r--r--src/tasks/cache/updatePriceItemCache.ts (renamed from src/tasks/updatePriceItemCache.ts)2
-rw-r--r--src/tasks/feature/handleReminders.ts (renamed from src/tasks/handleReminders.ts)0
-rw-r--r--src/tasks/feature/memberCount.ts (renamed from src/tasks/memberCount.ts)0
-rw-r--r--src/tasks/feature/removeExpiredPunishements.ts (renamed from src/tasks/removeExpiredPunishements.ts)0
-rw-r--r--src/tasks/feature/updateStats.ts (renamed from src/tasks/updateStats.ts)0
15 files changed, 61 insertions, 53 deletions
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index d8d91d5..1a8eae5 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -127,7 +127,7 @@ export default class HelpCommand extends BushCommand {
return message.util.reply(params);
}
- private addCommandUsage(embed: EmbedBuilder, command: BushCommand) {
+ private addCommandUsage(embed: EmbedBuilder, command: BushCommand): void {
if (command.usage?.length) {
embed.addFields({
name: `» Usage${command.usage.length > 1 ? 's' : ''}`,
@@ -136,7 +136,7 @@ export default class HelpCommand extends BushCommand {
}
}
- private addCommandExamples(embed: EmbedBuilder, command: BushCommand) {
+ private addCommandExamples(embed: EmbedBuilder, command: BushCommand): void {
if (command.examples?.length) {
embed.addFields({
name: `» Example${command.examples.length > 1 ? 's' : ''}`,
@@ -145,7 +145,7 @@ export default class HelpCommand extends BushCommand {
}
}
- private addCommandAliases(embed: EmbedBuilder, command: BushCommand) {
+ private addCommandAliases(embed: EmbedBuilder, command: BushCommand): void {
if (command.aliases?.length > 1)
embed.addFields({
name: '» Aliases',
@@ -153,7 +153,7 @@ export default class HelpCommand extends BushCommand {
});
}
- private addCommandArguments(embed: EmbedBuilder, command: BushCommand, isOwner = false, isSuperUser = false) {
+ private addCommandArguments(embed: EmbedBuilder, command: BushCommand, isOwner = false, isSuperUser = false): void {
const format = (id: string, req: boolean) => `${req ? '<' : '['}${id}${req ? '>' : ']'}`;
const args = (command.argsInfo ?? []).filter((arg) => {
if (arg.ownerOnly && !isOwner) return false;
@@ -182,7 +182,7 @@ export default class HelpCommand extends BushCommand {
}
}
- private addCommandRestrictions(embed: EmbedBuilder, command: BushCommand) {
+ private addCommandRestrictions(embed: EmbedBuilder, command: BushCommand): void {
if (
command.ownerOnly ||
command.superUserOnly ||
@@ -209,7 +209,7 @@ export default class HelpCommand extends BushCommand {
}
}
- private addLinks(message: CommandMessage | SlashMessage) {
+ private addLinks(message: CommandMessage | SlashMessage): ActionRowBuilder<ButtonBuilder> {
const row = new ActionRowBuilder<ButtonBuilder>();
const config = this.client.config;
@@ -230,7 +230,7 @@ export default class HelpCommand extends BushCommand {
return row;
}
- public override autocomplete(interaction: AutocompleteInteraction) {
+ public override autocomplete(interaction: AutocompleteInteraction): void {
const aliases = this.handler.modules.map((module) => module.aliases).flat();
const fuzzy = new Fuse(aliases, {
diff --git a/src/commands/utilities/highlight-!.ts b/src/commands/utilities/highlight-!.ts
index a4b8f42..b93f59a 100644
--- a/src/commands/utilities/highlight-!.ts
+++ b/src/commands/utilities/highlight-!.ts
@@ -1,11 +1,6 @@
-import { BushCommand, clientSendAndPermCheck, Highlight, HighlightWord, type SlashMessage } from '#lib';
+import { BushCommand, clientSendAndPermCheck, deepWriteable, Highlight, HighlightWord, type SlashMessage } from '#lib';
import { Flag, type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo';
import { ApplicationCommandOptionType, Constants, type AutocompleteInteraction, type CacheType } from 'discord.js';
-import { DeepWritable } from 'ts-essentials';
-
-function deepWriteable<T>(obj: T): DeepWritable<T> {
- return obj as DeepWritable<T>;
-}
export const highlightSubcommands = deepWriteable({
add: {
diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts
index 44cfeda..3f99e66 100644
--- a/src/commands/utilities/uuid.ts
+++ b/src/commands/utilities/uuid.ts
@@ -49,7 +49,7 @@ export default class UuidCommand extends BushCommand {
message: CommandMessage | SlashMessage,
args: { ign: ArgType<'regex'> | string; dashed: ArgType<'flag'> }
) {
- if (typeof args.ign === 'string') args.ign = { match: /\w{1,16}/im.exec(args.ign)!, matches: [] };
+ if (typeof args.ign === 'string') args.ign = { match: args.ign.match(/\w{1,16}/im)!, matches: [] };
if (!args.ign.match) return await message.util.reply(`${emojis.error} Please enter a valid ign.`);
const readableIGN = args.ign.match[0];
diff --git a/src/lib/common/typings/BushInspectOptions.ts b/src/lib/common/typings/BushInspectOptions.ts
index 608000c..b8a16e1 100644
--- a/src/lib/common/typings/BushInspectOptions.ts
+++ b/src/lib/common/typings/BushInspectOptions.ts
@@ -108,6 +108,13 @@ export interface BushInspectOptions extends InspectOptions {
getters?: 'get' | 'set' | boolean | undefined;
/**
+ * If set to `true`, an underscore is used to separate every three digits in all bigints and numbers.
+ *
+ * @default false
+ */
+ numericSeparator: boolean;
+
+ /**
* Whether or not to inspect strings.
*
* @default false
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 5f63839..286d9cf 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -47,8 +47,8 @@ import type { Options as SequelizeOptions, Sequelize as SequelizeType } from 'se
import { fileURLToPath } from 'url';
import type { Config } from '../../../../config/Config.js';
import { tinyColor } from '../../../arguments/tinyColor.js';
-import UpdateCacheTask from '../../../tasks/updateCache.js';
-import UpdateStatsTask from '../../../tasks/updateStats.js';
+import UpdateCacheTask from '../../../tasks/cache/updateCache.js';
+import UpdateStatsTask from '../../../tasks/feature/updateStats.js';
import { HighlightManager } from '../../common/HighlightManager.js';
import { ActivePunishment } from '../../models/instance/ActivePunishment.js';
import { Guild as GuildDB } from '../../models/instance/Guild.js';
diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts
index 0f9311f..67723e3 100644
--- a/src/lib/utils/BushConstants.ts
+++ b/src/lib/utils/BushConstants.ts
@@ -282,9 +282,9 @@ export const mappings = deepLock({
THREADS_ENABLED: {name: 'Threads Enabled', important: false, emoji: '<:threadsEnabled:869756035345317919>', weight: 26 },
THREADS_ENABLED_TESTING: {name: 'Threads Enabled Testing', important: false, emoji: null, weight: 27 },
[GuildFeature.AnimatedBanner]: { name: 'Animated Banner', important: false, emoji: null, weight: 28 },
- [GuildFeature.HasDirectoryEntry]: { name: 'Has Directory Entry', important: false, emoji: null, weight: 29 },
- [GuildFeature.Hub]: { name: 'Hub', important: false, emoji: null, weight: 30 },
- [GuildFeature.LinkedToHub]: { name: 'Linked To Hub', important: false, emoji: null, weight: 31 },
+ [GuildFeature.HasDirectoryEntry]: { name: 'Has Directory Entry', important: true, emoji: null, weight: 29 },
+ [GuildFeature.Hub]: { name: 'Hub', important: true, emoji: null, weight: 30 },
+ [GuildFeature.LinkedToHub]: { name: 'Linked To Hub', important: true, emoji: null, weight: 31 },
},
regions: {
diff --git a/src/lib/utils/BushUtils.ts b/src/lib/utils/BushUtils.ts
index e3539a1..19260c8 100644
--- a/src/lib/utils/BushUtils.ts
+++ b/src/lib/utils/BushUtils.ts
@@ -28,6 +28,7 @@ import {
type PermissionsString
} from 'discord.js';
import got from 'got';
+import { DeepWritable } from 'ts-essentials';
import { inspect as inspectUtil, promisify } from 'util';
import * as Format from '../common/util/Format.js';
@@ -89,6 +90,25 @@ export async function mcUUID(username: string, dashed = false): Promise<string>
return dashed ? apiRes.uuid : apiRes.uuid.replace(/-/g, '');
}
+export interface UuidRes {
+ uuid: string;
+ username: string;
+ username_history?: { username: string }[] | null;
+ textures: {
+ custom: boolean;
+ slim: boolean;
+ skin: {
+ url: string;
+ data: string;
+ };
+ raw: {
+ value: string;
+ signature: string;
+ };
+ };
+ created_at: string;
+}
+
/**
* Generate defaults for {@link inspect}.
* @param options The options to create defaults with.
@@ -106,7 +126,8 @@ function getDefaultInspectOptions(options?: BushInspectOptions): BushInspectOpti
breakLength: options?.breakLength ?? 80,
compact: options?.compact ?? 3,
sorted: options?.sorted ?? false,
- getters: options?.getters ?? true
+ getters: options?.getters ?? true,
+ numericSeparator: options?.numericSeparator ?? true
};
}
@@ -233,6 +254,11 @@ export function parseDuration(content: string, remove = true): ParsedDuration {
return { duration, content: contentWithoutTime };
}
+export interface ParsedDuration {
+ duration: number | null;
+ content: string | null;
+}
+
/**
* Converts a duration in milliseconds to a human readable form.
* @param duration The duration in milliseconds to convert.
@@ -278,6 +304,8 @@ export function timestamp<D extends Date | undefined | null>(
return `<t:${Math.round(date.getTime() / 1_000)}:${style}>` as unknown as D extends Date ? string : undefined;
}
+export type TimestampStyle = 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R';
+
/**
* Creates a human readable representation between a date and the current time.
* @param date The date to be compared with the current time.
@@ -498,6 +526,11 @@ export async function castDurationContent(
return { duration: res?.duration ?? 0, content: res?.content ?? '' };
}
+export interface ParsedDurationRes {
+ duration: number;
+ content: string;
+}
+
/**
* Casts a string to a the specified argument type.
* @param type The type of the argument to cast to.
@@ -570,33 +603,6 @@ export function formatError(error: Error | any, colors = false): string {
return error.stack;
}
-export interface UuidRes {
- uuid: string;
- username: string;
- username_history?: { username: string }[] | null;
- textures: {
- custom: boolean;
- slim: boolean;
- skin: {
- url: string;
- data: string;
- };
- raw: {
- value: string;
- signature: string;
- };
- };
- created_at: string;
-}
-
-export interface ParsedDuration {
- duration: number | null;
- content: string | null;
+export function deepWriteable<T>(obj: T): DeepWritable<T> {
+ return obj as DeepWritable<T>;
}
-
-export interface ParsedDurationRes {
- duration: number;
- content: string;
-}
-
-export type TimestampStyle = 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R';
diff --git a/src/tasks/cpuUsage.ts b/src/tasks/cache/cpuUsage.ts
index 61e7a54..61e7a54 100644
--- a/src/tasks/cpuUsage.ts
+++ b/src/tasks/cache/cpuUsage.ts
diff --git a/src/tasks/updateCache.ts b/src/tasks/cache/updateCache.ts
index 27df1ca..87636e8 100644
--- a/src/tasks/updateCache.ts
+++ b/src/tasks/cache/updateCache.ts
@@ -1,8 +1,8 @@
import { Time } from '#constants';
import { Global, Guild, Shared, type BushClient } from '#lib';
import type { Client } from 'discord.js';
-import config from '../../config/options.js';
-import { BushTask } from '../lib/extensions/discord-akairo/BushTask.js';
+import config from '../../../config/options.js';
+import { BushTask } from '../../lib/extensions/discord-akairo/BushTask.js';
export default class UpdateCacheTask extends BushTask {
public constructor() {
diff --git a/src/tasks/updateHighlightCache.ts b/src/tasks/cache/updateHighlightCache.ts
index 4677ea7..44ddd90 100644
--- a/src/tasks/updateHighlightCache.ts
+++ b/src/tasks/cache/updateHighlightCache.ts
@@ -1,5 +1,5 @@
import { Time } from '#constants';
-import { BushTask } from '../lib/extensions/discord-akairo/BushTask.js';
+import { BushTask } from '../../lib/extensions/discord-akairo/BushTask.js';
export default class UpdateHighlightCacheTask extends BushTask {
public constructor() {
diff --git a/src/tasks/updatePriceItemCache.ts b/src/tasks/cache/updatePriceItemCache.ts
index 5f68a8c..9809cbd 100644
--- a/src/tasks/updatePriceItemCache.ts
+++ b/src/tasks/cache/updatePriceItemCache.ts
@@ -1,6 +1,6 @@
import { BushTask, Time } from '#lib';
import got from 'got';
-import PriceCommand, { AuctionAverages, Bazaar, LowestBIN } from '../commands/utilities/price.js';
+import PriceCommand, { AuctionAverages, Bazaar, LowestBIN } from '../../commands/utilities/price.js';
export default class UpdatePriceItemCache extends BushTask {
public constructor() {
diff --git a/src/tasks/handleReminders.ts b/src/tasks/feature/handleReminders.ts
index 7863c9a..7863c9a 100644
--- a/src/tasks/handleReminders.ts
+++ b/src/tasks/feature/handleReminders.ts
diff --git a/src/tasks/memberCount.ts b/src/tasks/feature/memberCount.ts
index ea422fa..ea422fa 100644
--- a/src/tasks/memberCount.ts
+++ b/src/tasks/feature/memberCount.ts
diff --git a/src/tasks/removeExpiredPunishements.ts b/src/tasks/feature/removeExpiredPunishements.ts
index 0b20a27..0b20a27 100644
--- a/src/tasks/removeExpiredPunishements.ts
+++ b/src/tasks/feature/removeExpiredPunishements.ts
diff --git a/src/tasks/updateStats.ts b/src/tasks/feature/updateStats.ts
index 0d0e661..0d0e661 100644
--- a/src/tasks/updateStats.ts
+++ b/src/tasks/feature/updateStats.ts