aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-31 21:27:15 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-31 21:27:15 -0500
commit1084f12f92aac797c9605eeb276282230056a9eb (patch)
tree2e4ffa8707b2ffdde71513cdd557c119ec55bf42 /src/commands
parenta8ba0741299794ff75286b3eeb91d6e66199d297 (diff)
downloadtanzanite-1084f12f92aac797c9605eeb276282230056a9eb.tar.gz
tanzanite-1084f12f92aac797c9605eeb276282230056a9eb.tar.bz2
tanzanite-1084f12f92aac797c9605eeb276282230056a9eb.zip
added SyncAutomodCommand
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/dev/syncAutomod.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/commands/dev/syncAutomod.ts b/src/commands/dev/syncAutomod.ts
new file mode 100644
index 0000000..523a624
--- /dev/null
+++ b/src/commands/dev/syncAutomod.ts
@@ -0,0 +1,43 @@
+import { BushCommand, Shared, type BushMessage, type BushSlashMessage } from '#lib';
+import got from 'got';
+import typescript from 'typescript';
+import { NodeVM } from 'vm2';
+
+export default class SyncAutomodCommand extends BushCommand {
+ public constructor() {
+ super('sync-automod', {
+ aliases: ['sync-automod'],
+ category: 'dev',
+ description: 'Syncs automod info with the github repository.',
+ usage: ['sync-automod'],
+ examples: ['sync-automod'],
+ slash: false,
+ hidden: true,
+ clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ userPermissions: []
+ });
+ }
+
+ public override async exec(message: BushMessage | BushSlashMessage) {
+ if (!message.author.isOwner() && message.author.id !== '497789163555389441')
+ return await message.util.reply(`${util.emojis.error} Only a very select few may use this command.`);
+
+ const badLinks = (await got.get('https://raw.githubusercontent.com/NotEnoughUpdates/bush-bot/master/src/lib/badlinks.ts'))
+ .body;
+ const badWords = (await got.get('https://raw.githubusercontent.com/NotEnoughUpdates/bush-bot/master/src/lib/badwords.ts'))
+ .body;
+
+ const transpiledBadLinks = typescript.transpileModule(badLinks, {}).outputText;
+ const transpiledBadWords = typescript.transpileModule(badWords, {}).outputText;
+
+ const badLinksParsed = new NodeVM({}).run(transpiledBadLinks).default;
+ const badWordsParsed = new NodeVM({}).run(transpiledBadWords).default;
+
+ const row = (await Shared.findByPk(0))!;
+ row.badLinks = badLinksParsed;
+ row.badWords = badWordsParsed;
+ await row.save();
+
+ return await message.util.reply(`${util.emojis.success} Automod info synced.`);
+ }
+}