Getting votes via a local webserver

Installation

npm i express

Setting up a webserver

const express = require("express")
var bodyParser = require('body-parser')

const port = "YOUR_PORT"

const app = express() 
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
    extended: true
  }));

app.post("/votewebhook", async (req, res) => {
    console.log(req.body)  
    res.sendStatus(201) 
})

app.listen(port, ()=>{
    console.log("running on port ", port)
})

Response

A response will look like this:

{
  user: {
    id: '123456789101112131',
    username: 'User',
    discriminator: '0000'
  },
  bot: {
    id: '123456789101112131',
    votes: [
      '2021-08-03T10:27:10.330Z',
      ...,
    ]
  }
}

Last updated