当有人在 top.gg 中为我的机器人投票时,我正试图让我的不和谐机器人进入 console.log 投票信息。以下代码引用了官方 @top-gg/sdk
中的示例NULL
在我的机器人的 webhooks 页面上,我输入了以下信息: https://i.imgur.com/6drlXfo.png 第一个审查器是我的 VPS 的 ipv4(Vultr VPS),第二个是我在 config.json 中使用的“webhookPW”。
当我按下“测试”时,它会显示“Webhook 已测试!这可能需要几秒钟”,但我的 VPS 控制台中没有任何内容。我曾尝试使用 var path = require('path');
const { webhookPW } = require(path.resolve(path.normalize("./config.json")));
const init = async() =>
{
console.log('[EXPRESS] STARTING SERVER')
const express = require('express')
const app = express()
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook(webhookPW) // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote)
}) // attach the middleware
app.listen(25569, () => console.log('SERVER READY'))
}
module.exports.init = init
和 sudo ufw allow http
,导致 sudo ufw allow 25569
显示:
sudo ufw status
我该如何解决这个问题?谢谢。
编辑:
Status: active
To Action From
-- ------ ----
443/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
22/tcp ALLOW Anywhere
25569 ALLOW Anywhere
443/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
3000 (v6) ALLOW Anywhere (v6)
25569 (v6) ALLOW Anywhere (v6)
在机器人运行时返回 nc -l 25569
,不运行时返回任何内容。