From 23f1a3bd45d75c07fadae8301bd795bf95c04c7a Mon Sep 17 00:00:00 2001 From: "Ean Milligan (Bastion)" Date: Sun, 29 Jan 2023 01:51:49 -0500 Subject: [PATCH] don't need generateReport --- src/commandUtils.ts | 10 +--------- src/commands/report.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/commandUtils.ts b/src/commandUtils.ts index 1cf70da..05e61f7 100644 --- a/src/commandUtils.ts +++ b/src/commandUtils.ts @@ -15,21 +15,13 @@ export const getRandomStatus = (guildCount: number): string => { `${config.prefix}info to learn more`, `Running LFGs in ${guildCount} servers`, ]; - return statuses[Math.floor((Math.random() * statuses.length) + 1)]; + return statuses[Math.floor(Math.random() * statuses.length)]; }; export const isLFGChannel = (guildId: bigint, channelId: bigint) => { return (lfgChannelSettings.has(`${guildId}-${channelId}`) || channelId === 0n || guildId === 0n) ? ApplicationCommandFlags.Ephemeral : undefined; }; -export const generateReport = (msg: string) => ({ - embeds: [{ - color: infoColor2, - title: 'USER REPORT:', - description: msg, - }], -}); - export const somethingWentWrong = (bot: Bot, interaction: Interaction, errorCode: string) => bot.helpers.sendInteractionResponse(interaction.id, interaction.token, { type: InteractionResponseTypes.ChannelMessageWithSource, diff --git a/src/commands/report.ts b/src/commands/report.ts index 3155f58..6591ff7 100644 --- a/src/commands/report.ts +++ b/src/commands/report.ts @@ -1,6 +1,6 @@ import config from '../../config.ts'; import { ApplicationCommandOptionTypes, ApplicationCommandTypes, Bot, Interaction, InteractionResponseTypes, sendMessage } from '../../deps.ts'; -import { generateReport, isLFGChannel, somethingWentWrong, successColor } from '../commandUtils.ts'; +import { infoColor2, isLFGChannel, somethingWentWrong, successColor } from '../commandUtils.ts'; import { dbClient, queries } from '../db.ts'; import { CommandDetails } from '../types/commandTypes.ts'; import utils from '../utils.ts'; @@ -24,7 +24,13 @@ const details: CommandDetails = { const execute = (bot: Bot, interaction: Interaction) => { dbClient.execute(queries.callIncCnt('cmd-report')).catch((e) => utils.commonLoggers.dbError('report.ts', 'call sproc INC_CNT on', e)); if (interaction.data?.options?.[0].value) { - sendMessage(bot, config.reportChannel, generateReport(interaction.data.options[0].value as string)).catch((e: Error) => utils.commonLoggers.interactionSendError('report.ts:28', interaction, e)); + sendMessage(bot, config.reportChannel, { + embeds: [{ + color: infoColor2, + title: 'USER REPORT:', + description: interaction.data.options[0].value as string, + }], + }).catch((e: Error) => utils.commonLoggers.interactionSendError('report.ts:28', interaction, e)); bot.helpers.sendInteractionResponse( interaction.id, interaction.token,