LogoLogo
  • Hey Developer, Welcome 👋
  • NPM MODULE
    • Getting Started Npm
    • Vote Check
    • Bot Search
    • Server Count
  • PYTHON PACKAGE
    • Getting Started Python
    • Server Count
  • API
    • Has Voted
    • Stats
    • Search
Powered by GitBook
On this page
  1. NPM MODULE

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 cybralist = require("cybralist.js");
const dbl = new cybralist("TOKEN-HERE", client); // This is not your bot token, this token can be found from our website: https://cybralist.com/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://cybralist.com/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"

}
PreviousGetting Started NpmNextBot Search

Last updated 5 months ago