aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/checks.yml2
-rw-r--r--.vscode/settings.json32
-rw-r--r--package.json49
-rw-r--r--src/arguments/permission.ts2
-rw-r--r--src/commands/config/config.ts2
-rw-r--r--src/commands/config/features.ts7
-rw-r--r--src/commands/dev/test.ts12
-rw-r--r--src/commands/fun/minesweeper.ts2
-rw-r--r--src/commands/info/botInfo.ts2
-rw-r--r--src/commands/info/guildInfo.ts46
-rw-r--r--src/commands/info/help.ts76
-rw-r--r--src/commands/info/pronouns.ts2
-rw-r--r--src/commands/info/snowflake.ts16
-rw-r--r--src/commands/info/userInfo.ts9
-rw-r--r--src/commands/leveling/level.ts11
-rw-r--r--src/commands/moderation/slowmode.ts9
-rw-r--r--src/commands/moderation/unmute.ts10
-rw-r--r--src/commands/moderation/warn.ts10
-rw-r--r--src/commands/utilities/uuid.ts2
-rw-r--r--src/commands/utilities/wolframAlpha.ts2
-rw-r--r--src/inhibitors/blacklist/channelGlobalBlacklist.ts5
-rw-r--r--src/inhibitors/blacklist/channelGuildBlacklist.ts5
-rw-r--r--src/inhibitors/blacklist/guildBlacklist.ts5
-rw-r--r--src/inhibitors/blacklist/userGlobalBlacklist.ts7
-rw-r--r--src/inhibitors/blacklist/userGuildBlacklist.ts5
-rw-r--r--src/inhibitors/checks/fatal.ts5
-rw-r--r--src/inhibitors/checks/guildUnavailable.ts5
-rw-r--r--src/inhibitors/command/dm.ts5
-rw-r--r--src/inhibitors/command/globalDisabledCommand.ts5
-rw-r--r--src/inhibitors/command/guild.ts5
-rw-r--r--src/inhibitors/command/guildDisabledCommand.ts5
-rw-r--r--src/inhibitors/command/nsfw.ts5
-rw-r--r--src/inhibitors/command/owner.ts5
-rw-r--r--src/inhibitors/command/restrictedChannel.ts5
-rw-r--r--src/inhibitors/command/restrictedGuild.ts5
-rw-r--r--src/inhibitors/command/superUser.ts5
-rw-r--r--src/lib/badwords.ts1
-rw-r--r--src/lib/common/ButtonPaginator.ts26
-rw-r--r--src/lib/common/DeleteButton.ts2
-rw-r--r--src/lib/common/Moderation.ts16
-rw-r--r--src/lib/common/typings/BushInspectOptions.d.ts4
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts26
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts36
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts12
-rw-r--r--src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts9
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts6
-rw-r--r--src/lib/extensions/discord.js/BushGuildManager.d.ts3
-rw-r--r--src/lib/extensions/discord.js/BushGuildMemberManager.d.ts9
-rw-r--r--src/lib/extensions/discord.js/BushMessageManager.d.ts39
-rw-r--r--src/lib/extensions/discord.js/BushThreadManager.d.ts42
-rw-r--r--src/lib/extensions/discord.js/BushThreadMemberManager.d.ts10
-rw-r--r--src/lib/models/ActivePunishment.ts28
-rw-r--r--src/lib/models/Global.ts24
-rw-r--r--src/lib/models/Guild.ts74
-rw-r--r--src/lib/models/Level.ts14
-rw-r--r--src/lib/models/ModLog.ts44
-rw-r--r--src/lib/models/Stat.ts12
-rw-r--r--src/lib/models/StickyRole.ts18
-rw-r--r--src/lib/models/__helpers.ts2
-rw-r--r--src/lib/utils/BushCache.ts4
-rw-r--r--src/lib/utils/BushConstants.ts198
-rw-r--r--src/listeners/commands/commandBlocked.ts4
-rw-r--r--src/listeners/guild/guildMemberRemove.ts9
-rw-r--r--src/listeners/message/autoThread.ts12
-rw-r--r--src/listeners/message/directMessage.ts13
-rw-r--r--yarn.lock1845
66 files changed, 2013 insertions, 914 deletions
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index ad87154..bbaa22f 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -49,7 +49,7 @@ jobs:
git config --local user.name "github-actions[bot]"
- name: Format and Commit
run: |
- yarn format || true
+ yarn format
git commit -am "Automatically format code" || true
- name: Push Changes
uses: NotEnoughUpdates/github-push-action@master
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 1dd2bce..6413fdc 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -23,7 +23,6 @@
"source.fixAll.eslint": true,
"source.format": true
},
- "editor.formatOnSave": true,
"diffEditor.wordWrap": "on",
"editor.insertSpaces": false,
"editor.wordWrap": "on",
@@ -32,11 +31,10 @@
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
"prettier.withNodeModules": true,
"prettier.useEditorConfig": false,
- "eslint.nodePath": ".yarn/sdks",
// "typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
- "better-comments.highlightPlainText": true,
+ "better-comments.highlightPlainText": false,
"better-comments.multilineComments": true,
"better-comments.tags": [
{
@@ -57,24 +55,6 @@
"bold": false,
"italic": false
},
- // {
- // "tag": "#",
- // "color": "#f003fc",
- // "strikethrough": false,
- // "underline": false,
- // "backgroundColor": "transparent",
- // "bold": false,
- // "italic": false
- // },
- // {
- // "tag": "//",
- // "color": "#474747",
- // "strikethrough": true,
- // "underline": false,
- // "backgroundColor": "transparent",
- // "bold": false,
- // "italic": false
- // },
{
"tag": "todo",
"color": "#FF8C00",
@@ -84,15 +64,6 @@
"bold": false,
"italic": false
},
- // {
- // "tag": "*",
- // "color": "#98C379",
- // "strikethrough": false,
- // "underline": false,
- // "backgroundColor": "transparent",
- // "bold": false,
- // "italic": false
- // },
{
"tag": "@ts-",
"color": "#f54242",
@@ -121,5 +92,4 @@
"italic": false
}
],
- "compile-hero.disable-compile-files-on-did-save-code": true
} \ No newline at end of file
diff --git a/package.json b/package.json
index bb59bec..e6acde6 100644
--- a/package.json
+++ b/package.json
@@ -9,10 +9,14 @@
"contributors": [
"Tyman#5998 (@TymanWasTaken)",
"TrashCan#8913 (@TrashCan69420)",
- "tricked#3777 (@SkyBlockDev)",
+ "tricked#3777 (@Tricked-dev)",
"rioho#0001 (@riohorealhk)",
"Proudmuslim#2900 (@proudmuslim-dev)",
- "Zordlan#3560 (@Zordlan)"
+ "katherine🌺#0668 (@Lisenaaaa)",
+ "jani270#0119 (@jani270)",
+ "pjones123#6025 (@pjones123)",
+ "Angry_Pineapple#6926 (@Angry-Pineapple3121)",
+ "EthanDevelops#5366 (@EthanDevelops)"
],
"license": "CC-BY-NC-SA-4.0",
"imports": {
@@ -34,26 +38,28 @@
"format": "yarn prettier . --write",
"lint": "yarn eslint --ext js,jsx,ts,tsx src",
"format:check": "yarn prettier . --check",
- "upgrade": "yarn rimraf yarn.lock && yarn cache clean && yarn install && yarn up && yarn up -R",
+ "upgrade": "yarn rimraf yarn.lock && yarn cache clean && yarn install && yarn up && yarn up -R && yarn set version latest",
"upgrade:sdk": "yarn dlx @yarnpkg/sdks vscode",
+ "upgrade:manual": "yarn add @notenoughupdates/discord.js-minesweeper @notenoughupdates/humanize-duration @notenoughupdates/wolfram-alpha-api @sentry/node @sentry/tracing canvas chalk discord-akairo@npm:@notenoughupdates/discord-akairo@dev discord.js@npm:@notenoughupdates/discord.js@dev events-intercept fuse.js got lodash mathjs moment nanoid node-os-utils numeral pg pg-hstore prettier@prettier/prettier pretty-bytes rimraf sequelize simplify-number source-map-support tinycolor2 tslib typescript vm2 && yarn add --dev @types/express @types/lodash @types/node @types/node-os-utils @types/numeral @types/tinycolor2 @types/validator @typescript-eslint/eslint-plugin @typescript-eslint/parser discord-api-types@0.24.0 eslint eslint-config-prettier",
"beta": "git push && git checkout beta && git merge master && git push && git checkout master",
"deploy:beta": "wsl /bin/bash -c \"pm2 deploy ecosystem.config.cjs beta\"",
"deploy:production": "wsl /bin/bash -c \"pm2 deploy ecosystem.config.cjs production\"",
"deploy:all": "yarn beta && wsl /bin/bash -c \"pm2 deploy ecosystem.config.cjs production && pm2 deploy ecosystem.config.cjs beta\""
},
"dependencies": {
- "@notenoughupdates/wolfram-alpha-api": "^1.0.0",
- "@sentry/node": "^6.14.3",
- "@sentry/tracing": "^6.14.3",
+ "@notenoughupdates/discord.js-minesweeper": "^1.0.8",
+ "@notenoughupdates/events-intercept": "^3.0.1",
+ "@notenoughupdates/humanize-duration": "^4.0.1",
+ "@notenoughupdates/wolfram-alpha-api": "^1.0.1",
+ "@sentry/node": "^6.15.0",
+ "@sentry/tracing": "^6.15.0",
"canvas": "^2.8.0",
"chalk": "^4.1.2",
"discord-akairo": "npm:@notenoughupdates/discord-akairo@dev",
"discord.js": "npm:@notenoughupdates/discord.js@dev",
- "discord.js-minesweeper": "^1.0.6",
"events-intercept": "^2.0.0",
"fuse.js": "^6.4.6",
- "got": "^11.8.2",
- "humanize-duration": "^3.27.0",
+ "got": "^11.8.3",
"lodash": "^4.17.21",
"mathjs": "^10.0.0",
"moment": "^2.29.1",
@@ -62,30 +68,29 @@
"numeral": "^2.0.6",
"pg": "^8.7.1",
"pg-hstore": "^2.3.4",
- "prettier": "^2.4.1",
+ "prettier": "prettier/prettier",
"pretty-bytes": "^5.6.0",
"rimraf": "^3.0.2",
- "sequelize": "^6.9.0",
+ "sequelize": "^6.12.0-alpha.1",
"simplify-number": "^1.0.0",
- "source-map-support": "^0.5.20",
+ "source-map-support": "^0.5.21",
"tinycolor2": "^1.4.2",
"tslib": "^2.3.1",
- "typescript": "rc",
+ "typescript": "^4.5.2",
"vm2": "^3.9.5"
},
"devDependencies": {
"@types/express": "^4.17.13",
- "@types/humanize-duration": "^3.27.0",
- "@types/lodash": "^4.14.176",
- "@types/node": "^16.11.7",
+ "@types/lodash": "^4.14.177",
+ "@types/node": "^16.11.9",
"@types/node-os-utils": "^1.2.0",
"@types/numeral": "^2.0.2",
"@types/tinycolor2": "^1.4.3",
- "@types/validator": "^13.6.6",
- "@typescript-eslint/eslint-plugin": "^5.3.1",
- "@typescript-eslint/parser": "^5.3.1",
+ "@types/validator": "^13.7.0",
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
+ "@typescript-eslint/parser": "^5.4.0",
"discord-api-types": "0.24.0",
- "eslint": "^8.2.0",
+ "eslint": "^8.3.0",
"eslint-config-prettier": "^8.3.0"
},
"eslintConfig": {
@@ -155,6 +160,10 @@
{
"argsIgnorePattern": "^_"
}
+ ],
+ "no-implied-eval": "off",
+ "@typescript-eslint/no-implied-eval": [
+ "error"
]
}
},
diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts
index 36c8fcb..8c09072 100644
--- a/src/arguments/permission.ts
+++ b/src/arguments/permission.ts
@@ -4,7 +4,7 @@ import { Permissions } from 'discord.js';
export const permission: BushArgumentTypeCaster = (_, phrase) => {
if (!phrase) return null;
phrase = phrase.toUpperCase().replace(/ /g, '_');
- if (!Reflect.has(Permissions.FLAGS, phrase)) {
+ if (!(phrase in Permissions.FLAGS)) {
return null;
} else {
return phrase;
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 00c6a69..2ce4246 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -229,7 +229,7 @@ export default class SettingsCommand extends BushCommand {
}
const collector = msg.createMessageComponentCollector({
time: 300_000,
- filter: (i) => i.guildId === msg.guildId && i.message.id === msg.id
+ filter: (i) => i.guildId === msg.guildId && i.message?.id === msg.id
});
collector.on('collect', async (interaction: MessageComponentInteraction) => {
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index d2c2baf..095d985 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -1,6 +1,7 @@
import {
BushCommand,
- guildFeaturesArr, guildFeaturesObj,
+ guildFeaturesArr,
+ guildFeaturesObj,
type BushMessage,
type BushSlashMessage,
type GuildFeatures
@@ -36,7 +37,7 @@ export default class FeaturesCommand extends BushCommand {
const collector = msg.createMessageComponentCollector({
componentType: 'SELECT_MENU',
time: 300_000,
- filter: (i) => i.guildId === msg.guildId && i.message.id === msg.id
+ filter: (i) => i.guildId === msg.guildId && i.message?.id === msg.id
});
collector.on('collect', async (interaction: SelectMenuInteraction) => {
@@ -78,7 +79,7 @@ export default class FeaturesCommand extends BushCommand {
return new MessageActionRow().addComponents(
new MessageSelectMenu({
customId: 'command_selectFeature',
- disabled: disable,
+ disabled: disable,
maxValues: 1,
minValues: 1,
options: guildFeatures.map((f) => ({
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index d4109f4..5120a34 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -1,11 +1,11 @@
import { BushCommand, ButtonPaginator, type BushMessage } from '#lib';
import {
- Constants as jsConstants,
- MessageActionRow,
- MessageButton,
- MessageEmbed,
- type ApplicationCommand,
- type Collection
+ Constants as jsConstants,
+ MessageActionRow,
+ MessageButton,
+ MessageEmbed,
+ type ApplicationCommand,
+ type Collection
} from 'discord.js';
export default class TestCommand extends BushCommand {
diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts
index 71c5055..9b511a3 100644
--- a/src/commands/fun/minesweeper.ts
+++ b/src/commands/fun/minesweeper.ts
@@ -1,5 +1,5 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import Minesweeper from 'discord.js-minesweeper';
+import Minesweeper from '@notenoughupdates/discord.js-minesweeper';
export default class MinesweeperCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index 04a1b14..833ed96 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';
-const {default: prettyBytes} = await import('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 ef1c232..47a8281 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -1,5 +1,13 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { Constants, 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() {
@@ -66,17 +74,17 @@ export default class GuildInfoCommand extends BushCommand {
await guild.fetch();
const channels = guild.channels.cache;
- 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()}`
- )
+ 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(
@@ -105,8 +113,18 @@ 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 }
+ 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(', ')})`,
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index f956405..3bf8f5e 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -44,35 +44,7 @@ export default class HelpCommand extends BushCommand {
args: { command: BushCommand | string; showHidden?: boolean }
) {
const prefix = util.prefix(message);
- const row = new MessageActionRow();
-
- if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
- row.addComponents(
- new MessageButton({
- style: 'LINK',
- label: 'Invite Me',
- url: `https://discord.com/api/oauth2/authorize?client_id=${
- client.user!.id
- }&permissions=5368709119918&scope=bot%20applications.commands`
- })
- );
- }
- if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) {
- row.addComponents(
- new MessageButton({
- style: 'LINK',
- label: 'Support Server',
- url: client.config.supportGuild.invite
- })
- );
- }
- row.addComponents(
- new MessageButton({
- style: 'LINK',
- label: 'GitHub',
- url: packageDotJSON.repository
- })
- );
+ const row = this.addLinks(message);
const isOwner = client.isOwner(message.author);
const isSuperUser = client.isSuperUser(message.author);
@@ -91,17 +63,13 @@ export default class HelpCommand extends BushCommand {
if (command.hidden && !args.showHidden) return false;
if (command.channel == 'guild' && !message.guild && !args.showHidden) return false;
if (command.ownerOnly && !isOwner) return false;
- if (command.superUserOnly && !isSuperUser) {
- return false;
- }
+ if (command.superUserOnly && !isSuperUser) return false;
return !(command.restrictedGuilds?.includes(message.guild?.id ?? '') === false && !args.showHidden);
});
const categoryNice = category.id
- .replace(/(\b\w)/gi, (lc): string => lc.toUpperCase())
- .replace(/'(S)/g, (letter): string => letter.toLowerCase());
- const categoryCommands = categoryFilter
- .filter((cmd): boolean => cmd.aliases.length > 0)
- .map((cmd): string => `\`${cmd.aliases[0]}\``);
+ .replace(/(\b\w)/gi, (lc) => lc.toUpperCase())
+ .replace(/'(S)/g, (letter) => letter.toLowerCase());
+ const categoryCommands = categoryFilter.filter((cmd) => cmd.aliases.length > 0).map((cmd) => `\`${cmd.aliases[0]}\``);
if (categoryCommands.length > 0) {
embed.addField(`${categoryNice}`, `${categoryCommands.join(' ')}`);
}
@@ -153,4 +121,38 @@ export default class HelpCommand extends BushCommand {
return await message.util.reply({ embeds: [embed], components: [row] });
}
+
+ private addLinks(message: BushMessage | BushSlashMessage) {
+ const row = new MessageActionRow();
+
+ if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
+ row.addComponents(
+ new MessageButton({
+ style: 'LINK',
+ label: 'Invite Me',
+ url: `https://discord.com/api/oauth2/authorize?client_id=${
+ client.user!.id
+ }&permissions=5368709119918&scope=bot%20applicat