From 62b8ebb4cf1f104bbebe9934bce5f8826fd69277 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 27 Feb 2026 19:23:36 +0100 Subject: [PATCH 1/3] Use lookbehind to improve x command regex --- commands/misc/x.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/misc/x.js b/commands/misc/x.js index 1d35bd4..bf8e1c7 100644 --- a/commands/misc/x.js +++ b/commands/misc/x.js @@ -9,7 +9,7 @@ module.exports = { return; } let replacedLink = ""; - const regex = /(x|twitter)\.com/g + const regex = /(?<=\/)(x|twitter)\.com/g if(args[0].startsWith("https://") || args[0].startsWith("http://")){ replacedLink = args[0].replace(regex, "fxtwitter.com"); } From 9796e9245ae75b40e71d1f5003696c5ce5b9612a Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 27 Feb 2026 19:24:01 +0100 Subject: [PATCH 2/3] Don't send an unchanged link in x command --- commands/misc/x.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commands/misc/x.js b/commands/misc/x.js index bf8e1c7..2e7283b 100644 --- a/commands/misc/x.js +++ b/commands/misc/x.js @@ -12,6 +12,9 @@ module.exports = { const regex = /(?<=\/)(x|twitter)\.com/g if(args[0].startsWith("https://") || args[0].startsWith("http://")){ replacedLink = args[0].replace(regex, "fxtwitter.com"); + }else { + message.channel.send(noUrlErr); + return; } if(replacedLink.length === 0){ message.channel.send(noUrlErr); From 7791fa5654d3c1705d5a5f5e86f70d5b28465ca4 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 27 Feb 2026 19:25:40 +0100 Subject: [PATCH 3/3] Improve error message when message.delete() fails --- commands/misc/x.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/misc/x.js b/commands/misc/x.js index 2e7283b..2a9b515 100644 --- a/commands/misc/x.js +++ b/commands/misc/x.js @@ -24,7 +24,7 @@ module.exports = { try{ message.delete() }catch(err){ - console.error(`${this.name}: An error happened while trying to delete the original message.`) + console.error(`${this.name}: An error occurred while trying to delete the original message.`) console.error(err); } }