Merged hotfix/uri-identification into develop

This commit is contained in:
benji7425 2016-11-01 00:54:19 +00:00
commit 7fb51aebb8
2 changed files with 10 additions and 4 deletions

View file

@ -6,8 +6,6 @@
# Planned features
- Add checking for >100 messages (currently if 100 messages are sent after posting the link, it will be re-posted straight away because it wont be detected in the previous 100)
- Add checking for link within other messages (currently only checks for messages identical to the link)
- Addition of user-defined URLs to match as 'sent' (ie if a user posts a youtu.be link, the bot will still post a youtube.com link, even if they point to the same palce - I would like to add a setting whereby you can specify alternate hosts to match)
Feel free to contact me with suggestions and feature requests - if you need a new feature, just let me know and I will see what I can do! (No promises though :p)

View file

@ -54,7 +54,11 @@ Dns.resolve("discordapp.com", function (err) {
//check if the message is a link, cache it if it is
if (linkRegExp.test(message) && (message !== latestFeedLink)) {
logEvent("Detected posted link: " + message);
cacheLink(Uri.withinString(message, function (url) { return url; }));
//detect the url inside the string, and cache it
Uri.withinString(message, function (url) {
cacheLink(url);
return url;
});
}
});
}
@ -105,7 +109,11 @@ function checkPreviousMessagesForLinks() {
for (var message in messageContents) {
message = messageContents[message];
if (linkRegExp.test(message))
cacheLink(Uri.withinString(message, function (url) { return url; }));
//detect the url inside the string, and cache it
Uri.withinString(message, function (url) {
cacheLink(url);
return url;
});
}
}
});