Compare commits

..

2 Commits

Author SHA1 Message Date
hgw
4c27bd5a1e
Maybe fix alias issue + add url testing logging 2023-12-02 00:48:30 +11:00
hgw
bfddd4f3e9
fixing timezone pt. 2 2023-12-02 00:48:08 +11:00
2 changed files with 4 additions and 3 deletions

3
bot.js
View File

@ -39,6 +39,7 @@ const isValidUrl = urlString=> {
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // validate port and path '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // validate port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // validate query string '(\\?[;&a-z\\d%_.~+=-]*)?'+ // validate query string
'(\\#[-a-z\\d_]*)?$','i'); // validate fragment locator '(\\#[-a-z\\d_]*)?$','i'); // validate fragment locator
consoleLog('[bot.isValidUrl] Testing URL: '+urlString)
return !!urlPattern.test(urlString); return !!urlPattern.test(urlString);
} }
@ -144,7 +145,7 @@ async function feed(chan, nick, provfeed, n) {
bot.say(chan, "You have no saved feeds") bot.say(chan, "You have no saved feeds")
return; return;
} }
} else if (uconfig[nick].alias !== undefined ) { //Alias Lookup } else if (uconfig[nick].alias[provfeed.toUpperCase()] !== undefined ) { //Alias Lookup
consoleLog('[bot.feed] Alias requested') consoleLog('[bot.feed] Alias requested')
var provfeed = uconfig[nick].alias[provfeed.toUpperCase()] var provfeed = uconfig[nick].alias[provfeed.toUpperCase()]
openPostWorker(chan, "feed-preset", provfeed, n, nick); openPostWorker(chan, "feed-preset", provfeed, n, nick);

View File

@ -91,9 +91,9 @@ async function twitter(feedURL, n, nick) {
if (data.isoDate !== undefined) { if (data.isoDate !== undefined) {
var date = moment(data.isoDate) var date = moment(data.isoDate)
if (uconfig[nick].timezone != undefined) { try {
var syncDate = date.tz(uconfig[nick].timezone) var syncDate = date.tz(uconfig[nick].timezone)
} else { } catch(e) {
var syncDate = date.tz(config.feed.timezone) var syncDate = date.tz(config.feed.timezone)
} }
consoleLog('[feed-predef.twitter] Got tweet from '+syncDate.format()) consoleLog('[feed-predef.twitter] Got tweet from '+syncDate.format())