const disbutpages = require("discord-embeds-pages-buttons") const ButtonPages = require('discord-button-pages'); const disbut = require("discord-buttons"); const MessageButton = require("discord-buttons"); const { MessageEmbed } = require('discord.js') const { MessageActionRow, Button } = require('discord.js'); const Discord = require("discord.js"); const moment = require("moment") module.exports = { name: "vote", aliases: ["voteus"], description: "Shows all commands of the bot", run: async (client, message, args) => { const fetch = require("node-fetch"); // import node-fetch module const botId = client.user.id; // get the client (bot) id const uId = message.author.id; // get the author id let cooldown = 43200000; const url = `https://top.gg/api/bots/${botId}/check?userId=${uId}`; // api endpoint fetch(url, { method: "GET", headers: { Authorization: process.env.TOPGG }}) .then((res) => res.text()) .then((json) => { var isVoted = JSON.parse(json).voted; if (isVoted === 0) { const embed = new Discord.MessageEmbed() .setTitle(`:shobot:Vote for ShoBOT`) .setURL("https://top.gg/bot/906443259801374720/vote") .setColor('GREEN') //.setTitle(`Vote for ShoBOT [here](https://top.gg/bot/906443259801374720/vote) on top.gg to support the bot and help it grow!`) .setDescription("Vote for ShoBOT [here](https://top.gg/bot/906443259801374720/vote) on top.gg to support ShoBOT and help it grow!!") let buttonun = new disbut.MessageButton() .setStyle('url') .setLabel('TOP.GG') .setURL("https://top.gg/bot/906443259801374720/vote"); //return message.channel.send(voteEmbed,{ //button: [button1], message.channel.send(embed,{ button: [buttonun] }); //message.channel.send("not voted"); } else if (isVoted === 1) { const embed = new Discord.MessageEmbed() .setTitle(`:shobot:Vote for ShoBOT`) .setURL("https://top.gg/bot/906443259801374720/vote") .setColor('GREEN') //.setTitle(`Vote for ShoBOT [here](https://top.gg/bot/906443259801374720/vote) on top.gg to support the bot and help it grow!`) .setDescription("You have already voted for ShoBOT, You can vote again later. Thank you for helping me grow!!") //.addField('You Voted at:', ``, true) //.addField(`You can vote again at :`, ``, true) let buttonun = new disbut.MessageButton() .setStyle('gray') .setLabel('Voted') .setID('hey') //.setURL("https://top.gg/bot/906443259801374720/vote"); .setDisabled(true) message.channel.send(embed,{ button: [buttonun] }); //message.channel.send("voted"); } }); }, };