Commit 1bbc7743 authored by Loïc Bersier's avatar Loïc Bersier 😎
Browse files

Better link detection

Signed-off-by: Loïc Bersier's avatarloicbersier <>
parent 5612abd8
......@@ -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('')) return'You may not tweet links outside of');
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('')) return'You may not tweet links outside of');
// Do not allow discord invites
if (args.text.includes('') || args.text.includes('')) return'No discord invite allowed.');
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment