From 5d33e1aa43444850084b4794b7d870e67dbb474e Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Mon, 23 Aug 2021 20:17:13 -0400 Subject: bunch of shit --- .gitignore | 2 +- .vscode/extensions.json | 3 +- lib/assets/Roboto-Regular.ttf | Bin 0 -> 168260 bytes lib/badlinks.json5 | 373 ++++++ lib/badwords.json5 | 26 + package.json | 31 +- src/commands/config/features.ts | 56 +- src/commands/dev/test.ts | 3 +- src/commands/utilities/calculator.ts | 57 + src/commands/utilities/decode.ts | 8 +- src/inhibitors/blacklist/channelGlobalBlacklist.ts | 4 +- src/inhibitors/blacklist/channelGuildBlacklist.ts | 4 +- src/inhibitors/blacklist/guildBlacklist.ts | 4 +- src/inhibitors/blacklist/userGlobalBlacklist.ts | 4 +- src/inhibitors/blacklist/userGuildBlacklist.ts | 4 +- src/inhibitors/checks/fatal.ts | 22 + src/inhibitors/checks/guildUnavailable.ts | 19 + src/inhibitors/command/dm.ts | 19 + src/inhibitors/command/globalDisabledCommand.ts | 20 + src/inhibitors/command/guild.ts | 19 + src/inhibitors/command/guildDisabledCommand.ts | 22 + src/inhibitors/command/nsfw.ts | 20 + src/inhibitors/command/owner.ts | 21 + src/inhibitors/command/restrictedChannel.ts | 21 + src/inhibitors/command/restrictedGuild.ts | 21 + src/inhibitors/command/superUser.ts | 21 + src/inhibitors/commands/globalDisabledCommand.ts | 20 - src/inhibitors/commands/guildDisabledCommand.ts | 22 - src/inhibitors/noCache.ts | 22 - src/lib/assets/Roboto-Regular.ttf | Bin 168260 -> 0 bytes src/lib/badlinks.json | 372 ------ src/lib/badwords.json | 20 - .../discord-akairo/BushCommandHandler.ts | 68 +- .../extensions/discord-akairo/BushSlashMessage.ts | 5 +- src/listeners/commands/commandBlocked.ts | 52 +- src/listeners/commands/messageBlocked.ts | 17 + src/listeners/message/automodCreate.ts | 11 +- tsconfig.json | 3 +- yarn.lock | 1211 ++------------------ 39 files changed, 937 insertions(+), 1690 deletions(-) create mode 100644 lib/assets/Roboto-Regular.ttf create mode 100644 lib/badlinks.json5 create mode 100644 lib/badwords.json5 create mode 100644 src/commands/utilities/calculator.ts create mode 100644 src/inhibitors/checks/fatal.ts create mode 100644 src/inhibitors/checks/guildUnavailable.ts create mode 100644 src/inhibitors/command/dm.ts create mode 100644 src/inhibitors/command/globalDisabledCommand.ts create mode 100644 src/inhibitors/command/guild.ts create mode 100644 src/inhibitors/command/guildDisabledCommand.ts create mode 100644 src/inhibitors/command/nsfw.ts create mode 100644 src/inhibitors/command/owner.ts create mode 100644 src/inhibitors/command/restrictedChannel.ts create mode 100644 src/inhibitors/command/restrictedGuild.ts create mode 100644 src/inhibitors/command/superUser.ts delete mode 100644 src/inhibitors/commands/globalDisabledCommand.ts delete mode 100644 src/inhibitors/commands/guildDisabledCommand.ts delete mode 100644 src/inhibitors/noCache.ts delete mode 100644 src/lib/assets/Roboto-Regular.ttf delete mode 100644 src/lib/badlinks.json delete mode 100644 src/lib/badwords.json create mode 100644 src/listeners/commands/messageBlocked.ts 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/lib/assets/Roboto-Regular.ttf b/lib/assets/Roboto-Regular.ttf new file mode 100644 index 0000000..3d6861b Binary files /dev/null and b/lib/assets/Roboto-Regular.ttf 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 { -// 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 { + 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 ', + 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 { + 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/checks/fatal.ts b/src/inhibitors/checks/fatal.ts new file mode 100644 index 0000000..6b62507 --- /dev/null +++ b/src/inhibitors/checks/fatal.ts @@ -0,0 +1,22 @@ +import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class FatalInhibitor extends BushInhibitor { + public constructor() { + super('fatal', { + reason: 'fatal', + type: 'all', + category: 'checks', + priority: 100 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage): Promise { + 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]) { + return true; + } + } + return false; + } +} diff --git a/src/inhibitors/checks/guildUnavailable.ts b/src/inhibitors/checks/guildUnavailable.ts new file mode 100644 index 0000000..0bd1bec --- /dev/null +++ b/src/inhibitors/checks/guildUnavailable.ts @@ -0,0 +1,19 @@ +import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class GuildUnavailableInhibitor extends BushInhibitor { + public constructor() { + super('guildUnavailable', { + reason: 'guildUnavailable', + type: 'all', + category: 'checks', + priority: 70 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage): Promise { + if (message.guild && !message.guild.available) { + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/dm.ts b/src/inhibitors/command/dm.ts new file mode 100644 index 0000000..4e9c53e --- /dev/null +++ b/src/inhibitors/command/dm.ts @@ -0,0 +1,19 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class DMInhibitor extends BushInhibitor { + public constructor() { + super('dm', { + reason: 'dm', + category: 'command', + type: 'post', + priority: 75 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (command.channel === 'dm' && message.guild) { + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/globalDisabledCommand.ts new file mode 100644 index 0000000..a6e24c7 --- /dev/null +++ b/src/inhibitors/command/globalDisabledCommand.ts @@ -0,0 +1,20 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class DisabledGuildCommandInhibitor extends BushInhibitor { + public constructor() { + super('disabledGlobalCommand', { + reason: 'disabledGlobal', + category: 'command', + type: 'post', + priority: 300 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (message.author.isOwner()) return false; + if (client.cache.global.disabledCommands?.includes(command?.id)) { + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/guild.ts b/src/inhibitors/command/guild.ts new file mode 100644 index 0000000..b960439 --- /dev/null +++ b/src/inhibitors/command/guild.ts @@ -0,0 +1,19 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class GuildInhibitor extends BushInhibitor { + public constructor() { + super('guild', { + reason: 'guild', + category: 'command', + type: 'post', + priority: 80 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (command.channel === 'guild' && !message.guild) { + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/guildDisabledCommand.ts new file mode 100644 index 0000000..d56e42c --- /dev/null +++ b/src/inhibitors/command/guildDisabledCommand.ts @@ -0,0 +1,22 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class DisabledGuildCommandInhibitor extends BushInhibitor { + public constructor() { + super('disabledGuildCommand', { + reason: 'disabledGuild', + category: 'command', + type: 'post', + priority: 250 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (!message.guild || !message.guild) return false; + if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands + + if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/nsfw.ts b/src/inhibitors/command/nsfw.ts new file mode 100644 index 0000000..563cb7a --- /dev/null +++ b/src/inhibitors/command/nsfw.ts @@ -0,0 +1,20 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; +import { TextChannel } from 'discord.js'; + +export default class NsfwInhibitor extends BushInhibitor { + public constructor() { + super('nsfw', { + reason: 'notNsfw', + category: 'command', + type: 'post', + priority: 25 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/owner.ts b/src/inhibitors/command/owner.ts new file mode 100644 index 0000000..22ac913 --- /dev/null +++ b/src/inhibitors/command/owner.ts @@ -0,0 +1,21 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class OwnerInhibitor extends BushInhibitor { + public constructor() { + super('owner', { + reason: 'owner', + category: 'command', + type: 'post', + priority: 100 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (command.ownerOnly) { + if (!client.isOwner(message.author)) { + return true; + } + } + return false; + } +} diff --git a/src/inhibitors/command/restrictedChannel.ts b/src/inhibitors/command/restrictedChannel.ts new file mode 100644 index 0000000..4578d95 --- /dev/null +++ b/src/inhibitors/command/restrictedChannel.ts @@ -0,0 +1,21 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class RestrictedChannelInhibitor extends BushInhibitor { + public constructor() { + super('restrictedChannel', { + reason: 'restrictedChannel', + category: 'command', + type: 'post', + priority: 10 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (command.restrictedChannels?.length && message.channel) { + if (!command.restrictedChannels.includes(message.channel.id)) { + return true; + } + } + return false; + } +} diff --git a/src/inhibitors/command/restrictedGuild.ts b/src/inhibitors/command/restrictedGuild.ts new file mode 100644 index 0000000..7ec6926 --- /dev/null +++ b/src/inhibitors/command/restrictedGuild.ts @@ -0,0 +1,21 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class RestrictedGuildInhibitor extends BushInhibitor { + public constructor() { + super('restrictedGuild', { + reason: 'restrictedGuild', + category: 'command', + type: 'post', + priority: 5 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (command.restrictedChannels?.length && message.channel) { + if (!command.restrictedChannels.includes(message.channel.id)) { + return true; + } + } + return false; + } +} diff --git a/src/inhibitors/command/superUser.ts b/src/inhibitors/command/superUser.ts new file mode 100644 index 0000000..28674ea --- /dev/null +++ b/src/inhibitors/command/superUser.ts @@ -0,0 +1,21 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class SuperUserInhibitor extends BushInhibitor { + public constructor() { + super('superUser', { + reason: 'superUser', + category: 'command', + type: 'post', + priority: 99 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { + if (command.superUserOnly) { + if (!client.isSuperUser(message.author)) { + return true; + } + } + return false; + } +} diff --git a/src/inhibitors/commands/globalDisabledCommand.ts b/src/inhibitors/commands/globalDisabledCommand.ts deleted file mode 100644 index 9a750cc..0000000 --- a/src/inhibitors/commands/globalDisabledCommand.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; - -export default class DisabledGuildCommandInhibitor extends BushInhibitor { - public constructor() { - super('disabledGlobalCommand', { - reason: 'disabledGlobal', - type: 'pre', - priority: 4 - }); - } - - public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { - if (message.author.isOwner()) return false; - if (client.cache.global.disabledCommands?.includes(command?.id)) { - client.console.debug(`disabledGlobalCommand blocked message.`); - return true; - } - return false; - } -} diff --git a/src/inhibitors/commands/guildDisabledCommand.ts b/src/inhibitors/commands/guildDisabledCommand.ts deleted file mode 100644 index ee798e5..0000000 --- a/src/inhibitors/commands/guildDisabledCommand.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; - -export default class DisabledGuildCommandInhibitor extends BushInhibitor { - public constructor() { - super('disabledGuildCommand', { - reason: 'disabledGuild', - type: 'pre', - priority: 3 - }); - } - - public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { - if (!message.guild || !message.guild) return false; - if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands - - if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { - client.console.debug(`disabledGuildCommand blocked message.`); - return true; - } - return false; - } -} diff --git a/src/inhibitors/noCache.ts b/src/inhibitors/noCache.ts deleted file mode 100644 index 673f3ac..0000000 --- a/src/inhibitors/noCache.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; - -export default class NoCacheInhibitor extends BushInhibitor { - public constructor() { - super('noCache', { - reason: 'noCache', - type: 'all', - priority: 100 - }); - } - - public override async exec(message: BushMessage | BushSlashMessage): Promise { - 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; - } - } - return false; - } -} diff --git a/src/lib/assets/Roboto-Regular.ttf b/src/lib/assets/Roboto-Regular.ttf deleted file mode 100644 index 3d6861b..0000000 Binary files a/src/lib/assets/Roboto-Regular.ttf and /dev/null differ diff --git a/src/lib/badlinks.json b/src/lib/badlinks.json deleted file mode 100644 index 39212b5..0000000 --- a/src/lib/badlinks.json +++ /dev/null @@ -1,372 +0,0 @@ -[ - "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", - "dicsord.gifts", - "discod.gift", - "discord-gifts.com", - "discord-nitro.gifts", - "discord.blog", - "discord.shop", - "discordgivenitro.com", - "discrod.gift", - "disrcod.com", - "dlscord.info", - "dlscord.online", - "dlscord.press", - "dlscord.store", - "dlscord.world", - "discrod.gifts", - "dlscord.wiki", - "dirscod.gift", - "dirscod.com", - "discorcl.link", - "discod.info", - "dicsord.net", - "discorb.co", - "dicsord.net", - "dicksod.co", - "diskord.ru.com", - "discord-nitro.link", - "discorb.ru.com", - "discordnitrogift.ru", - "discorcl.click", - "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-skins.ru", - "free-nitro.ru", - "freenitros.ru", - "free-nitros.ru", - "freenitroi.ru", - "g2-give.ru", - "g2-give.ru", - "game4roll.com", - "gameluck.ru", - "gamerich.xyz", - "games-roll.ga", - "games-roll.ml", - "games-roll.ru", - "gift4keys.com", - "giveavvay.com", - "giveawayskin.com", - "global-skins.gq", - "globalcsskins.xyz", - "globalskins.tk", - "goldendota.com", - "goodskins.gq", - "gosteamanalyst.com", - "gtakey.ru", - "go.rancah.com", - "giftsdiscord.ru", - "get-nitro.net", - "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", - "makson-gta.ru", - "maxskins.xyz", - "mvcsgo.com", - "mvpcup.ru", - "mvptournament.com", - "mygames4roll.com", - "made-nitro.com", - "naviback.ru", - "night-skins.com", - "nitros-gift.com", - "nitro-discord.org", - "nwgwroqr.ru", - "ownerbets.com", - "oligarph.club", - "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-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", - "steamcommunityu.com", - "steamcommunityw.com", - "steamcommunlty.pro", - "steamcommunutiy.com", - "steamcommunytiu.ru", - "steamcommunytu.ru", - "steamcommutiny.com", - "steamcommynitu.ru", - "steamcomnmuituy.com", - "steamcomnumity.ru", - "steamcomrnunity.ru", - "steamcomrrnunity.com", - "steamcomrunity.com", - "steamconmunlty.com", - "steamcormmuntiy.com", - "steamgamesroll.ru", - "steamncommuniity.com", - "steamncommunity.com", - "steamnmcomunnity.co", - "steamoemmunity.com", - "steamsupportpowered.icu", - "steancommynity.ru.com", - "steancomnunytu.ru", - "steancomunnity.ru", - "steancomunyiti.ru", - "stearmcommunnitty.online", - "stearmmcomunitty.ru", - "stearmmcomunity.ru", - "stearmmcomuunity.ru", - "stearncomminuty.ru", - "stearncommunity.ru", - "stearncommunytiy.ru", - "stearncormmunity.com", - "steemcommnunity.ru", - "stemcommunnilty.com", - "stermccommunitty.ru", - "stermcommuniity.com", - "stewie2k-giveaway-150days.pro", - "stiemcommunitty.ru", - "store-stempowered.com", - "streamcommulinty.com", - "streamcommuninnity.com", - "streamcommuunnity.com", - "streamcomnumity.ru", - "streamcomunity.com", - "streammcomunnity.ru", - "streancommunuty.ru", - "streancommunuty.ru", - "strearmcommunity.ru", - "strearmcomunity.ru", - "steamcommunityu.ru", - "steamcommunrlity.com", - "stearncommuty.com", - "steamcommunitiyu.com", - "stermcommunnitty.ru", - "steamcommunitlu.com", - "steamcommunity.link", - "steancommunity.link", - "steamcomuniity.ru.com", - "steam-nitro.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", - "stmeacomunnitty.ru", - "discrodnitro.org" -] diff --git a/src/lib/badwords.json b/src/lib/badwords.json deleted file mode 100644 index fc7a5d6..0000000 --- a/src/lib/badwords.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "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/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts index 21984ab..44a0966 100644 --- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts +++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts @@ -9,7 +9,6 @@ import { BushSlashMessage } from './BushSlashMessage'; export type BushCommandHandlerOptions = CommandHandlerOptions; const commandHandlerEvents = BushConstants.CommandHandlerEvents; -const blockedReasons = BushConstants.BlockedReasons; export interface BushCommandHandlerEvents extends CommandHandlerEvents { commandBlocked: [message: BushMessage, command: BushCommand, reason: string]; @@ -34,76 +33,17 @@ export class BushCommandHandler extends CommandHandler { super(client, options); } - // protected override setup(): void { - // super.setup(); - // } - public override async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise { - if (command.ownerOnly) { - const isOwner = client.isOwner(message.author); - if (!isOwner) { - this.emit( - slash ? commandHandlerEvents.SLASH_BLOCKED : commandHandlerEvents.COMMAND_BLOCKED, - message, - command, - blockedReasons.OWNER - ); - return true; - } - } - - if (command.superUserOnly) { - const isSuperUser = client.isSuperUser(message.author); - if (!isSuperUser) { - this.emit( - slash ? commandHandlerEvents.SLASH_BLOCKED : commandHandlerEvents.COMMAND_BLOCKED, - message, - command, - blockedReasons.OWNER - ); - return true; - } - } - - if (command.channel === 'guild' && !message.guild) { - this.emit( - slash ? commandHandlerEvents.SLASH_BLOCKED : commandHandlerEvents.COMMAND_BLOCKED, - message, - command, - blockedReasons.GUILD - ); + const reason = this.inhibitorHandler ? await this.inhibitorHandler.test('post', message, command) : null; + if (reason != null) { + this.emit(slash ? commandHandlerEvents.SLASH_BLOCKED : commandHandlerEvents.COMMAND_BLOCKED, message, command, reason); return true; } - if (command.channel === 'dm' && message.guild) { - this.emit( - slash ? commandHandlerEvents.SLASH_BLOCKED : commandHandlerEvents.COMMAND_BLOCKED, - message, - command, - blockedReasons.DM - ); - return true; - } - if (command.restrictedChannels?.length && message.channel) { - if (!command.restrictedChannels.includes(message.channel.id)) { - this.emit(commandHandlerEvents.COMMAND_BLOCKED, message, command, blockedReasons.RESTRICTED_CHANNEL); - return true; - } - } - if (command.restrictedGuilds?.length && message.guild) { - if (!command.restrictedGuilds.includes(message.guild.id)) { - this.emit(commandHandlerEvents.COMMAND_BLOCKED, message, command, blockedReasons.RESTRICTED_GUILD); - return true; - } - } if (await this.runPermissionChecks(message, command)) { return true; } - const reason = this.inhibitorHandler ? await this.inhibitorHandler.test('post', message, command) : null; - if (reason != null) { - this.emit(commandHandlerEvents.COMMAND_BLOCKED, message, command, reason); - return true; - } + return !!this.runCooldowns(message, command); } } diff --git a/src/lib/extensions/discord-akairo/BushSlashMessage.ts b/src/lib/extensions/discord-akairo/BushSlashMessage.ts index 215cf79..d10a024 100644 --- a/src/lib/extensions/discord-akairo/BushSlashMessage.ts +++ b/src/lib/extensions/discord-akairo/BushSlashMessage.ts @@ -10,10 +10,13 @@ import { BushCommandUtil } from './BushCommandUtil'; export class BushSlashMessage extends AkairoMessage { public declare client: BushClient; public declare util: BushCommandUtil; - public declare guild: BushGuild; public declare author: BushUser; public declare member: BushGuildMember; public constructor(client: BushClient, interaction: CommandInteraction, command: BushCommand) { super(client, interaction, command); } + + public override get guild(): BushGuild | null { + return super.guild as BushGuild | null; + } } diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 485de37..03e34f5 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -1,4 +1,5 @@ -import { BushCommandHandlerEvents, BushListener, BushMessage } from '@lib'; +import { BushCommand, BushCommandHandlerEvents, BushListener, BushMessage, BushSlashMessage } from '@lib'; +import { InteractionReplyOptions, Message, MessagePayload, ReplyMessageOptions } from 'discord.js'; export default class CommandBlockedListener extends BushListener { public constructor() { @@ -13,38 +14,42 @@ export default class CommandBlockedListener extends BushListener { } public static async handleBlocked( - ...[message, command, reason]: BushCommandHandlerEvents['commandBlocked'] | BushCommandHandlerEvents['slashBlocked'] + message: Message | BushMessage | BushSlashMessage, + command: BushCommand | null, + reason?: string ): Promise { - const isSlash = message.util.isSlash; + const isSlash = !!command && !!message.util?.isSlash; void client.console.info( `${isSlash ? 'Slash' : 'Command'}Blocked`, - `<<${message.author.tag}>> tried to run <<${command}>> but was blocked because <<${reason}>>.`, + `<<${message.author.tag}>>${ + command ? ` tried to run <<${command}>> but` : "'s message" + } was blocked because <<${reason}>>.`, true ); const reasons = client.consts.BlockedReasons; switch (reason) { case reasons.OWNER: { - return await message.util.reply({ + return await respond({ content: `${util.emojis.error} Only my developers can run the \`${command}\` command.`, ephemeral: true }); } case reasons.SUPER_USER: { - return await message.util.reply({ + return await respond({ content: `${util.emojis.error} You must be a superuser to run the \`${command}\` command.`, ephemeral: true }); } case reasons.DISABLED_GLOBAL: { - return await message.util.reply({ + return await respond({ content: `${util.emojis.error} My developers disabled the \`${command}\` command.`, ephemeral: true }); } case reasons.DISABLED_GUILD: { - return await message.util.reply({ + return await respond({ content: `${util.emojis.error} The \`${command}\` command is currently disabled in \`${message.guild?.name}\`.`, ephemeral: true }); @@ -52,51 +57,64 @@ export default class CommandBlockedListener extends BushListener { case reasons.CHANNEL_GLOBAL_BLACKLIST: case reasons.CHANNEL_GUILD_BLACKLIST: return isSlash - ? message.util.reply({ content: `${util.emojis.error} You cannot use this bot in this channel.`, ephemeral: true }) - : (message as BushMessage).react(util.emojis.error); + ? await respond({ + content: `${util.emojis.error} You cannot use this bot in this channel.`, + ephemeral: true + }) + : await (message as BushMessage).react(util.emojis.cross); case reasons.USER_GLOBAL_BLACKLIST: case reasons.USER_GUILD_BLACKLIST: return isSlash - ? message.util.reply({ content: `${util.emojis.error} You are blacklisted from using this bot.`, ephemeral: true }) - : (message as BushMessage).react(util.emojis.error); + ? await respond({ + content: `${util.emojis.error} You are blacklisted from using this bot.`, + ephemeral: true + }) + : await (message as BushMessage).react(util.emojis.cross); case reasons.ROLE_BLACKLIST: { return isSlash - ? message.util.reply({ + ? await respond({ content: `${util.emojis.error} One of your roles blacklists you from using this bot.`, ephemeral: true }) - : (message as BushMessage).react(util.emojis.error); + : await (message as BushMessage).react(util.emojis.cross); } case reasons.RESTRICTED_CHANNEL: { + if (!command) break; const channels = command.restrictedChannels; const names: string[] = []; channels.forEach((c) => { names.push(`<#${c}>`); }); const pretty = util.oxford(names, 'and'); - return await message.util.reply({ + return await respond({ content: `${util.emojis.error} \`${command}\` can only be run in ${pretty}.`, ephemeral: true }); } case reasons.RESTRICTED_GUILD: { + if (!command) break; const guilds = command.restrictedGuilds; const names: string[] = []; guilds.forEach((g) => { names.push(`\`${client.guilds.cache.get(g)?.name}\``); }); const pretty = util.oxford(names, 'and'); - return await message.util.reply({ + return await respond({ content: `${util.emojis.error} \`${command}\` can only be run in ${pretty}.`, ephemeral: true }); } default: { - return await message.util.reply({ + return await respond({ content: `${util.emojis.error} Command blocked with reason \`${reason}\``, ephemeral: true }); } } + + // some inhibitors do not have message.util yet + function respond(content: string | MessagePayload | ReplyMessageOptions | InteractionReplyOptions) { + return message.util ? message.util.reply(content) : message.reply(content); + } } } diff --git a/src/listeners/commands/messageBlocked.ts b/src/listeners/commands/messageBlocked.ts new file mode 100644 index 0000000..a36c03d --- /dev/null +++ b/src/listeners/commands/messageBlocked.ts @@ -0,0 +1,17 @@ +import { BushCommandHandlerEvents, BushListener } from '@lib'; + +export default class MessageBlockedListener extends BushListener { + public constructor() { + super('messageBlocked', { + emitter: 'commandHandler', + event: 'messageBlocked' + }); + } + + public override async exec(...[message, reason]: BushCommandHandlerEvents['messageBlocked']): Promise { + const reasons = client.consts.BlockedReasons; + if ([reasons.CLIENT, reasons.BOT].includes(reason)) return; + // return await CommandBlockedListener.handleBlocked(message as Message, null, reason); + return void client.console.verbose(`MessageBlocked`, `<<${message.author.tag}>>'s message was blocked because ${reason}`); + } +} diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts index 3f1780f..cfe3970 100644 --- a/src/listeners/message/automodCreate.ts +++ b/src/listeners/message/automodCreate.ts @@ -1,8 +1,11 @@ import { BushListener, BushMessage } from '@lib'; +// @ts-expect-error: ts doesn't recognize json5 +import _badLinks from '@root/lib/badlinks'; // Stolen from https://github.com/nacrt/SkyblockClient-REPO/blob/main/files/scamlinks.json +// @ts-expect-error: ts doesn't recognize json5 +import _badLinksSecret from '@root/lib/badlinks-secret'; // shhhh +// @ts-expect-error: ts doesn't recognize json5 +import badWords from '@root/lib/badwords'; import { MessageEmbed, TextChannel } from 'discord.js'; -import _badLinksSecret from '../../lib/badlinks-secret.json'; // shhhh -import _badLinks from '../../lib/badlinks.json'; // Stolen from https://github.com/nacrt/SkyblockClient-REPO/blob/main/files/scamlinks.json -import badWords from '../../lib/badwords.json'; import { BushClientEvents } from '../../lib/extensions/discord.js/BushClientEvents'; export default class AutomodMessageCreateListener extends BushListener { @@ -26,7 +29,7 @@ export default class AutomodMessageCreateListener extends BushListener { let temp = _badLinks; if (_badLinksSecret) temp = temp.concat(_badLinksSecret); - temp.forEach((link) => { + temp.forEach((link: string) => { badLinks[link] = 3; }); diff --git a/tsconfig.json b/tsconfig.json index a94bb7c..d6394be 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,8 @@ "baseUrl": "./", "paths": { "src/*": ["./src/*"], - "@lib": ["./src/lib"] + "@lib": ["./src/lib"], + "@root": ["."] } }, "include": ["src/**/*.ts"], diff --git a/yarn.lock b/yarn.lock index 515ec76..4154adf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,7 +14,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.14.5, @babel/helper-validator-identifier@npm:^7.14.9": +"@babel/helper-validator-identifier@npm:^7.14.5": version: 7.14.9 resolution: "@babel/helper-validator-identifier@npm:7.14.9" checksum: 58552531a7674363e74672434c312ddaf1545b8a43308e1a7f38db58bf79c796c095a6dab6a6105eb0d783b97441f6cbb525bb887f29a35f232fcdbd8cb240dc @@ -32,22 +32,12 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.0.0": +"@babel/runtime@npm:^7.14.6": version: 7.15.3 - resolution: "@babel/parser@npm:7.15.3" - bin: - parser: ./bin/babel-parser.js - checksum: 4b9ba7e8ffe0a3d0dd8c61dee975c79863f7744177de677cb7d12f96549eb5c8b9ffc70ca2b1b2488b06e056da99a6273e2d7d68fc31f498d01483dfac149e13 - languageName: node - linkType: hard - -"@babel/types@npm:^7.8.3": - version: 7.15.0 - resolution: "@babel/types@npm:7.15.0" + resolution: "@babel/runtime@npm:7.15.3" dependencies: - "@babel/helper-validator-identifier": ^7.14.9 - to-fast-properties: ^2.0.0 - checksum: 6d6bcdfce94b5446520a24087c6dede453e28425af092965b304d4028e9bca79712fd691cdad031e3570c7667bf3206e5f642bcccbfccb33d42ca4a8203587f9 + regenerator-runtime: ^0.13.4 + checksum: 2f0b8d2d4e36035ab1d84af0ec26aafa098536870f27c8e07de0a0e398f7a394fdea68a88165535ffb52ded6a68912bdc3450bdf91f229eb132e1c89470789f5 languageName: node linkType: hard @@ -82,16 +72,16 @@ __metadata: languageName: node linkType: hard -"@discordjs/voice@npm:^0.4.0": - version: 0.4.0 - resolution: "@discordjs/voice@npm:0.4.0" +"@discordjs/voice@npm:^0.6.0": + version: 0.6.0 + resolution: "@discordjs/voice@npm:0.6.0" dependencies: "@types/ws": ^7.4.4 - discord-api-types: ^0.18.1 + discord-api-types: ^0.22.0 prism-media: ^1.3.1 tiny-typed-emitter: ^2.0.3 ws: ^7.4.4 - checksum: 3cfed23e8ba008bad15274b0dcbce8019921836504088cfb2c984c7509fee48923f1252fa5b05ffea0f360e78f2e56fbf7f191a607afc61a6d2d4bca8d6765b2 + checksum: 2706185620abe148b07ce592e612eece40fc4fe9506a5b0c19e59c9e7c70a5451f9c7baf2cf38a05f8d564c9ff9a081a88cfcba00493e03eada83ce5fc83aa49 languageName: node linkType: hard @@ -307,6 +297,13 @@ __metadata: languageName: node linkType: hard +"@types/lodash@npm:^4.14.172": + version: 4.14.172 + resolution: "@types/lodash@npm:4.14.172" + checksum: 5fc51ea40d7e455bd1c760bcc60c9e81f82d85988666d4d4969bd8311367c63bbf1fe2be48755ba87836710e45fff94014ec164ebe6ccaa72815014981152434 + languageName: node + linkType: hard + "@types/mime@npm:^1": version: 1.3.2 resolution: "@types/mime@npm:1.3.2" @@ -332,16 +329,16 @@ __metadata: linkType: hard "@types/node@npm:*": - version: 16.6.2 - resolution: "@types/node@npm:16.6.2" - checksum: 2245e50058ac49ab3d76af5ded7fc655d783a88a800139dad6caaf962f15c909287853012c9461b49600741bcc2b09042f94ce734f0440b6ad444d838e62904a + version: 16.7.1 + resolution: "@types/node@npm:16.7.1" + checksum: fcf1a2c7b1f19c2201574b2110176b49c6efd824a39b2ed8ac3e6688740e2a35bef95a3334dfa345f4bd4873fd8b79d8ac8cfcc9fcd3d2f4f8f993c2c37ce4ab languageName: node linkType: hard "@types/node@npm:^14.14.22": - version: 14.17.10 - resolution: "@types/node@npm:14.17.10" - checksum: ec618cb3e0223e6707c97f88ab8525a2addecfa6dc7b7dfb9e6b56f144d8ac47083bfe3fd7a8040e5234f9b7d46c6a5c0bb24ed0129815b6efe82d0f4a55ba60 + version: 14.17.11 + resolution: "@types/node@npm:14.17.11" + checksum: 94192a5f6f5da51a10dfa959049a5cfcff440fbeeefbf98084083c1370a107872fc7f4a2df42f100989dea873cb4128f376d5e4af6be43fec21273359d9dbdb0 languageName: node linkType: hard @@ -479,7 +476,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:4.29.2, @typescript-eslint/typescript-estree@npm:^4.8.2": +"@typescript-eslint/typescript-estree@npm:4.29.2": version: 4.29.2 resolution: "@typescript-eslint/typescript-estree@npm:4.29.2" dependencies: @@ -639,13 +636,6 @@ __metadata: languageName: node linkType: hard -"app-module-path@npm:^2.2.0": - version: 2.2.0 - resolution: "app-module-path@npm:2.2.0" - checksum: b52aa49cfa809efbad41b514222e8ef3f8ee9e147f5eccf79280b45eddcc61f7aeb302b0049474e3f42072dd53a28348c57dd96f36cd461d2e31cc8ab1ef56b5 - languageName: node - linkType: hard - "aproba@npm:^1.0.3": version: 1.2.0 resolution: "aproba@npm:1.2.0" @@ -679,13 +669,6 @@ __metadata: languageName: node linkType: hard -"ast-module-types@npm:^2.3.2, ast-module-types@npm:^2.4.0, ast-module-types@npm:^2.7.0, ast-module-types@npm:^2.7.1": - version: 2.7.1 - resolution: "ast-module-types@npm:2.7.1" - checksum: 6238647bcf34eeff2a1390cb60388da8a5064dd598acf48d68f8d972d9a332dc8d0382a5a7c511b16470e314b313bcbb95de4b0b669515393e043282c0489538 - languageName: node - linkType: hard - "astral-regex@npm:^2.0.0": version: 2.0.0 resolution: "astral-regex@npm:2.0.0" @@ -707,42 +690,6 @@ __metadata: languageName: node linkType: hard -"base64-js@npm:^1.3.1": - version: 1.5.1 - resolution: "base64-js@npm:1.5.1" - checksum: 669632eb3745404c2f822a18fc3a0122d2f9a7a13f7fb8b5823ee19d1d2ff9ee5b52c53367176ea4ad093c332fd5ab4bd0ebae5a8e27917a4105a4cfc86b1005 - languageName: node - linkType: hard - -"bl@npm:^4.1.0": - version: 4.1.0 - resolution: "bl@npm:4.1.0" - dependencies: - buffer: ^5.5.0 - inherits: ^2.0.4 - readable-stream: ^3.4.0 - checksum: 9e8521fa7e83aa9427c6f8ccdcba6e8167ef30cc9a22df26effcc5ab682ef91d2cbc23a239f945d099289e4bbcfae7a192e9c28c84c6202e710a0dfec3722662 - languageName: node - linkType: hard - -"body-parser@npm:^1.19.0": - version: 1.19.0 - resolution: "body-parser@npm:1.19.0" - dependencies: - bytes: 3.1.0 - content-type: ~1.0.4 - debug: 2.6.9 - depd: ~1.1.2 - http-errors: 1.7.2 - iconv-lite: 0.4.24 - on-finished: ~2.3.0 - qs: 6.7.0 - raw-body: 2.4.0 - type-is: ~1.6.17 - checksum: 490231b4c89bbd43112762f7ba8e5342c174a6c9f64284a3b0fcabf63277e332f8316765596f1e5b15e4f3a6cf0422e005f4bb3149ed3a224bb025b7a36b9ac1 - languageName: node - linkType: hard - "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -776,24 +723,15 @@ __metadata: languageName: node linkType: hard -"buffer@npm:^5.5.0": - version: 5.7.1 - resolution: "buffer@