Vote Check

By this method of Vote Check, your bot can check whether the author have or have not voted for your bot.

An Example Command

const Discord = require("discord.js"); //This is an example voted check command
const client = new Discord.Client();
const bhbotlist = require("bhbotlist.js");
const dbl = new bhbotlist("TOKEN-HERE", client); // This is not your bot token, this token can be found from our website: https://bhlist.co.in/bots/your_bot_id

client.on("ready", async () => {
  console.log(`Logged in as ${client.user.tag}`)
})

client.on("message", async (message) => {
  if (!message.guild) return;
  if (message.author.bot) return;
  
  const prefix = "!";
  const args = message.content.slice(prefix.length).split(" ");
  const command = args.shift().toLowerCase();
    
  if (command === "check") {
    const vote = await dbl.hasVoted(message.author.id);
    
    if (vote === true) { // checking whether the author has voted or not!
      message.channel.send(`You have voted for ${client.user.tag} recently. You can vote every 12 hours.`)
      
    } else {
      message.channel.send(`You have not voted for ${client.user.tag}. Please vote :)\nhttps://bhlist.co.in/bots/${client.user.id}/vote`)
    }
    
  }
})

client.login("token")
let hasVote = await dbl.hasVoted("USER ID");

if(hasVote === true) {

  console.log("Voted")

} else {

  console.log("Vote please.")

}
{ // this is the method of getting informations from the api

  "voted": "true/false"

}

Last updated