如何将discord.js / node.js部署到firebase

编程入门 行业动态 更新时间:2024-10-08 08:28:59

<a href=https://www.elefans.com/category/jswz/34/1771359.html style=如何将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

本文发布于:2024-05-07 12:47:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1756306.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   discord   js   node   firebase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!