Do not allow links outside of twitter.com

This commit is contained in:
loicbersier 2020-07-16 09:25:03 +02:00
parent 7ed7b6c338
commit 507ed403e1

View file

@ -31,6 +31,13 @@ class tweetCommand extends Command {
}
async exec(message, args) {
if (args.text) {
// Very simple link detection
if (args.text.includes('http') && !args.text.includes('twitter.com')) return message.channel.send('You may not tweet links outside of twitter.com');
// Do not allow discord invites
if (args.text.includes('discord.gg') || args.text.includes('discord.com/invite/')) return message.channel.send('No discord invite allowed.');
}
let Attachment = (message.attachments).array();
if (!Attachment[0] && !args.text) return message.channel.send('You need to input something for me to tweet!');
@ -51,11 +58,6 @@ class tweetCommand extends Command {
return message.channel.send('Your account need to be 6 months or older to be able to send attachment!');
}
if (args.text)
if (args.text.includes('discord.gg') || args.text.includes('discord.com/invite/')) return message.channel.send('No discord invite allowed.');
const client = this.client;
let T = new Twit({