commit e2d0c229476c1c72e0d32b17809fea4b443295df
parent f2d88978eff130f615e7d3819e4215cb66698521
Author: Agastya Chandrakant <acagastya@outlook.com>
Date: Thu, 28 May 2020 12:41:36 +0530
Solving bugs like {{}} and [[]]
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/irc.js b/irc.js
@@ -75,12 +75,14 @@ function groupChat(sender, channel, msg) {
const links = msg.match(regex1);
const templates = msg.match(regex2);
if (links) {
- const fullLinks = links.map(getFullLink);
- sayShortUrls(fullLinks, channel);
+ const nonEmptyLink = links.filter((el) => el.length > 4);
+ const fullLinks = nonEmptyLink.map(getFullLink);
+ if (fullLinks.length) sayShortUrls(fullLinks, channel);
}
if (!msg.endsWith('--nl') && templates) {
- const fullLinks = templates.map(getFullTemplate);
- sayShortUrls(fullLinks, channel);
+ const nonEmptyTl = templates.filter((el) => el.length > 4);
+ const fullLinks = nonEmptyTl.map(getFullTemplate);
+ if (fullLinks.length) sayShortUrls(fullLinks, channel);
}
}