我想做一些更大的 discord 机器人。我知道如何制作一个机器人和一切,但我想知道如何制作一个网络面板。有人可以解释如何制作其中一个并与机器人集成吗?
最佳答案
在您的 Node discord 机器人中使用 express.js 查看 Express有关更深入的示例。如果你想查看套接字连接Socket.io有关于构建套接字连接应用程序的精彩教程。我更喜欢在 Angular 中构建我的 Node 应用程序的前端
const bodyParser = require('body-parser');
const app = require('express')();
// these are for parsing POST requests
// alternatively you can use socket.io for real time communication
// but POST'sshould suffice
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
// GET requests like this first argument is url
// example; '*': all; '/home', '/something'
app.get('*', (req,res)=>{ /* process get request */ });
// POST requests
app.post('*', post.process);
// listen on your port eg: 80
http.listen(port, ()=>{
console.log('Listening on port: '+port);
})
关于javascript - 带有 Webpanel 的 Discord 机器人?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58437206/