1
0
Fork 0
mirror of https://github.com/kou029w/daraz-san.git synced 2025-01-18 16:08:06 +00:00

return promise

This commit is contained in:
Nebel 2020-04-09 00:24:48 +09:00
parent 96bd347199
commit 63ef8627e0
13 changed files with 29 additions and 27 deletions

View file

@ -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}`);
},
];

View file

@ -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} はわかんなかったにゃん`);
}
},
];

View file

@ -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")
);
});
)
);
};

View file

@ -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, "ぺぇ")}`),
];

View file

@ -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} よくわからんかったにゃん`

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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: < まったくなのだ!!!");
}
},
],

View file

@ -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:`);
},
];

View file

@ -18,6 +18,6 @@ module.exports = [
...context.matches[2].split(/(?:,|\s)+/),
"人に決められるだけの人生でいいのか?自分で決めようず",
];
say(`:nya-n: < ${random(words)}`);
return say(`:nya-n: < ${random(words)}`);
},
];

View file

@ -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}`);
},
];

View file

@ -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);
}

View file

@ -24,7 +24,7 @@ module.exports = [
timeZone
);
say(
return say(
[
`${nyanco()} ${format(
target,