From 4e42957c934bda57078877ed5cb795a7e1d2d1be Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Sun, 20 Oct 2024 15:12:57 +0200 Subject: [PATCH 1/6] Add conversion from inches to cm and vice versa --- commands/misc/convert.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/commands/misc/convert.js b/commands/misc/convert.js index c7ce0dc..6da40c6 100644 --- a/commands/misc/convert.js +++ b/commands/misc/convert.js @@ -106,6 +106,34 @@ module.exports = { sendText = "Can only convert to kg from lb."; } break; + case "INCH": + case "IN": + case "\"": + if (args[2].toUpperCase() === "CM") { + let CM = (initial_number * 2.54).toFixed(2); + + if(CM[CM.length - 1] === '0' && CM[CM.length - 2] === "0"){ + CM = CM.replace(".00","") + } + + sendText = `${initial_number}" is ${CM} cm`; + } else { + sendText = "Can only convert to cm from inches."; + } + break; + case "CM": + if (args[2].toUpperCase() === "INCH" || args[2].toUpperCase() === "INCHES") { + let INCH = (initial_number / 2.54).toFixed(2); + + if(INCH[INCH.length - 1] === '0' && INCH[INCH.length - 2] === "0"){ + INCH = INCH.replace(".00","") + } + + sendText = `${initial_number} cm is ${INCH} inches`; + } else { + sendText = "Can only convert to inches from cm."; + } + break; default: sendText = "No conversion method for that yet" break; From d6fd1156463a277e862495f065159af7533f2be4 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Sun, 20 Oct 2024 15:13:37 +0200 Subject: [PATCH 2/6] Improve moreHelp on convert command to include all supported units --- commands/misc/convert.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/commands/misc/convert.js b/commands/misc/convert.js index 6da40c6..c540e12 100644 --- a/commands/misc/convert.js +++ b/commands/misc/convert.js @@ -2,7 +2,12 @@ module.exports = { name: 'convert', description: 'Convert a value to another value', moreHelp: [ - "To convert celsius to fahrenheit:", + "Current units supported:", + "F > C > K", + "inches > cm", + "KG > LB", + "Every unit in a line can be converted to any other unit in the same line", + "Example:", "convert 20 C F" ], execute({message, args}) { From 0e0cad67340f2db232eba283cbec9c8e789792c6 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Sun, 20 Oct 2024 15:17:51 +0200 Subject: [PATCH 3/6] Convert: Add inches to switch case --- commands/misc/convert.js | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/misc/convert.js b/commands/misc/convert.js index c540e12..49010c9 100644 --- a/commands/misc/convert.js +++ b/commands/misc/convert.js @@ -111,6 +111,7 @@ module.exports = { sendText = "Can only convert to kg from lb."; } break; + case "INCHES": case "INCH": case "IN": case "\"": From 90b6225a555534b23625e44dde2d9a30ba388955 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Tue, 22 Oct 2024 02:06:36 +0200 Subject: [PATCH 4/6] Fix Details showing up twice in userinfo --- commands/info/userinfo.js | 1 - 1 file changed, 1 deletion(-) diff --git a/commands/info/userinfo.js b/commands/info/userinfo.js index d2b4e6d..cf9f4f7 100644 --- a/commands/info/userinfo.js +++ b/commands/info/userinfo.js @@ -62,7 +62,6 @@ module.exports = { embed.addFields([{name: "Presence", value: user.presence.activities[0].name, inline: false}]) if (presenceDetails != 0) embed.addFields([{name: "Details", value: presenceDetails.toString(), inline: false}]) - embed.addFields([{ name: "Details", value: presenceDetails.toString(), inline: false }]) embed.addFields([ { name: "Creation date", value: getCreationDate(user), inline: true }, { name: "Join date", value: getJoinDate(user, message.guild), inline: true } From 58cfba27d08384fe37ddc7acab8dfd262571e704 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Tue, 22 Oct 2024 02:09:56 +0200 Subject: [PATCH 5/6] Fix alignment in userinfo --- commands/info/userinfo.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/commands/info/userinfo.js b/commands/info/userinfo.js index cf9f4f7..47265f8 100644 --- a/commands/info/userinfo.js +++ b/commands/info/userinfo.js @@ -56,12 +56,15 @@ module.exports = { .setAuthor({name: user.user.username, iconURL: user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })}) .addFields([ { name: "Username", value: username, inline: false }, - { name: "Status", value: status, inline: true }, ]); if (isPresence) embed.addFields([{name: "Presence", value: user.presence.activities[0].name, inline: false}]) - if (presenceDetails != 0) + if (presenceDetails != 0){ embed.addFields([{name: "Details", value: presenceDetails.toString(), inline: false}]) + embed.addFields([{name: "Status", value: status, inline: true }]) + } + else + embed.addFields([{ name: "Status", value: status, inline: false }]) embed.addFields([ { name: "Creation date", value: getCreationDate(user), inline: true }, { name: "Join date", value: getJoinDate(user, message.guild), inline: true } From e112050e69b96b1eb3610978756ec195f4e34c9c Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Tue, 22 Oct 2024 02:19:42 +0200 Subject: [PATCH 6/6] Do not show discriminator if it is 0 --- commands/info/userinfo.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/info/userinfo.js b/commands/info/userinfo.js index 47265f8..9984f50 100644 --- a/commands/info/userinfo.js +++ b/commands/info/userinfo.js @@ -48,7 +48,9 @@ module.exports = { let discriminator = user.user.discriminator; if(discriminator === "0") discriminator = ""; - let username = `**${user.user.username}#${user.user.discriminator}**${nickname}` + else + discriminator = `#${discriminator}`; + let username = `**${user.user.username}${discriminator}**${nickname}`; const embed = new EmbedBuilder() .setThumbnail(user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })) .setColor(roleColor)