Check Voted

get
Voter Check

https://voidbots.net/api/auth/voted/:botid
Request
Response
Request
Path Parameters
botid
required
string
ID
Headers
voter
required
string
The ID of the user to check for.
Response
200: OK
Returns a true or false depending on if the user with that id has voted in the last 12 hours.
{
success: true,
userid: userID,
voted: false
}
401: Unauthorized
Missing the voter header.
{
success: false,
error: "Voter header not found."
}

Code (console log example)

const fetch = require('node-fetch');
fetch(`https://voidbots.net/api/auth/voted/${client.user.id}`, { headers: { 'voter': `${message.author.id}` } }).then(res => res.json()).then(data => {
if(data.voted == true) {
return console.log('User has voted!');
}
}).catch(console.error);

Async Command Example

let v;
await nodefetch(`https://voidbots.net/api/auth/voted/${client.user.id}`, { headers: { 'voter': `${message.author.id}` } }).then(res => res.json()).then(data => {
if(data.voted == false) {
v = "disabled";
const e = new MessageEmbed()
.setTitle('Vote Locked')
.setDescription(`Please vote on [voidbots.net](https://voidbots.net/bot/${client.user.id}/vote) to gain access to this command. If you have recently voted it may take up to 5 minutes to register your vote.`)
.setColor('RED')
.setTimestamp();
return message.channel.send(e);
}
}).catch(console.error);
if(v == "disabled") return;