From ed98ff7e2679f362f2657e77a6cf8dd3ce9b3d43 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 7 Sep 2022 21:33:37 -0400 Subject: clean up --- src/commands/config/config.ts | 6 +++--- src/commands/config/log.ts | 4 ++-- src/commands/info/userInfo.ts | 8 ++++---- src/commands/utilities/price.ts | 4 ++-- src/commands/utilities/whoHasRole.ts | 4 ++-- src/listeners/commands/commandBlocked.ts | 6 +++--- src/listeners/commands/commandMissingPermissions.ts | 8 ++++---- src/listeners/interaction/interactionCreate.ts | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index b923d56..adc41d8 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -3,9 +3,9 @@ import { BotCommand, colors, emojis, + formatList, GuildNoArraySetting, guildSettingsObj, - oxford, settingsArr, type ArgType, type CommandMessage, @@ -174,11 +174,11 @@ export default class ConfigCommand extends BotCommand { id: 'action', type: actionType, prompt: { - start: `Would you like to ${oxford( + start: `Would you like to ${formatList( actionType!.map((a) => `\`${a}\``), 'or' )} the \`${setting}\` setting?`, - retry: `{error} Choose one of the following actions to perform on the ${setting} setting: ${oxford( + retry: `{error} Choose one of the following actions to perform on the ${setting} setting: ${formatList( actionType!.map((a) => `\`${a}\``), 'or' )}`, diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts index 493d486..0c74ce7 100644 --- a/src/commands/config/log.ts +++ b/src/commands/config/log.ts @@ -1,8 +1,8 @@ import { BotCommand, emojis, + formatList, guildLogsArr, - oxford, type ArgType, type CommandMessage, type GuildLogType, @@ -58,7 +58,7 @@ export default class LogCommand extends BotCommand { type: guildLogsArr, prompt: { start: 'What log type would you like to change?', - retry: `{error} Choose either ${oxford( + retry: `{error} Choose either ${formatList( guildLogsArr.map((l) => `\`${l}\``), 'or' )}`, diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 86132c7..25621fa 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -4,8 +4,8 @@ import { bots, colors, emojis, + formatList, mappings, - oxford, sleep, Time, timestampAndDelta, @@ -200,9 +200,9 @@ export default class UserInfoCommand extends BotCommand { const presenceInfo = []; if (member?.presence.status) presenceInfo.push(`**Status:** ${member.presence.status}`); if (devices && devices.length) - presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${oxford(devices, 'and', '')}`); + presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${formatList(devices, 'and')}`); if (activitiesNames.length) - presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${oxford(activitiesNames, 'and', '')}`); + presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${formatList(activitiesNames, 'and')}`); if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${escapeMarkdown(customStatus)}`); embed.addFields({ name: title, value: presenceInfo.join('\n') }); @@ -245,7 +245,7 @@ export default class UserInfoCommand extends BotCommand { // Important Perms const perms = this.getImportantPermissions(member); - if (perms.length) embed.addFields({ name: title, value: this.getImportantPermissions(member).join(' ') }); + if (perms.length) embed.addFields({ name: title, value: perms.join(' ') }); } private static getImportantPermissions(member: GuildMember | undefined) { diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 06afe3b..6f08aaa 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,4 +1,4 @@ -import { ArgType, BotCommand, colors, emojis, format, oxford, type CommandMessage } from '#lib'; +import { ArgType, BotCommand, colors, emojis, format, formatList, type CommandMessage } from '#lib'; import assert from 'assert/strict'; import { ApplicationCommandOptionType, AutocompleteInteraction, EmbedBuilder } from 'discord.js'; import { default as Fuse } from 'fuse.js'; @@ -68,7 +68,7 @@ export default class PriceCommand extends BotCommand { if (bazaar?.success === false) errors.push('bazaar'); if (errors.length) { - priceEmbed.setFooter({ text: `Could not fetch data for ${oxford(errors, 'and')}` }); + priceEmbed.setFooter({ text: `Could not fetch data for ${formatList(errors, 'and')}` }); } // create a set from all the item names so that there are no duplicates for the fuzzy search diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index 9b12a1c..c01a0c3 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -4,8 +4,8 @@ import { chunk, colors, emojis, + formatList, OptArgType, - oxford, type CommandMessage, type SlashMessage } from '#lib'; @@ -60,7 +60,7 @@ export default class WhoHasRoleCommand extends BotCommand { const title = `Members with ${ roles.length < 4 - ? oxford( + ? formatList( rawRoles.map((r) => r.name), 'and' ) diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 534e744..c81857c 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -4,8 +4,8 @@ import { Emitter, emojis, format, + formatList, InhibitorReason, - oxford, type BotCommandHandlerEvents, type CommandMessage } from '#lib'; @@ -95,7 +95,7 @@ export default class CommandBlockedListener extends BotListener { channels!.forEach((c) => { names.push(`<#${c}>`); }); - const pretty = oxford(names, 'and'); + const pretty = formatList(names, 'and'); return await respond({ content: `${emojis.error} ${format.input(command!.id)} can only be run in ${pretty}.`, ephemeral: true @@ -105,7 +105,7 @@ export default class CommandBlockedListener extends BotListener { if (!command) break; const guilds = command.restrictedGuilds; const names = guilds!.map((g) => format.input(client.guilds.cache.get(g)?.name ?? g)); - const pretty = oxford(names, 'and'); + const pretty = formatList(names, 'and'); return await respond({ content: `${emojis.error} ${format.input(command!.id)} can only be run in ${pretty}.`, ephemeral: true diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts index 9a59077..598b7d9 100644 --- a/src/listeners/commands/commandMissingPermissions.ts +++ b/src/listeners/commands/commandMissingPermissions.ts @@ -4,9 +4,9 @@ import { Emitter, emojis, format, + formatList, mappings, - oxford, - surroundArray, + surroundEach, type BotCommandHandlerEvents } from '#lib'; import { Client, type PermissionsString } from 'discord.js'; @@ -32,8 +32,8 @@ export default class CommandMissingPermissionsListener extends BotListener { (perm) => mappings.permissions[perm as PermissionsString]?.name ?? missing ); - const discordFormat = oxford(surroundArray(niceMissing, '**'), 'and', ''); - const consoleFormat = oxford(surroundArray(niceMissing, '<<', '>>'), 'and', ''); + const discordFormat = formatList(surroundEach(niceMissing, '**'), 'and'); + const consoleFormat = formatList(surroundEach(niceMissing, '<<', '>>'), 'and'); void client.console.info( 'commandMissingPermissions', `<<${message.author.tag}>> tried to run <<${ diff --git a/src/listeners/interaction/interactionCreate.ts b/src/listeners/interaction/interactionCreate.ts index c4c14c1..ced359c 100644 --- a/src/listeners/interaction/interactionCreate.ts +++ b/src/listeners/interaction/interactionCreate.ts @@ -3,9 +3,9 @@ import { Emitter, emojis, format, + formatList, handleAutomodInteraction, - oxford, - surroundArray, + surroundEach, type BotClientEvents } from '#lib'; import { Events, InteractionType } from 'discord.js'; @@ -68,7 +68,7 @@ export default class InteractionCreateListener extends BotListener { return await interaction.reply({ content: `You selected ${ Array.isArray(interaction.values) - ? oxford(surroundArray(interaction.values, '`'), 'and', '') + ? formatList(surroundEach(interaction.values, '`'), 'and') : format.input(interaction.values) }.`, ephemeral: true -- cgit