From 0e87bbd3940d89defcb04926587b35c8f4d1947f Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 16 Jun 2022 14:32:18 -0400 Subject: remove util classes, move config out of src --- src/commands/utilities/reminders.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/commands/utilities/reminders.ts') diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts index 79284ac..18243fe 100644 --- a/src/commands/utilities/reminders.ts +++ b/src/commands/utilities/reminders.ts @@ -1,4 +1,15 @@ -import { BushCommand, ButtonPaginator, Reminder, type CommandMessage, type SlashMessage } from '#lib'; +import { + BushCommand, + ButtonPaginator, + chunk, + clientSendAndPermCheck, + colors, + emojis, + Reminder, + timestamp, + type CommandMessage, + type SlashMessage +} from '#lib'; import assert from 'assert'; import { PermissionFlagsBits, type APIEmbed } from 'discord.js'; import { Op } from 'sequelize'; @@ -14,22 +25,22 @@ export default class RemindersCommand extends BushCommand { usage: ['reminder'], examples: ['reminders'], slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks]), + clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks]), userPermissions: [] }); } public override async exec(message: CommandMessage | SlashMessage) { const reminders = await Reminder.findAll({ where: { user: message.author.id, expires: { [Op.gt]: new Date() } } }); - if (!reminders.length) return message.util.send(`${util.emojis.error} You don't have any reminders set.`); + if (!reminders.length) return message.util.send(`${emojis.error} You don't have any reminders set.`); - const formattedReminders = reminders.map((reminder) => `${util.timestamp(reminder.expires, 't')} - ${reminder.content}`); + const formattedReminders = reminders.map((reminder) => `${timestamp(reminder.expires, 't')} - ${reminder.content}`); - const chunked = util.chunk(formattedReminders, 15); + const chunked = chunk(formattedReminders, 15); const embeds: APIEmbed[] = chunked.map((chunk) => ({ title: `Reminders`, description: chunk.join('\n'), - color: util.colors.default + color: colors.default })); return await ButtonPaginator.send(message, embeds); } -- cgit