📜  如何从 .env 文件中导入令牌 discord bot - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:24.804000             🧑  作者: Mango

代码示例1
require('dotenv').config();

// process.env.NODE_ENV allows you to get the environment the node process is in
let ver = process.env.NODE_ENV;

client.on('ready', () => {

  if (ver === 'production') {
    client.user.setActivity('An Idiot\'s Guide', { type: 'STREAMING', url: 'https://twitch.tv/something' })
  } else {
    client.user.setActivity('in code land', { type: 'PLAYING' });
  }
});