📜  加载配置文件 discordjs - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:58.750000             🧑  作者: Mango

代码示例1
const Discord = require('discord.js');

const bot = Discord.Client();
// config.json 
// {"token": "Your token!"}
// Make sure you saved it in the root directory
// with your main script.
const config = require('./config.json');
const token = config.token;

bot.once('ready', () => {
    console.log('Online!');
})

bot.login(token);