mirror of
https://github.com/kou029w/daraz-san.git
synced 2025-01-19 00:18:01 +00:00
23 lines
573 B
JavaScript
23 lines
573 B
JavaScript
|
const { directMention } = require("@slack/bolt");
|
||
|
const nyanco = require("./util/nyanco");
|
||
|
|
||
|
// Description:
|
||
|
// だらずさんは JSON のお掃除がだいすきです
|
||
|
//
|
||
|
// Synopsis:
|
||
|
// json <jsonstring> - あなたの JSON をぷりちーにするにゃん
|
||
|
|
||
|
module.exports = [
|
||
|
directMention(),
|
||
|
/json +(.*)/i,
|
||
|
({ context, say }) => {
|
||
|
try {
|
||
|
const json = JSON.parse(context.matches[1]);
|
||
|
const res = JSON.stringify(json, null, 2);
|
||
|
say([`${nyanco()} っ`, "```", res, "```"].join("\n"));
|
||
|
} catch (e) {
|
||
|
console.error(e);
|
||
|
}
|
||
|
}
|
||
|
];
|