如何将discord.js / node.js部署到firebase"/>
如何将discord.js / node.js部署到firebase
我想将带有discord.js的discord机器人部署到firebase中,但是我无法让de bot在firebase中运行。
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");
});
回答如下:将整个内容放入response.send("Test");
所在的位置。
在URL https://us-central1-PROJECT_ID.cloudfunctions/app
中用项目ID替换PROJECT_ID
,然后转到那里。
机器人可能启动。
更多推荐
如何将discord.js / node.js部署到firebase
发布评论