mirror of
https://github.com/kou029w/daraz-san.git
synced 2025-01-18 16:08:06 +00:00
22 lines
581 B
JavaScript
22 lines
581 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);
|
|
return say([`${nyanco()} っ`, "```", res, "```"].join("\n"));
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
},
|
|
];
|