From 730f3e6a287c92d884779199306988d048d9c221 Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Sat, 13 Jan 2024 01:17:34 +0000 Subject: [PATCH] feat(arabot): add fun listener for "bad" words --- src/listeners/unholyWord.ts | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/listeners/unholyWord.ts diff --git a/src/listeners/unholyWord.ts b/src/listeners/unholyWord.ts new file mode 100644 index 0000000..61694f7 --- /dev/null +++ b/src/listeners/unholyWord.ts @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +/* + Animal Rights Advocates Discord Bot + Copyright (C) 2024 Anthony Berg + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +import { Listener } from '@sapphire/framework'; +import { GuildMember, Message } from 'discord.js'; +import { Time } from '@sapphire/time-utilities'; + +export class UnholyWordListener extends Listener { + public constructor( + context: Listener.LoaderContext, + options: Listener.Options, + ) { + super(context, { + ...options, + event: 'messageCreate', + }); + } + + public async run(message: Message) { + const content = message.content.toLowerCase(); + if (!content.includes('squart')) return; + + const member = message.member; + if (!(member instanceof GuildMember)) return; + + await member.timeout(Time.Day * 28); + + await new Promise((f) => setTimeout(f, Time.Second * 15)); + + await member.timeout(null); + await message.reply( + "HAHA GET PRANKED XDDDDDD!!!111 DON'T USE THAT UNHOLY WORD NEXT TIME", + ); + } +}