diff --git a/scripts/apod.js b/scripts/apod.js index 6156af1..4e89a29 100644 --- a/scripts/apod.js +++ b/scripts/apod.js @@ -10,14 +10,13 @@ module.exports = [ `https://api.nasa.gov/planetary/apod?api_key=${API_KEY}` ); if (!response.ok) { - say("APODの画像が取れなかったにゃーん"); - return; + return say("APODの画像が取れなかったにゃーん"); } const dict = await response.json(); const url = dict.media_type === "video" ? `https://www.youtube.com/watch?v=${get_video_id(dict.url)}` : dict.url; - say(`宇宙って良いにゃーん\n${dict.title}\n${url}`); + return say(`宇宙って良いにゃーん\n${dict.title}\n${url}`); }, ]; diff --git a/scripts/dns.js b/scripts/dns.js index 70af3ff..3c59186 100644 --- a/scripts/dns.js +++ b/scripts/dns.js @@ -14,9 +14,11 @@ module.exports = [ err ? reject(err) : resolve(records) ) ); - say(`:nya-n: < ${domain} は ${records.join(" *,* ")} ですにゃん`); + return say( + `:nya-n: < ${domain} は ${records.join(" *,* ")} ですにゃん` + ); } catch { - say(`:nya-n: < ${domain} はわかんなかったにゃん`); + return say(`:nya-n: < ${domain} はわかんなかったにゃん`); } }, ]; diff --git a/scripts/faiz.js b/scripts/faiz.js index b06afa0..9619632 100644 --- a/scripts/faiz.js +++ b/scripts/faiz.js @@ -1,5 +1,5 @@ module.exports = (app) => { - app.message(/555/, ({ say }) => { + app.message(/555/, ({ say }) => say( [ "Standing by... > :nya-n:", @@ -8,9 +8,9 @@ module.exports = (app) => { "変身! > :nya-n:", ":555: ノシ", ].join("\n") - ); - }); - app.message(/551/, ({ say }) => { + ) + ); + app.message(/551/, ({ say }) => say( [ "551の豚まんがあるときー? > :nya-n:", @@ -30,6 +30,6 @@ module.exports = (app) => { " ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄", "```", ].join("\n") - ); - }); + ) + ); }; diff --git a/scripts/goku.js b/scripts/goku.js index b9b6aaf..e4e6138 100644 --- a/scripts/goku.js +++ b/scripts/goku.js @@ -1,6 +1,5 @@ module.exports = [ /([\s\S]*(ぱい|パイ)[\s\S]*)/, - ({ context, say }) => { - say(`:goku: < ${context.matches[0].replace(/ぱい|パイ/g, "ぺぇ")}`); - }, + ({ context, say }) => + say(`:goku: < ${context.matches[0].replace(/ぱい|パイ/g, "ぺぇ")}`), ]; diff --git a/scripts/ipinfo.js b/scripts/ipinfo.js index 70ddfb5..521fa12 100644 --- a/scripts/ipinfo.js +++ b/scripts/ipinfo.js @@ -10,7 +10,7 @@ module.exports = [ headers: { Accept: "application/json" }, }; const response = await fetch(url, options); - say( + return say( response.ok ? `:nya-n: < ${await response.text()}` : `:nya-n: < がんばったけど ${ip} よくわからんかったにゃん` diff --git a/scripts/json.js b/scripts/json.js index 62bed20..87f05d6 100644 --- a/scripts/json.js +++ b/scripts/json.js @@ -14,7 +14,7 @@ module.exports = [ try { const json = JSON.parse(context.matches[1]); const res = JSON.stringify(json, null, 2); - say([`${nyanco()} っ`, "```", res, "```"].join("\n")); + return say([`${nyanco()} っ`, "```", res, "```"].join("\n")); } catch (e) { console.error(e); } diff --git a/scripts/morpheme.js b/scripts/morpheme.js index fb4dd9a..41d5fea 100644 --- a/scripts/morpheme.js +++ b/scripts/morpheme.js @@ -16,7 +16,9 @@ module.exports = [ const tokenize = await useTokenize(); const tokens = tokenize(context.matches[1]); const readings = tokens.map(({ reading }) => reading); - say([`${nyanco()} < ${readings.join("")}`, toCSV(tokens)].join("\n")); + return say( + [`${nyanco()} < ${readings.join("")}`, toCSV(tokens)].join("\n") + ); } catch (e) { console.error(e); } diff --git a/scripts/nurupo.js b/scripts/nurupo.js index 19f9d80..c88a340 100644 --- a/scripts/nurupo.js +++ b/scripts/nurupo.js @@ -45,7 +45,7 @@ const patterns = [ /進捗どうですか/, ({ message, say }) => { const from = `<@${message.user}>`; - say( + return say( [ `${nyanco()} < そう言うと ${from} は永い眠りについた。`, `メールとチケットが山のように積もった部屋の片隅で・・・。`, @@ -69,7 +69,7 @@ const patterns = [ /(肉|にく|ニク)/, ({ say }) => { if (random([...Array(3).keys()]) !== 0) return; - say( + return say( [ ":spark-exodia-00::spark-exodia-01::spark-exodia-02::spark-exodia-03::spark-exodia-04::spark-exodia-05:", ":spark-exodia-06::spark-exodia-07::spark-exodia-08::spark-exodia-09::spark-exodia-10::spark-exodia-11:", @@ -83,7 +83,7 @@ const patterns = [ /(野球|やきゅう|やきう)/, ({ say }) => { if (random([...Array(10).keys()]) !== 0) return; - say( + return say( [ ":nomura-exodia-1::nomura-exodia-2::nomura-exodia-3:", ":nomura-exodia-4::nomura-exodia-5::nomura-exodia-6: :exclamation::question:", @@ -99,9 +99,9 @@ const patterns = [ /(死|亡|殺)/.test(context.matches[0]) || random([...Array(10).keys()]) === 0 ) { - say(":hamster: < まったくなのだ!万死に値するのだ!!"); + return say(":hamster: < まったくなのだ!万死に値するのだ!!"); } else { - say(":hamster: < まったくなのだ!!!"); + return say(":hamster: < まったくなのだ!!!"); } }, ], diff --git a/scripts/nyanchu.js b/scripts/nyanchu.js index 466b3ee..4922b8d 100644 --- a/scripts/nyanchu.js +++ b/scripts/nyanchu.js @@ -5,6 +5,6 @@ module.exports = [ /(ニャンちゅう) +(.*)/, ({ context, say }) => { const oon = context.matches[2].split("").map((c) => `${c}゛`); - say(`お゛ぉ゛ん!${oon.join("")}た゛に゛ゃあ゛ん! > :nyanchu:`); + return say(`お゛ぉ゛ん!${oon.join("")}た゛に゛ゃあ゛ん! > :nyanchu:`); }, ]; diff --git a/scripts/random.js b/scripts/random.js index c9dd355..b01eaaa 100644 --- a/scripts/random.js +++ b/scripts/random.js @@ -18,6 +18,6 @@ module.exports = [ ...context.matches[2].split(/(?:,|\s)+/), "人に決められるだけの人生でいいのか?自分で決めようず", ]; - say(`:nya-n: < ${random(words)}`); + return say(`:nya-n: < ${random(words)}`); }, ]; diff --git a/scripts/tellme.js b/scripts/tellme.js index 239bbda..b1d1782 100644 --- a/scripts/tellme.js +++ b/scripts/tellme.js @@ -13,6 +13,6 @@ module.exports = [ /tell( ?me)? (.*)/i, async ({ context, say }) => { const ans = await tellme(context.matches[2]); - if (ans != null) say(`${nyanco()} < ${ans}`); + if (ans != null) return say(`${nyanco()} < ${ans}`); }, ]; diff --git a/scripts/unchiku.js b/scripts/unchiku.js index 5274a75..865e665 100644 --- a/scripts/unchiku.js +++ b/scripts/unchiku.js @@ -22,7 +22,7 @@ module.exports = [ if (/^(|…|しらないにゃーん)$/.test(ans)) { throw new Error(`don't know ${word} : ${ans}`); } - say(`:nya-n: < 【う・ん・ち・く】${ans}`); + return say(`:nya-n: < 【う・ん・ち・く】${ans}`); } catch (e) { console.error(e); } diff --git a/scripts/weather.js b/scripts/weather.js index a18ad63..ff9fea4 100644 --- a/scripts/weather.js +++ b/scripts/weather.js @@ -24,7 +24,7 @@ module.exports = [ timeZone ); - say( + return say( [ `${nyanco()} < ${format( target,