From ec1a866dd60b6bb47ebdd09b6de660508e03cdb1 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 31 Dec 2021 09:34:45 -0700 Subject: [PATCH] string utils --- bot.js | 2 ++ commands/utility/randnum.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 3b85f78..733ada4 100644 --- a/bot.js +++ b/bot.js @@ -122,6 +122,8 @@ async function init() { client.utils = {}; client.utils.logch = async () => {return client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915');}; + client.utils.s = num => num === 1 ? '' : 's'; + client.utils.as = (num, text) => `${text}${client.utils.s(num)}`; client.guildconfig = {}; client.guildconfig.prefixes = new Map(); diff --git a/commands/utility/randnum.js b/commands/utility/randnum.js index 1651b3c..6d7431f 100644 --- a/commands/utility/randnum.js +++ b/commands/utility/randnum.js @@ -41,7 +41,7 @@ module.exports = { res += `${1 + 1}. \`${Math.floor(Math.random() * (nums[1] - nums[0] + 1) + nums[0])}\`\n`; } return message.channel.send({embeds: [new Discord.MessageEmbed() - .setTitle(`Random Number${num.length > 1 ? 's' : ''}`) + .setTitle(`Random Number${num.length === 1 ? '' : 's'}`) .setDescription(res) .setColor('c375f0') .setFooter({text: "Natsuki", iconURL: client.user.avatarURL()})