当用户在 top.gg 上为机器人投票时,Discord.js V 12 在控制台中记录数据

时间:2021-02-16 14:21:47

标签: node.js express discord.js

当有人投票时,我试图让我的机器人控制台日志,但是当我使用 top.gg Webhook 页面上的测试按钮时,它没有记录任何内容,是因为我输入了错误的网址吗?但我使用 api 测试仪网站对其进行了测试,它有效还是我的代码

const express = require('express');
const app = express();
const bodyParser = require("body-parser") 
app.use(bodyParser.json());

app.post("/votes", function (request, response) {
  response.sendStatus(200) // tells the website that sent the POST request that everything was OK
  console.log(request.body) // log the actual data being received
  console.log(request.headers)
  let user = client.users.cache.get(request.body.user)
  console.log(`${user} has voted`)
  let auth = request.headers.authorization
 if (auth === "my auth") {

 } else return;
});

app.get('/', (req, res) => {
  res.send('Cats cute!')
})
app.listen(2000, () => {
  console.log(`running`)
})

我也在使用托管 something.host 如果这有任何帮助

0 个答案:

没有答案