Better link detection
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
5612abd87d
commit
1bbc77434a
1 changed files with 1 additions and 1 deletions
|
@ -33,7 +33,7 @@ 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');
|
||||
if (new RegExp('([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?').test(args.text) && !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.');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue