aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arguments/abbreviatedNumber.ts13
-rw-r--r--src/arguments/contentWithDuration.ts5
-rw-r--r--src/arguments/discordEmoji.ts14
-rw-r--r--src/arguments/duration.ts5
-rw-r--r--src/arguments/durationSeconds.ts6
-rw-r--r--src/arguments/globalUser.ts7
-rw-r--r--src/arguments/index.ts10
-rw-r--r--src/arguments/messageLink.ts20
-rw-r--r--src/arguments/permission.ts12
-rw-r--r--src/arguments/roleWithDuration.ts17
-rw-r--r--src/arguments/snowflake.ts8
-rw-r--r--src/arguments/tinyColor.ts10
-rw-r--r--src/bot.ts6
-rw-r--r--src/commands/admin/channelPermissions.ts2
-rw-r--r--src/commands/dev/test.ts6
-rw-r--r--src/commands/info/help.ts2
-rw-r--r--src/commands/moderation/massEvidence.ts2
-rw-r--r--src/commands/moderation/myLogs.ts2
-rw-r--r--src/commands/moderation/unmute.ts2
-rw-r--r--src/commands/moulberry-bush/neuRepo.ts2
-rw-r--r--src/commands/moulberry-bush/rule.ts2
-rw-r--r--src/commands/utilities/calculator.ts2
-rw-r--r--src/commands/utilities/highlight-block.ts2
-rw-r--r--src/commands/utilities/highlight-unblock.ts2
-rw-r--r--src/commands/utilities/uuid.ts2
-rw-r--r--src/commands/utilities/wolframAlpha.ts2
-rw-r--r--src/context-menu-commands/message/viewRaw.ts2
-rw-r--r--src/context-menu-commands/user/modlog.ts2
-rw-r--r--src/context-menu-commands/user/userInfo.ts2
-rw-r--r--src/lib/badlinks.ts6930
-rw-r--r--src/lib/badwords.ts752
-rw-r--r--src/lib/common/AutoMod.ts529
-rw-r--r--src/lib/common/ButtonPaginator.ts219
-rw-r--r--src/lib/common/ConfirmationPrompt.ts64
-rw-r--r--src/lib/common/DeleteButton.ts78
-rw-r--r--src/lib/common/HighlightManager.ts485
-rw-r--r--src/lib/common/Sentry.ts24
-rw-r--r--src/lib/common/tags.ts34
-rw-r--r--src/lib/common/typings/BushInspectOptions.ts123
-rw-r--r--src/lib/common/typings/CodeBlockLang.ts311
-rw-r--r--src/lib/common/util/Arg.ts192
-rw-r--r--src/lib/common/util/Format.ts119
-rw-r--r--src/lib/common/util/Minecraft.ts349
-rw-r--r--src/lib/common/util/Minecraft_Test.ts86
-rw-r--r--src/lib/common/util/Moderation.ts556
-rw-r--r--src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts3
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts586
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts586
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandHandler.ts37
-rw-r--r--src/lib/extensions/discord-akairo/BushInhibitor.ts19
-rw-r--r--src/lib/extensions/discord-akairo/BushInhibitorHandler.ts3
-rw-r--r--src/lib/extensions/discord-akairo/BushListener.ts3
-rw-r--r--src/lib/extensions/discord-akairo/BushListenerHandler.ts3
-rw-r--r--src/lib/extensions/discord-akairo/BushTask.ts3
-rw-r--r--src/lib/extensions/discord-akairo/BushTaskHandler.ts3
-rw-r--r--src/lib/extensions/discord-akairo/SlashMessage.ts3
-rw-r--r--src/lib/extensions/discord.js/BushClientEvents.ts200
-rw-r--r--src/lib/extensions/discord.js/ExtendedGuild.ts916
-rw-r--r--src/lib/extensions/discord.js/ExtendedGuildMember.ts1255
-rw-r--r--src/lib/extensions/discord.js/ExtendedMessage.ts12
-rw-r--r--src/lib/extensions/discord.js/ExtendedUser.ts35
-rw-r--r--src/lib/extensions/global.ts13
-rw-r--r--src/lib/index.ts53
-rw-r--r--src/lib/models/BaseModel.ts13
-rw-r--r--src/lib/models/instance/ActivePunishment.ts94
-rw-r--r--src/lib/models/instance/Guild.ts422
-rw-r--r--src/lib/models/instance/Highlight.ts81
-rw-r--r--src/lib/models/instance/Level.ts70
-rw-r--r--src/lib/models/instance/ModLog.ts127
-rw-r--r--src/lib/models/instance/Reminder.ts84
-rw-r--r--src/lib/models/instance/StickyRole.ts58
-rw-r--r--src/lib/models/shared/Global.ts67
-rw-r--r--src/lib/models/shared/GuildCount.ts39
-rw-r--r--src/lib/models/shared/MemberCount.ts38
-rw-r--r--src/lib/models/shared/Shared.ts84
-rw-r--r--src/lib/models/shared/Stat.ts72
-rw-r--r--src/lib/utils/AllowedMentions.ts68
-rw-r--r--src/lib/utils/BushCache.ts26
-rw-r--r--src/lib/utils/BushClientUtils.ts498
-rw-r--r--src/lib/utils/BushConstants.ts531
-rw-r--r--src/lib/utils/BushLogger.ts315
-rw-r--r--src/lib/utils/BushUtils.ts612
-rw-r--r--src/lib/utils/CanvasProgressBar.ts83
-rw-r--r--src/listeners/automod/automodCreate.ts (renamed from src/listeners/message/automodCreate.ts)5
-rw-r--r--src/listeners/automod/automodUpdate.ts (renamed from src/listeners/message/automodUpdate.ts)6
-rw-r--r--src/listeners/automod/memberAutomod.ts21
-rw-r--r--src/listeners/automod/presenceAutomod.ts27
-rw-r--r--src/listeners/commands/commandError.ts4
-rw-r--r--src/listeners/interaction/interactionCreate.ts4
-rw-r--r--src/listeners/member-custom/bushLevelUpdate.ts6
-rw-r--r--src/tasks/cache/updateCache.ts4
-rw-r--r--src/tasks/cache/updateHighlightCache.ts4
-rw-r--r--src/tasks/cache/updatePriceItemCache.ts7
-rw-r--r--src/tasks/feature/handleReminders.ts3
-rw-r--r--src/tasks/stats/guildCount.ts2
-rw-r--r--src/tsconfig.json9
96 files changed, 106 insertions, 18131 deletions
diff --git a/src/arguments/abbreviatedNumber.ts b/src/arguments/abbreviatedNumber.ts
deleted file mode 100644
index a7d8ce5..0000000
--- a/src/arguments/abbreviatedNumber.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import type { BushArgumentTypeCaster } from '#lib';
-import assert from 'assert/strict';
-import numeral from 'numeral';
-assert(typeof numeral === 'function');
-
-export const abbreviatedNumber: BushArgumentTypeCaster<number | null> = (_, phrase) => {
- if (!phrase) return null;
- const num = numeral(phrase?.toLowerCase()).value();
-
- if (typeof num !== 'number' || isNaN(num)) return null;
-
- return num;
-};
diff --git a/src/arguments/contentWithDuration.ts b/src/arguments/contentWithDuration.ts
deleted file mode 100644
index 0efba39..0000000
--- a/src/arguments/contentWithDuration.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { parseDuration, type BushArgumentTypeCaster, type ParsedDuration } from '#lib';
-
-export const contentWithDuration: BushArgumentTypeCaster<Promise<ParsedDuration>> = async (_, phrase) => {
- return parseDuration(phrase);
-};
diff --git a/src/arguments/discordEmoji.ts b/src/arguments/discordEmoji.ts
deleted file mode 100644
index 92d6502..0000000
--- a/src/arguments/discordEmoji.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { regex, type BushArgumentTypeCaster } from '#lib';
-import type { Snowflake } from 'discord.js';
-
-export const discordEmoji: BushArgumentTypeCaster<DiscordEmojiInfo | null> = (_, phrase) => {
- if (!phrase) return null;
- const validEmoji: RegExpExecArray | null = regex.discordEmoji.exec(phrase);
- if (!validEmoji || !validEmoji.groups) return null;
- return { name: validEmoji.groups.name, id: validEmoji.groups.id };
-};
-
-export interface DiscordEmojiInfo {
- name: string;
- id: Snowflake;
-}
diff --git a/src/arguments/duration.ts b/src/arguments/duration.ts
deleted file mode 100644
index 09dd3d5..0000000
--- a/src/arguments/duration.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { parseDuration, type BushArgumentTypeCaster } from '#lib';
-
-export const duration: BushArgumentTypeCaster<number | null> = (_, phrase) => {
- return parseDuration(phrase).duration;
-};
diff --git a/src/arguments/durationSeconds.ts b/src/arguments/durationSeconds.ts
deleted file mode 100644
index d8d6749..0000000
--- a/src/arguments/durationSeconds.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { parseDuration, type BushArgumentTypeCaster } from '#lib';
-
-export const durationSeconds: BushArgumentTypeCaster<number | null> = (_, phrase) => {
- phrase += 's';
- return parseDuration(phrase).duration;
-};
diff --git a/src/arguments/globalUser.ts b/src/arguments/globalUser.ts
deleted file mode 100644
index 4324aa9..0000000
--- a/src/arguments/globalUser.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import type { BushArgumentTypeCaster } from '#lib';
-import type { User } from 'discord.js';
-
-// resolve non-cached users
-export const globalUser: BushArgumentTypeCaster<Promise<User | null>> = async (message, phrase) => {
- return message.client.users.resolve(phrase) ?? (await message.client.users.fetch(`${phrase}`).catch(() => null));
-};
diff --git a/src/arguments/index.ts b/src/arguments/index.ts
deleted file mode 100644
index eebf0a2..0000000
--- a/src/arguments/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export * from './abbreviatedNumber.js';
-export * from './contentWithDuration.js';
-export * from './discordEmoji.js';
-export * from './duration.js';
-export * from './durationSeconds.js';
-export * from './globalUser.js';
-export * from './messageLink.js';
-export * from './permission.js';
-export * from './roleWithDuration.js';
-export * from './snowflake.js';
diff --git a/src/arguments/messageLink.ts b/src/arguments/messageLink.ts
deleted file mode 100644
index c95e42d..0000000
--- a/src/arguments/messageLink.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { BushArgumentTypeCaster, regex } from '#lib';
-import type { Message } from 'discord.js';
-
-export const messageLink: BushArgumentTypeCaster<Promise<Message | null>> = async (message, phrase) => {
- const match = new RegExp(regex.messageLink).exec(phrase);
- if (!match || !match.groups) return null;
-
- const { guild_id, channel_id, message_id } = match.groups;
-
- if (!guild_id || !channel_id || message_id) return null;
-
- const guild = message.client.guilds.cache.get(guild_id);
- if (!guild) return null;
-
- const channel = guild.channels.cache.get(channel_id);
- if (!channel || (!channel.isTextBased() && !channel.isThread())) return null;
-
- const msg = await channel.messages.fetch(message_id).catch(() => null);
- return msg;
-};
diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts
deleted file mode 100644
index 98bfe74..0000000
--- a/src/arguments/permission.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import type { BushArgumentTypeCaster } from '#lib';
-import { PermissionFlagsBits, type PermissionsString } from 'discord.js';
-
-export const permission: BushArgumentTypeCaster<PermissionsString | null> = (_, phrase) => {
- if (!phrase) return null;
- phrase = phrase.toUpperCase().replace(/ /g, '_');
- if (!(phrase in PermissionFlagsBits)) {
- return null;
- } else {
- return phrase as PermissionsString;
- }
-};
diff --git a/src/arguments/roleWithDuration.ts b/src/arguments/roleWithDuration.ts
deleted file mode 100644
index b97f205..0000000
--- a/src/arguments/roleWithDuration.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Arg, BushArgumentTypeCaster, parseDuration } from '#lib';
-import type { Role } from 'discord.js';
-
-export const roleWithDuration: BushArgumentTypeCaster<Promise<RoleWithDuration | null>> = async (message, phrase) => {
- // eslint-disable-next-line prefer-const
- let { duration, content } = parseDuration(phrase);
- if (content === null || content === undefined) return null;
- content = content.trim();
- const role = await Arg.cast('role', message, content);
- if (!role) return null;
- return { duration, role };
-};
-
-export interface RoleWithDuration {
- duration: number | null;
- role: Role | null;
-}
diff --git a/src/arguments/snowflake.ts b/src/arguments/snowflake.ts
deleted file mode 100644
index b98a20f..0000000
--- a/src/arguments/snowflake.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { BushArgumentTypeCaster, regex } from '#lib';
-import type { Snowflake } from 'discord.js';
-
-export const snowflake: BushArgumentTypeCaster<Snowflake | null> = (_, phrase) => {
- if (!phrase) return null;
- if (regex.snowflake.test(phrase)) return phrase;
- return null;
-};
diff --git a/src/arguments/tinyColor.ts b/src/arguments/tinyColor.ts
deleted file mode 100644
index 148c078..0000000
--- a/src/arguments/tinyColor.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import type { BushArgumentTypeCaster } from '#lib';
-import assert from 'assert/strict';
-import tinycolorModule from 'tinycolor2';
-assert(tinycolorModule);
-
-export const tinyColor: BushArgumentTypeCaster<string | null> = (_message, phrase) => {
- // if the phase is a number it converts it to hex incase it could be representing a color in decimal
- const newPhase = isNaN(phrase as any) ? phrase : `#${Number(phrase).toString(16)}`;
- return tinycolorModule(newPhase).isValid() ? newPhase : null;
-};
diff --git a/src/bot.ts b/src/bot.ts
index 038fbbb..10818e9 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -1,4 +1,4 @@
-import { init } from './lib/utils/BushLogger.js';
+import { init } from '../lib/utils/BushLogger.js';
// creates proxies on console.log and console.warn
// also starts a REPL session
init();
@@ -6,8 +6,8 @@ init();
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { default as config } from '../config/options.js';
-import { Sentry } from './lib/common/Sentry.js';
-import { BushClient } from './lib/index.js';
+import { Sentry } from '../lib/common/Sentry.js';
+import { BushClient } from '../lib/extensions/discord-akairo/BushClient.js';
const isDry = process.argv.includes('dry');
if (!isDry && config.credentials.sentryDsn !== null) new Sentry(dirname(fileURLToPath(import.meta.url)) || process.cwd(), config);
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index 0b09e54..21abd04 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -1,6 +1,5 @@
import {
Arg,
- BushCommand,
ButtonPaginator,
clientSendAndPermCheck,
emojis,
@@ -11,6 +10,7 @@ import {
} from '#lib';
import assert from 'assert/strict';
import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
+import { BushCommand } from '../../../lib/extensions/discord-akairo/BushCommand.js';
export default class ChannelPermissionsCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index ac0ad83..0606497 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -18,9 +18,9 @@ import {
type ApplicationCommand,
type Collection
} from 'discord.js';
-import badLinksSecretArray from '../../lib/badlinks-secret.js';
-import badLinksArray from '../../lib/badlinks.js';
-import badWords from '../../lib/badwords.js';
+import badLinksSecretArray from '../../../lib/badlinks-secret.js';
+import badLinksArray from '../../../lib/badlinks.js';
+import badWords from '../../../lib/badwords.js';
export default class TestCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 348c74f..62f177e 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -9,6 +9,7 @@ import {
type OptArgType,
type SlashMessage
} from '#lib';
+import { stripIndent } from '#tags';
import assert from 'assert/strict';
import {
ActionRowBuilder,
@@ -21,7 +22,6 @@ import {
} from 'discord.js';
import Fuse from 'fuse.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
-import { stripIndent } from '../../lib/common/tags.js';
assert(Fuse);
assert(packageDotJSON);
diff --git a/src/commands/moderation/massEvidence.ts b/src/commands/moderation/massEvidence.ts
index 62f4825..cecf273 100644
--- a/src/commands/moderation/massEvidence.ts
+++ b/src/commands/moderation/massEvidence.ts
@@ -13,7 +13,7 @@ import {
} from '#lib';
import assert from 'assert/strict';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
-import { EvidenceCommand } from '../index.js';
+import EvidenceCommand from './evidence.js';