答案 0 :(得分:37)
最接近的是:
var a = require('./file_a').getTest()
console.log(typeof a.print) //Cannot read property 'print' of null
需要注意的重要事项:
答案 1 :(得分:5)
在现代浏览器中,它可以简单如下:
const Discord = require("discord.js");
const bot = new Discord.Client();
bot.on("ready", () => {
bot.guilds.forEach((guild) => { //for each guild the bot is in
let defaultChannel = "";
guild.channels.forEach((channel) => {
if(channel.type == "text" && defaultChannel == "") {
if(channel.permissionsFor(guild.me).has("SEND_MESSAGES")) {
defaultChannel = channel;
}
}
})
setInterval (function () {
defaultChannel.send("Message here") //send it to whatever channel the bot has permissions to send on
}, 30 * 1000);
})
})