enwnbot

Converts MediaWiki [[links]] and {{templates}} to links on IRC
git clone http://git.hanabi.in/repos/enwnbot.git
Log | Files | Refs | README | LICENSE

commit 4d696c623699040ea197f26a373a85f511f1f8ae
parent 517babd757b20fc2e11c236bbf09fa271bf15b63
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Sat,  8 Aug 2020 16:42:51 +0530

fixing ? in utils

Diffstat:
Mirc.js | 13++++---------
Mutils.js | 1+
2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/irc.js b/irc.js @@ -57,7 +57,7 @@ async function announceRQ(sender, channel) { channel, `${list.length} articles to review, ${sender}. They are:` ); - const titles = list.map(({ title }) => title.replace(/\?/g, "%3F")); + const titles = list.map(({ title }) => title); const times = list.map(({ timestamp }) => moment().to(moment(timestamp))); const urls = titles.map(fullUrl); client.say(channel, "(Hold on a sec... Shortening the URLs.)"); @@ -81,7 +81,7 @@ async function announceUR(sender, channel) { channel, `${list.length} articles are under review, ${sender}. They are:` ); - const titles = list.map(({ title }) => title.replace(/\?/g, "%3F")); + const titles = list.map(({ title }) => title); const times = list.map(({ timestamp }) => moment().to(moment(timestamp))); const urls = titles.map(fullUrl); client.say(channel, "(Hold on a sec... Shortening the URLs.)"); @@ -151,17 +151,12 @@ async function announceSubmitted() { const underReview = await fetch(URAPI); const urParsed = await underReview.json(); - const urTitles = urParsed.query.categorymembers.map(({ title }) => - title.replace(/\?/g, "%3F") - ); + const urTitles = urParsed.query.categorymembers.map(({ title }) => title); const titleTime = parsed.query.categorymembers.map(({ title, timestamp }) => { - title = title.replace(/\?/g, "%3F"); return { timestamp, title }; }); - const allTitles = parsed.query.categorymembers.map(({ title }) => - title.replace(/\?/g, "%3F") - ); + const allTitles = parsed.query.categorymembers.map(({ title }) => title); const pending = titleTime.filter( ({ title }) => !submittedState.announced.includes(title) ); diff --git a/utils.js b/utils.js @@ -18,6 +18,7 @@ async function fetchData(URI) { } function fullUrl(title) { + title = title.replace(/\?/g, "%3F"); let [main, anchor] = title.split("#"); main = main.replace(/ /g, "%20"); if (anchor) anchor = anchor.replace(/ /g, "_");