我想将基于discord.js运行的Discord机器人部署到Firebase Cloud函数上,但我无法使机器人在Firebase中运行。如果我使用nodemon,则可以完美运行,但如果我使用firebase deploy,则机器人不会启动。
以下是我的当前代码:
const functions = require('firebase-functions');
require('dotenv').config();
const token = process.env.TOKEN
const Discord = require('discord.js')
const Client = new Discord.Client();
Client.on('ready', () => {
Client.channels.find(x => x.name === 'main-cannel').send('bot is deployed')
Client.user.setGame(`The Cult | ${Client.guilds.size} servers`)
Console.log('test')
});
Client.login(token);
//is is not working but de basic
//export.App = functions.... {Client}
exports.app = functions.https.onRequest((request, response) => {
response.send("Test");
});