Vote check
By this method of Vote Check, your bot can check whether the author have or have not voted for your bot.
Example command
index.js
const Discord = require("discord.js"); //This is an example voted check command
const client = new Discord.Client();
const tortoise = require("");
const ts = new tortoise("token", client); // This is not your bot token, this token can be found from our website
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 ts.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://www.tortoises.studio/bots/${client.user.id}/vote`)
}
}
})
client.login("token")
let hasVote = await ts.hasVoted("USER ID");
if(hasVote === true) {
console.log("Voted")
} else {
console.log("Vote please.")
}
{
"voted": "true/false" // this is the method of getting informations from the api
}
Last updated