aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-23 20:17:13 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-23 20:17:13 -0400
commit5d33e1aa43444850084b4794b7d870e67dbb474e (patch)
tree3c98cbb49ce896d0ca3e65b13c5cded0f8580359
parentfa9e2fea668f0f1aaa766288599393e6816c58bc (diff)
downloadtanzanite-5d33e1aa43444850084b4794b7d870e67dbb474e.tar.gz
tanzanite-5d33e1aa43444850084b4794b7d870e67dbb474e.tar.bz2
tanzanite-5d33e1aa43444850084b4794b7d870e67dbb474e.zip
bunch of shit
-rw-r--r--.gitignore2
-rw-r--r--.vscode/extensions.json3
-rw-r--r--lib/assets/Roboto-Regular.ttf (renamed from src/lib/assets/Roboto-Regular.ttf)bin168260 -> 168260 bytes
-rw-r--r--lib/badlinks.json5373
-rw-r--r--lib/badwords.json526
-rw-r--r--package.json31
-rw-r--r--src/commands/config/features.ts56
-rw-r--r--src/commands/dev/test.ts3
-rw-r--r--src/commands/utilities/calculator.ts57
-rw-r--r--src/commands/utilities/decode.ts8
-rw-r--r--src/inhibitors/blacklist/channelGlobalBlacklist.ts4
-rw-r--r--src/inhibitors/blacklist/channelGuildBlacklist.ts4
-rw-r--r--src/inhibitors/blacklist/guildBlacklist.ts4
-rw-r--r--src/inhibitors/blacklist/userGlobalBlacklist.ts4
-rw-r--r--src/inhibitors/blacklist/userGuildBlacklist.ts4
-rw-r--r--src/inhibitors/checks/fatal.ts (renamed from src/inhibitors/noCache.ts)8
-rw-r--r--src/inhibitors/checks/guildUnavailable.ts19
-rw-r--r--src/inhibitors/command/dm.ts19
-rw-r--r--src/inhibitors/command/globalDisabledCommand.ts (renamed from src/inhibitors/commands/globalDisabledCommand.ts)6
-rw-r--r--src/inhibitors/command/guild.ts19
-rw-r--r--src/inhibitors/command/guildDisabledCommand.ts (renamed from src/inhibitors/commands/guildDisabledCommand.ts)6
-rw-r--r--src/inhibitors/command/nsfw.ts20
-rw-r--r--src/inhibitors/command/owner.ts21
-rw-r--r--src/inhibitors/command/restrictedChannel.ts21
-rw-r--r--src/inhibitors/command/restrictedGuild.ts21
-rw-r--r--src/inhibitors/command/superUser.ts21
-rw-r--r--src/lib/badlinks.json372
-rw-r--r--src/lib/badwords.json20
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandHandler.ts68
-rw-r--r--src/lib/extensions/discord-akairo/BushSlashMessage.ts5
-rw-r--r--src/listeners/commands/commandBlocked.ts52
-rw-r--r--src/listeners/commands/messageBlocked.ts17
-rw-r--r--src/listeners/message/automodCreate.ts11
-rw-r--r--tsconfig.json3
-rw-r--r--yarn.lock1211
35 files changed, 883 insertions, 1636 deletions
diff --git a/.gitignore b/.gitignore
index bb453c6..a0225ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,4 +55,4 @@ data.db
src/config/options_old.ts
src/config/options_pi.ts
-src/lib/badlinks-secret.json
+lib/badlinks-secret.json5
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 2b70e67..c242879 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -9,6 +9,7 @@
"github.vscode-pull-request-github",
"ckolkman.vscode-postgres",
"tobias-faller.vt100-syntax-highlighting",
- "pkief.material-icon-theme"
+ "pkief.material-icon-theme",
+ "mrmlnc.vscode-json5"
]
}
diff --git a/src/lib/assets/Roboto-Regular.ttf b/lib/assets/Roboto-Regular.ttf
index 3d6861b..3d6861b 100644
--- a/src/lib/assets/Roboto-Regular.ttf
+++ b/lib/assets/Roboto-Regular.ttf
Binary files differ
diff --git a/lib/badlinks.json5 b/lib/badlinks.json5
new file mode 100644
index 0000000..6fedcd0
--- /dev/null
+++ b/lib/badlinks.json5
@@ -0,0 +1,373 @@
+/* Links in this file are treated as severity 3 offences. */
+[
+ 'acercup.com',
+ 'affix-cup.ru',
+ 'affix-sport.ru',
+ 'airdrops.tips',
+ 'aladdinhub.fun',
+ 'allskinz.xyz',
+ 'ano-skinspin.xyz',
+ 'anomalygiveaways.pro',
+ 'anomalyknifes.xyz',
+ 'anomalyskin.xyz',
+ 'anomalyskinz.xyz',
+ 'anoskinzz.xyz',
+ 'berrygamble.com',
+ 'bit-skins.ru',
+ 'bitknife.xyz',
+ 'bitskines.ru',
+ 'casefire.fun',
+ 'challengeme.in',
+ 'challengeme.vip',
+ 'challengme.ru',
+ 'cloud9team.space',
+ 'cmepure.com',
+ 'cmskillcup.com',
+ 'counterpaid.xyz',
+ 'counterspin.top',
+ 'counterstrikegift.xyz',
+ 'cs-beast.xyz',
+ 'cs-lucky.xyz',
+ 'cs-pill.xyz',
+ 'cs-prizeskins.xyz',
+ 'cs-prizeskinz.xyz',
+ 'cs-simpleroll.xyz',
+ 'cs-skinz.xyz',
+ 'cs-smoke.xyz',
+ 'cs-spinz.xyz',
+ 'cs-victory.xyz',
+ 'csallskin.xyz',
+ 'csbuyskins.in',
+ 'cscoat.eu',
+ 'csgo-analyst.com',
+ 'csgo-cash.eu',
+ 'csgo-gifts.com',
+ 'csgo-market.ru.com',
+ 'csgo-market.ru.com',
+ 'csgo-steamanalyst.net',
+ 'csgo-swapskin.com',
+ 'csgo-trade.net',
+ 'csgo-up.com',
+ 'csgobeats.com',
+ 'csgobelieve.ru',
+ 'csgocase.one',
+ 'csgocashs.com',
+ 'csgocheck.ru.com',
+ 'csgocheck.ru',
+ 'csgocompetive.com',
+ 'csgocupp.ru.com',
+ 'csgocybersport.ru.com',
+ 'csgodetails.info',
+ 'csgodreamer.com',
+ 'csgodrs.com',
+ 'csgoeasywin.ru.com',
+ 'csgoelite.xyz',
+ 'csgoencup.com',
+ 'csgoevent.xyz',
+ 'csgogift49.xyz',
+ 'csgoindex.ru.com',
+ 'csgoindex.ru',
+ 'csgoitemdetails.com',
+ 'csgoitemsprices.com',
+ 'csgoko.tk',
+ 'csgomarble.xyz',
+ 'csgomarketplace.net',
+ 'csgomarkets.net',
+ 'csgoorun.ru',
+ 'csgoprocupgo.com',
+ 'csgorcup.com',
+ 'csgorose.com',
+ 'csgoroyalskins1.com',
+ 'csgoskill.ru',
+ 'csgoskinprices.com',
+ 'csgoskinsinfo.com',
+ 'csgoskinsroll.com',
+ 'csgosteamanalysis.com',
+ 'csgosteamanalyst.ru',
+ 'csgoteammate.gq',
+ 'csgothunby.com',
+ 'csgotrades.net',
+ 'csgovip.ru',
+ 'csgoxgiveaway.ru',
+ 'csgozone.net.in',
+ 'csgunskins.xyz',
+ 'csmoneyskinz.xyz',
+ 'csmvcecup.com',
+ 'csprices.in',
+ 'csskill.com',
+ 'csskillpro.xyz',
+ 'csskinz.xyz',
+ 'cstournament.ru',
+ 'csxrnoney.com',
+ 'cybergamearena.ru',
+ 'd2cups.com',
+ 'd2faceit.com',
+ 'deamonbets.ru',
+ 'demonbets.ru',
+ 'denforapasi.cf',
+ 'diablobets.com',
+ 'dicksod.co',
+ 'dicsord.gifts',
+ 'dicsord.net',
+ 'dicsord.net',
+ 'dirscod.com',
+ 'dirscod.gift',
+ 'discod.gift',
+ 'discod.info',
+ 'discorb.co',
+ 'discorb.ru.com',
+ 'discorcl.click',
+ 'discorcl.link',
+ 'discord-gifts.com',
+ 'discord-nitro.gifts',
+ 'discord-nitro.link',
+ 'discord.blog',
+ 'discord.shop',
+ 'discordgivenitro.com',
+ 'discordnitrogift.ru',
+ 'discrod.gift',
+ 'discrod.gifts',
+ 'discrodnitro.org',
+ 'diskord.ru.com',
+ 'disrcod.com',
+ 'dlscord.info',
+ 'dlscord.online',
+ 'dlscord.press',
+ 'dlscord.store',
+ 'dlscord.wiki',
+ 'dlscord.world',
+ 'doatgiveaway.top',
+ 'dopeskins.com',
+ 'dota2fight.net',
+ 'dota2fight.ru',
+ 'dota2giveaway.top',
+ 'dota2giveaways.top',
+ 'dotafights.vip',
+ 'dotagiveaway.win',
+ 'dragon-up.online',
+ 'earnskinz.xyz',
+ 'emeraldbets.ru',
+ 'eplcups.com',
+ 'esea-mdl.com',
+ 'esportgaming.ru',
+ 'event-games4roll.com',
+ 'exchangeuritems.gq',
+ 'extraskinscs.xyz',
+ 'ezwin24.ru',
+ 'facecup.fun',
+ 'faceiteasyleague.ru',
+ 'fatown.net',
+ 'fineleague.fun',
+ 'fireopencase.com',
+ 'fivetown.net',
+ 'free-nitro.ru',
+ 'free-nitros.ru',
+ 'free-skins.ru',
+ 'freenitroi.ru',
+ 'freenitros.ru',
+ 'g2-give.ru',
+ 'g2-give.ru',
+ 'game4roll.com',
+ 'gameluck.ru',
+ 'gamerich.xyz',
+ 'games-roll.ga',
+ 'games-roll.ml',
+ 'games-roll.ru',
+ 'get-nitro.net',
+ 'gift4keys.com',
+ 'giftsdiscord.ru',
+ 'giveavvay.com',
+ 'giveawayskin.com',
+ 'global-skins.gq',
+ 'globalcsskins.xyz',
+ 'globalskins.tk',
+ 'go.rancah.com',
+ 'goldendota.com',
+ 'goodskins.gq',
+ 'gosteamanalyst.com',
+ 'gtakey.ru',
+ 'hellgiveaway.trade',
+ 'hellstores.xyz',
+ 'hltvcsgo.com',
+ 'hltvgames.net',
+ 'iemcup.com',
+ 'keys-loot.com',
+ 'knifespin.top',
+ 'knifespin.top',
+ 'knifespin.xyz',
+ 'knifespins.xyz',
+ 'knifez-roll.xyz',
+ 'knifez-win.xyz',
+ 'league-csgo.com',
+ 'lehatop-01.ru',
+ 'lootxmarket.com',
+ 'loungeztrade.com',
+ 'lucky-skins.xyz',
+ 'made-nitro.com',
+ 'makson-gta.ru',
+ 'maxskins.xyz',
+ 'mvcsgo.com',
+ 'mvpcup.ru',
+ 'mvptournament.com',
+ 'mygames4roll.com',
+ 'naviback.ru',
+ 'night-skins.com',
+ 'nitro-discord.org',
+ 'nitros-gift.com',
+ 'nwgwroqr.ru',
+ 'oligarph.club',
+ 'ownerbets.com',
+ 'playerskinz.xyz',
+ 'pubggift62.xyz',
+ 'rangskins.com',
+ 'rave-new.ru',
+ 'roll-skins.ru',
+ 'roll4knife.xyz',
+ 'roll4tune.com',
+ 'rollknfez.xyz',
+ 'rollskin-simple.xyz',
+ 'rushbskins.xyz',
+ 'rushskins.xyz',
+ 's1mple-spin.xyz',
+ 'sakuralive.ru.com',
+ 'scale-navi.pp.ru',
+ 'simple-knifez.xyz',
+ 'simple-win.xyz',
+ 'simplegamepro.ru',
+ 'simpleroll-cs.xyz',
+ 'simplespinz.xyz',
+ 'simplewinz.xyz',
+ 'skin-index.com',
+ 'skin888trade.com',
+ 'skincs-spin.top',
+ 'skincs-spin.xyz',
+ 'skinmarkets.net',
+ 'skins-hub.top',
+ 'skins-info.net',
+ 'skins-jungle.xyz',
+ 'skinsboost.ru',
+ 'skinsdatabse.com',
+ 'skinsind.com',
+ 'skinsmind.ru',
+ 'skinspace.ru',
+ 'skinsplane.com',
+ 'skinsplanes.com',
+ 'skinsplanets.com',
+ 'skinxinfo.net',
+ 'skinxmarket.site',
+ 'skinz-spin.top',
+ 'skinz-spin.xyz',
+ 'skinzjar.ru',
+ 'skinzprize.xyz',
+ 'skinzspin-cs.xyz',
+ 'skinzspinz.xyz',
+ 'sleanmconmunltiy.ru',
+ 'spin-games.com',
+ 'spin4skinzcs.top',
+ 'spin4skinzcs.xyz',
+ 'spinforskin.ml',
+ 'sponsored-simple.xyz',
+ 'staemcomnrnunitiy.ru.com',
+ 'staemcomrnunity.store',
+ 'staermcrommunity.me',
+ 'staffstatsgo.com',
+ 'starrygamble.com',
+ 'stat-csgo.ru',
+ 'stats-cs.ru',
+ 'stceamcomminity.com',
+ 'steam-analyst.ru',
+ 'steam-nitro.ru',
+ 'steam-trades.icu',
+ 'steamanalysts.com',
+ 'steamcomcunity.ru',
+ 'steamcomminutiu.ru',
+ 'steamcomminutiy.ru',
+ 'steamcomminytiu.com',
+ 'steamcomminytiu.ru',
+ 'steamcomminytu.ru',
+ 'steamcommnunily.com',
+ 'steamcommnuninty.com',
+ 'steamcommnuntiy.com',
+ 'steamcommrutiny.ru',
+ 'steamcommuniiy.ru',
+ 'steamcommunily.uno',
+ 'steamcommunitiyu.com',
+ 'steamcommunitlu.com',
+ 'steamcommunity.link',
+ 'steamcommunityu.com',
+ 'steamcommunityu.ru',
+ 'steamcommunityw.com',
+ 'steamcommunlty.pro',
+ 'steamcommunrlity.com',
+ 'steamcommunutiy.com',
+ 'steamcommunytiu.ru',
+ 'steamcommunytu.ru',
+ 'steamcommutiny.com',
+ 'steamcommynitu.ru',
+ 'steamcomnmuituy.com',
+ 'steamcomnumity.ru',
+ 'steamcomrnunity.ru',
+ 'steamcomrrnunity.com',
+ 'steamcomrunity.com',
+ 'steamcomuniity.ru.com',
+ 'steamconmunlty.com',
+ 'steamcormmuntiy.com',
+ 'steamgamesroll.ru',
+ 'steamncommuniity.com',
+ 'steamncommunity.com',
+ 'steamnmcomunnity.co',
+ 'steamoemmunity.com',
+ 'steamsupportpowered.icu',
+ 'steancommunity.link',
+ 'steancommynity.ru.com',
+ 'steancomnunytu.ru',
+ 'steancomunnity.ru',
+ 'steancomunyiti.ru',
+ 'stearmcommunnitty.online',
+ 'stearmmcomunitty.ru',
+ 'stearmmcomunity.ru',
+ 'stearmmcomuunity.ru',
+ 'stearncomminuty.ru',
+ 'stearncommunity.ru',
+ 'stearncommunytiy.ru',
+ 'stearncommuty.com',
+ 'stearncormmunity.com',
+ 'steemcommnunity.ru',
+ 'stemcommunnilty.com',
+ 'stermccommunitty.ru',
+ 'stermcommuniity.com',
+ 'stermcommunnitty.ru',
+ 'stewie2k-giveaway-150days.pro',
+ 'stiemcommunitty.ru',
+ 'stmeacomunnitty.ru',
+ 'store-stempowered.com',
+ 'streamcommulinty.com',
+ 'streamcommuninnity.com',
+ 'streamcommuunnity.com',
+ 'streamcomnumity.ru',
+ 'streamcomunity.com',
+ 'streammcomunnity.ru',
+ 'streancommunuty.ru',
+ 'streancommunuty.ru',
+ 'strearmcommunity.ru',
+ 'strearmcomunity.ru',
+ 'sunnygamble.com',
+ 'swapskins.live',
+ 'test-domuin2.com',
+ 'test-domuin3.ru',
+ 'test-domuin4.ru',
+ 'test-domuin5.ru',
+ 'tf2market.store',
+ 'tournamentt.com',
+ 'ultimateskins.xyz',
+ 'ultracup.fun',
+ 'uspringcup.com',
+ 'waterbets.ru',
+ 'win-skin.top',
+ 'win-skin.xyz',
+ 'winknifespin.xyz',
+ 'winskin-simple.xyz',
+ 'winskins.top',
+ 'wintheskin.xyz',
+ 'xgamercup.com'
+]
diff --git a/lib/badwords.json5 b/lib/badwords.json5
new file mode 100644
index 0000000..158842e
--- /dev/null
+++ b/lib/badwords.json5
@@ -0,0 +1,26 @@
+/* Severities:
+ - 0: Delete message
+ - 1: Delete message and warn user
+ - 2: Delete message and mute user for 15 minutes
+ - 3: Delete message and mute user permanently
+ */
+{
+ 'nigger': 3,
+ 'nigga': 3,
+ 'retard': 2,
+ 'retarted': 2,
+ 'faggot': 2,
+ 'slut': 1,
+ 'whore': 1,
+ '卍': 3,
+ 'found a cool software that improves the': 3,
+ 'hi, bro h am leaving cs:go and giving away my skin': 3,
+ 'hi friend, today i am leaving this fucking game': 3,
+ "hi guys, i'm leaving this fucking game, take my": 3,
+ 'you can choose any skin for yourself': 3,
+ 'discord nitro for free - steam store': 3,
+ 'get 3 months of discord nitro': 3,
+ 'get discord nitro for free': 3,
+ 'free 3 months of discord nitro': 3,
+ 'free discord nitro airdrop': 3
+}
diff --git a/package.json b/package.json
index 5855fe9..0d13714 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
],
"license": "CC-BY-NC-SA-4.0",
"_moduleAliases": {
+ "@root": ".",
"@lib": "dist/src/lib"
},
"scripts": {
@@ -33,6 +34,7 @@
"@types/common-tags": "^1.8.0",
"@types/express": "^4.17.12",
"@types/humanize-duration": "^3",
+ "@types/lodash": "^4.14.172",
"@types/module-alias": "^2",
"@types/node": "^14.14.22",
"@types/node-fetch": "^2",
@@ -40,18 +42,10 @@
"@types/uuid": "^8.3.0",
"@types/validator": "^13.6.3",
"@typescript-eslint/eslint-plugin": "^4.14.1",
- "@typescript-eslint/parser": "^4.14.1",
- "esbuild": "^0.12.11",
- "eslint": "^7.29.0",
- "eslint-config-prettier": "^8.3.0",
- "prettier": "^2.3.2",
- "rimraf": "^3.0.2",
- "source-map-support": "^0.5.19",
- "typescript": "^4.3.5"
+ "@typescript-eslint/parser": "^4.14.1"
},
"dependencies": {
- "@discordjs/voice": "^0.4.0",
- "body-parser": "^1.19.0",
+ "@discordjs/voice": "^0.6.0",
"canvas": "^2.8.0",
"chalk": "^4.1.1",
"common-tags": "^1.8.0",
@@ -60,18 +54,26 @@
"discord-api-types": "0.22.0",
"discord.js": "NotEnoughUpdates/discord.js",
"discord.js-minesweeper": "^1.0.6",
+ "esbuild": "^0.12.11",
+ "eslint": "^7.29.0",
+ "eslint-config-prettier": "^8.3.0",
"fuse.js": "^6.4.6",
"got": "^11.8.2",
"humanize-duration": "^3.27.0",
"json5": "^2.2.0",
- "madge": "^5.0.1",
+ "lodash": "^4.17.21",
+ "mathjs": "^9.4.4",
"module-alias": "^2.2.2",
"moment": "^2.29.1",
"node-fetch": "^2.6.1",
"pg": "^8.5.1",
"pg-hstore": "^2.3.3",
+ "prettier": "^2.3.2",
+ "rimraf": "^3.0.2",
"sequelize": "^6.5.0",
+ "source-map-support": "^0.5.19",
"tinycolor2": "^1.4.2",
+ "typescript": "^4.3.5",
"uuid": "^8.3.2"
},
"eslintConfig": {
@@ -134,10 +136,5 @@
"singleQuote": true,
"trailingComma": "none"
},
- "packageManager": "yarn@3.0.0",
- "dependenciesMeta": {
- "discord.js@13.2.0-dev": {
- "unplugged": true
- }
- }
+ "packageManager": "yarn@3.0.0"
}
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index 0547bd0..1974297 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -1,29 +1,29 @@
-// import { BushCommand, BushMessage, BushSlashMessage, guildFeatures } from '@lib';
-// import { MessageEmbed } from 'discord.js';
+import { BushCommand, BushMessage, BushSlashMessage, guildFeatures } from '@lib';
+import { MessageEmbed } from 'discord.js';
-// export default class FeaturesCommand extends BushCommand {
-// public constructor() {
-// super('features', {
-// aliases: ['features'],
-// category: 'config',
-// description: {
-// content: 'Toggle features the server.',
-// usage: 'features',
-// examples: ['features']
-// },
-// slash: true,
-// channel: 'guild',
-// clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'],
-// userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD']
-// });
-// }
-// public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
-// if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
-// const featureEmbed = new MessageEmbed().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default);
-// const featureList: string[] = [];
-// const enabledFeatures = message.guild.getSetting('enabledFeatures');
-// guildFeatures.forEach(feature => {
-// featureList.push(`${}`)
-// })
-// }
-// }
+export default class FeaturesCommand extends BushCommand {
+ public constructor() {
+ super('features', {
+ aliases: ['features'],
+ category: 'config',
+ description: {
+ content: 'Toggle features the server.',
+ usage: 'features',
+ examples: ['features']
+ },
+ slash: true,
+ channel: 'guild',
+ clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'],
+ userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD']
+ });
+ }
+ public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
+ if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
+ const featureEmbed = new MessageEmbed().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default);
+ const featureList: string[] = [];
+ const enabledFeatures = await message.guild.getSetting('enabledFeatures');
+ guildFeatures.forEach((feature) => {
+ // featureList.push(`**${feature}:** ${enabledFeatures.includes(feature)? util.emojis.}`);
+ });
+ }
+}
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 151e4a1..aa421cd 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -24,7 +24,8 @@ export default class TestCommand extends BushCommand {
optional: true
}
}
- ]
+ ],
+ superUserOnly: true
});
}
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts
new file mode 100644
index 0000000..5f91dca
--- /dev/null
+++ b/src/commands/utilities/calculator.ts
@@ -0,0 +1,57 @@
+import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib';
+import { MessageEmbed } from 'discord.js';
+import { evaluate } from 'mathjs';
+
+export default class CalculatorCommand extends BushCommand {
+ public constructor() {
+ super('calculator', {
+ aliases: ['calculator', 'calc', 'math'],
+ category: 'utilities',
+ description: {
+ content: 'Calculates math expressions.',
+ usage: 'calculator <expression>',
+ examples: ['calculator ']
+ },
+ args: [
+ {
+ id: 'expression',
+ type: 'string',
+ match: 'rest',
+ prompt: {
+ start: 'What would you like to evaluate?',
+ retry: '{error} Pick something to evaluate.',
+ optional: false
+ }
+ }
+ ],
+ slash: true,
+ slashOptions: [
+ {
+ name: 'expression',
+ description: 'What would you like to evaluate?',
+ type: 'STRING',
+ required: true
+ }
+ ],
+ hidden: true,
+ clientPermissions: ['SEND_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES']
+ });
+ }
+ public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }): Promise<unknown> {
+ const decodedEmbed = new MessageEmbed()
+ .setTitle(`Calculator`)
+ .addField('📥 Input', await util.inspectCleanRedactCodeblock(args.expression, 'mma'));
+ try {
+ const calculated = evaluate(args.expression);
+ decodedEmbed
+ .setColor(util.colors.success)
+ .addField('📤 Output', await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma'));
+ } catch (error) {
+ decodedEmbed
+ .setColor(util.colors.error)
+ .addField(`📤 Error Calculating`, await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js'));
+ }
+ return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() });
+ }
+}
diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts
index 05e988a..a5a4c21 100644
--- a/src/commands/utilities/decode.ts
+++ b/src/commands/utilities/decode.ts
@@ -99,16 +99,14 @@ export default class DecodeCommand extends BushCommand {
const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias || 'decoded');
const decodedEmbed = new MessageEmbed()
.setTitle(`${encodeOrDecode} Information`)
- .addField('📥 Input', await util.inspectCleanRedactCodeblock(data, undefined));
+ .addField('📥 Input', await util.inspectCleanRedactCodeblock(data));
try {
const decoded = Buffer.from(data, from).toString(to);
- decodedEmbed
- .setColor(util.colors.success)
- .addField('📤 Output', await util.inspectCleanRedactCodeblock(decoded, undefined));
+ decodedEmbed.setColor(util.colors.success).addField('📤 Output', await util.inspectCleanRedactCodeblock(decoded));
} catch (error) {
decodedEmbed
.setColor(util.colors.error)
- .addField(`📤 Error ${encodeOrDecode.slice(1)}ing`, await util.inspectCleanRedactCodeblock(error.stack, undefined));
+ .addField(`📤 Error ${encodeOrDecode.slice(1)}ing`, await util.inspectCleanRedactCodeblock(error?.stack ?? error));
}
return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() });
}
diff --git a/src/inhibitors/blacklist/channelGlobalBlacklist.ts b/src/inhibitors/blacklist/channelGlobalBlacklist.ts
index 9bbf30f..36a6757 100644
--- a/src/inhibitors/blacklist/channelGlobalBlacklist.ts
+++ b/src/inhibitors/blacklist/channelGlobalBlacklist.ts
@@ -5,7 +5,8 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor {
super('channelGlobalBlacklist', {
reason: 'channelGlobalBlacklist',
category: 'blacklist',
- type: 'all'
+ type: 'post',
+ priority: 500
});
}
@@ -14,7 +15,6 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor {
if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id)
return false;
if (client.cache.global.blacklistedChannels.includes(message.channel!.id)) {
- // client.console.debug(`channelGlobalBlacklist blocked message.`);
return true;
}
return false;
diff --git a/src/inhibitors/blacklist/channelGuildBlacklist.ts b/src/inhibitors/blacklist/channelGuildBlacklist.ts
index b4c6f3f..54acb34 100644
--- a/src/inhibitors/blacklist/channelGuildBlacklist.ts
+++ b/src/inhibitors/blacklist/channelGuildBlacklist.ts
@@ -5,7 +5,8 @@ export default class ChannelGuildBlacklistInhibitor extends BushInhibitor {
super('channelGuildBlacklist', {
reason: 'channelGuildBlacklist',
category: 'blacklist',
- type: 'all'
+ type: 'post',
+ priority: 499
});
}
@@ -14,7 +15,6 @@ export default class ChannelGuildBlacklistInhibitor extends BushInhibitor {
if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id)
return false;
if ((await message.guild.getSetting('blacklistedChannels'))?.includes(message.channel!.id)) {
- // client.console.debug(`channelGuildBlacklist blocked message.`);
return true;
}
return false;
diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts
index de15d76..ec78995 100644
--- a/src/inhibitors/blacklist/guildBlacklist.ts
+++ b/src/inhibitors/blacklist/guildBlacklist.ts
@@ -5,7 +5,8 @@ export default class GuildBlacklistInhibitor extends BushInhibitor {
super('guildBlacklist', {
reason: 'guildBlacklist',
category: 'blacklist',
- type: 'all'
+ type: 'all',
+ priority: 50
});
}
@@ -17,7 +18,6 @@ export default class GuildBlacklistInhibitor extends BushInhibitor {
)
return false;
if (client.cache.global.blacklistedGuilds.includes(message.guild.id)) {
- // client.console.debug(`GuildBlacklistInhibitor blocked message.`);
return true;
}
return false;
diff --git a/src/inhibitors/blacklist/userGlobalBlacklist.ts b/src/inhibitors/blacklist/userGlobalBlacklist.ts
index 967943d..65d763d 100644
--- a/src/inhibitors/blacklist/userGlobalBlacklist.ts
+++ b/src/inhibitors/blacklist/userGlobalBlacklist.ts
@@ -5,7 +5,8 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor {
super('userGlobalBlacklist', {
reason: 'userGlobalBlacklist',
category: 'blacklist',
- type: 'all'
+ type: 'pre',
+ priority: 30
});
}
@@ -14,7 +15,6 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor {
if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id)
return false;
if (client.cache.global.blacklistedUsers.includes(message.author.id)) {
- // client.console.debug(`userGlobalBlacklist blocked message.`);
return true;
}
return false;
diff --git a/src/inhibitors/blacklist/userGuildBlacklist.ts b/src/inhibitors/blacklist/userGuildBlacklist.ts
index 0e28ba4..34a24d3 100644
--- a/src/inhibitors/blacklist/userGuildBlacklist.ts
+++ b/src/inhibitors/blacklist/userGuildBlacklist.ts
@@ -5,7 +5,8 @@ export default class UserGuildBlacklistInhibitor extends BushInhibitor {
super('userGuildBlacklist', {
reason: 'userGuildBlacklist',
category: 'blacklist',
- type: 'all'
+ type: 'pre',
+ priority: 20
});
}
@@ -14,7 +15,6 @@ export default class UserGuildBlacklistInhibitor extends BushInhibitor {
if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id)
return false;
if ((await message.guild.getSetting('blacklistedUsers'))?.includes(message.author.id)) {
- // client.console.debug(`userGuildBlacklist blocked message.`);
return true;
}
return false;
diff --git a/src/inhibitors/noCache.ts b/src/inhibitors/checks/fatal.ts
index 673f3ac..6b62507 100644
--- a/src/inhibitors/noCache.ts
+++ b/src/inhibitors/checks/fatal.ts
@@ -1,10 +1,11 @@
import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib';
-export default class NoCacheInhibitor extends BushInhibitor {
+export default class FatalInhibitor extends BushInhibitor {
public constructor() {
- super('noCache', {
- reason: 'noCache',
+ super('fatal', {
+ reason: 'fatal',
type: 'all',
+ category: 'checks',
priority: 100
});
}
@@ -13,7 +14,6 @@ export default class NoCacheInhibitor extends BushInhibitor {
if (client.isOwner(message.author)) return false;
for (const property in client.cache.global) {
if (!client.cache.global[property as keyof typeof client.cache.global]) {
- client.console.debug(`NoCacheInhibitor blocked message.`);
return true;
}
}