Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
bc497c7dea |
|||
|
d7b8e706b8 |
2 changed files with 29 additions and 4 deletions
28
commands/misc/ig.js
Normal file
28
commands/misc/ig.js
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
if(replacedLink.length === 0 || args[0] === replacedLink){
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -12,11 +12,8 @@ module.exports = {
|
||||||
const regex = /(?<=\/)(x|twitter)\.com/g
|
const regex = /(?<=\/)(x|twitter)\.com/g
|
||||||
if(args[0].startsWith("https://") || args[0].startsWith("http://")){
|
if(args[0].startsWith("https://") || args[0].startsWith("http://")){
|
||||||
replacedLink = args[0].replace(regex, "fxtwitter.com");
|
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);
|
message.channel.send(noUrlErr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue