1
0
Fork 0
mirror of https://github.com/kou029w/daraz-san.git synced 2025-01-19 00:18:01 +00:00
daraz-san/scripts/json.js

23 lines
581 B
JavaScript
Raw Normal View History

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);
2020-04-09 00:24:48 +09:00
return say([`${nyanco()}`, "```", res, "```"].join("\n"));
} catch (e) {
console.error(e);
}
2020-04-09 00:16:46 +09:00
},
];