From cec0d64109669febb7a422f92c1704c2f92fd924 Mon Sep 17 00:00:00 2001 From: smyalygames Date: Mon, 14 Nov 2022 15:40:27 +0000 Subject: [PATCH] feat(arabot): add message in restricted section --- src/scheduled-tasks/restrictedMessage.ts | 56 ++++++++++++++++++++++++ src/utils/devIDs.ts | 2 + src/utils/ids.ts | 2 + 3 files changed, 60 insertions(+) create mode 100644 src/scheduled-tasks/restrictedMessage.ts diff --git a/src/scheduled-tasks/restrictedMessage.ts b/src/scheduled-tasks/restrictedMessage.ts new file mode 100644 index 0000000..4a20095 --- /dev/null +++ b/src/scheduled-tasks/restrictedMessage.ts @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +/* + Animal Rights Advocates Discord Bot + Copyright (C) 2022 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 { ScheduledTask } from '@sapphire/plugin-scheduled-tasks'; +import { container } from '@sapphire/framework'; +import type { TextChannel } from 'discord.js'; +import IDs from '../utils/ids'; + +class RestrictedMessageTask extends ScheduledTask { + public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + super(context, { + ...options, + cron: '0 17 * * *', + }); + } + + public async run() { + const { client } = container; + + const restricted = client.channels.cache.get(IDs.channels.restricted.restricted) as TextChannel; + const tolerance = client.channels.cache.get(IDs.channels.restricted.tolerance) as TextChannel; + + await restricted.send(this.message(IDs.roles.restrictions.restricted1)); + await tolerance.send(this.message(IDs.roles.restrictions.restricted3)); + } + + private message(id: string) { + return `Hi <@&${id}>, just a friendly reminder that you can reach out to <@575252669443211264>` + + 'to attempt to clear up the issue that lead to your restriction and rejoin the server.' + + '\n\nJust let us know what got you restricted and why you’d like to avoid repeating that behaviour and we’ll try to sort it out.'; + } +} + +declare module '@sapphire/plugin-scheduled-tasks' { + interface ScheduledTasks { + cron: never; + } +} + +export default RestrictedMessageTask; diff --git a/src/utils/devIDs.ts b/src/utils/devIDs.ts index de27809..d42a685 100644 --- a/src/utils/devIDs.ts +++ b/src/utils/devIDs.ts @@ -91,6 +91,8 @@ const devIDs = { }, restricted: { moderators: '999431679812845656', + restricted: '999431680295194684', + tolerance: '999431680295194685', }, logs: { restricted: '999431681217937513', diff --git a/src/utils/ids.ts b/src/utils/ids.ts index d5fb98e..7a8f6b2 100644 --- a/src/utils/ids.ts +++ b/src/utils/ids.ts @@ -94,6 +94,8 @@ let IDs = { }, restricted: { moderators: '928349536395604029', + restricted: '847880218521632788', + tolerance: '856516474120962048', }, logs: { restricted: '920993034462715925',