我正在制造一个不和谐的机器人,我想知道是否可以使用它创建一个JSON文件。我还没有找到一种方法。我的命令对&createfile {name}做出反应,它将始终创建一个JSON文件。到目前为止,我的代码:
const Discord = require('discord.js');
module.exports = {
name: 'createfile',
description: "The bot will create a .json file named after the argument",
execute(message, args){
var fileName = args[0]
if(!args) {
return message.reply('invalid name')
};
// Create file {fileName}.json
}
}
是否有创建类似文件的方法?谢谢:)
答案 0 :(得分:2)
您可以使用fs创建JSON文件
jupyter/base-notebook:latest