所以我正在制作一个 Discord 机器人,并且我有两个文件。一个称为index.js,另一个称为functions.js。如何在主程序中从functions.js 运行我的函数?const Discord = require('discord.js')const client = new Discord.Client()const { MessageEmbed } = require('discord.js')const config = require("./config.json");const sleep = require('sleep.js');const func = require('./functions');var days = 0;client.on("ready", () => { console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`); func.Christmas() client.user.setActivity(days + ' days until Christmas!', { type: 'PLAYING', url: 'https://twitch.tv/itzp3nguin' });});client.login(config.token);如果我运行它,我会收到错误消息“func.Christmas”不是一个函数...Functions.js 文件: https: //pastebin.com/xsJbD1Qa
添加回答
举报
0/150
提交
取消