From d7b8e706b867abc50a1edbe1ce454860965fb8b9 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 27 Feb 2026 19:28:54 +0100 Subject: [PATCH 1/2] Add ig link replacing command --- commands/misc/ig.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 commands/misc/ig.js diff --git a/commands/misc/ig.js b/commands/misc/ig.js new file mode 100644 index 0000000..af45466 --- /dev/null +++ b/commands/misc/ig.js @@ -0,0 +1,31 @@ + +module.exports = { + name: 'ig', + description: 'Replaces Instagram links with kkinstagram and deletes the original message', + execute({message, args}) { + const noUrlErr = "You need to provide an Instagram link to use this command." + if(args.length < 1) { + message.channel.send(noUrlErr); + return; + } + let replacedLink = ""; + const regex = /(?<=\/)(instagram)\.com/g + if(args[0].startsWith("https://") || args[0].startsWith("http://")){ + replacedLink = args[0].replace(regex, "kkinstagram.com"); + }else { + message.channel.send(noUrlErr); + return; + } + if(replacedLink.length === 0){ + message.channel.send(noUrlErr); + return; + } + message.channel.send(replacedLink); + try{ + message.delete() + }catch(err){ + console.error(`${this.name}: An error occurred while trying to delete the original message.`) + console.error(err); + } + } +}; \ No newline at end of file From bc497c7dea5aa12042f0250899c77310b62ffb3d Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 27 Feb 2026 19:55:37 +0100 Subject: [PATCH 2/2] Fix sending links if they didn't get changed --- commands/misc/ig.js | 5 +---- commands/misc/x.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/commands/misc/ig.js b/commands/misc/ig.js index af45466..21268b7 100644 --- a/commands/misc/ig.js +++ b/commands/misc/ig.js @@ -12,11 +12,8 @@ module.exports = { const regex = /(?<=\/)(instagram)\.com/g if(args[0].startsWith("https://") || args[0].startsWith("http://")){ replacedLink = args[0].replace(regex, "kkinstagram.com"); - }else { - message.channel.send(noUrlErr); - return; } - if(replacedLink.length === 0){ + if(replacedLink.length === 0 || args[0] === replacedLink){ message.channel.send(noUrlErr); return; } diff --git a/commands/misc/x.js b/commands/misc/x.js index 2a9b515..87b6a26 100644 --- a/commands/misc/x.js +++ b/commands/misc/x.js @@ -12,11 +12,8 @@ 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){ + if(replacedLink.length === 0 || args[0] === replacedLink){ message.channel.send(noUrlErr); return; }