Bot search

By using this method, you can get information about your bot and other bots.

Example command

Index.js
const Discord = require("discord.js"); //This is an example bot search command
const client = new Discord.Client();
const tortoise = require("tortoises-studio-api");
const  = 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 === "search") {

	try {
		const query = args.join(" "); // search query must be a bot id
		
		if (!query) return message.channel.send(`Please provide a bot id which is added in DisBots.xyz`);
		const botinfo = await ts.search(`${query}`);
		
		const embed = new Discord.MessageEmbed()
		.setTitle(`${botinfo.username} || Info`)
		.setFooter(`Requested by ${message.author.username}`, message.author.displayAvatarURL({ dynamic: true }))
		.setColor(`BLURPLE`)
		.setThumbnail(botinfo.avatar)
		.setDescription(`**Name:** ${botinfo.username}#${botinfo.discrim}\n**ID:** ${botinfo.botID}\n**Avatar:** [\`Click here\`](${botinfo.avatar})\n**Prefix:** ${botinfo.prefix}\n**Owner:** <@${botinfo.ownerID}> (${botinfo.owner})\n**Co-onwers:** ${botinfo.coowners.join(", ")}\n**Tags:** ${botinfo.tags.join(", ")}\n**Verified: **${botinfo.certificate}\n**GitHub: **[\`Click here\`](${botinfo.github})\n**Support Server:** [\`Click here\`](${botinfo.support})\n**Votes:** ${botinfo.votes}\n**Website:** [\`Click here\`](${botinfo.website})`)
		.addField(`Short Description`, `${botinfo.shortDesc}`)
		//.addField(`Long Description`, ${botinfo.longDesc}) //Adding long description might give you a error beacuse the embed can't handle long fields (6000)
		.setTimestamp();
		
		message.channel.send(embed).catch(err => {
				message.channel.send(`**Error:** ${err}`) // If the given id was wrong or the api got any issues, then it will return this error
		});
    } catch (e) {
	  message.channel.send(`I was unable to find the search results!`)

  }
  }

})

client.login(process.env.token)
let botFind = await ts.search("bot id");

console.log(botFind) // This will log the full deatils of the given bot id in json format.
{

 "avatar": String,
 "botID": String,
 "username": String,
 "discrim": String,
 "shortDesc": String,
 "prefix": String,
 "votes": String,
 "ownerID": String,
 "owner": String,
 "coowners": Array,
 "tags": Array,
 "longDesc": String,
 "certificate": String,
 "github": String,
 "support": String,
 "website": String

}

Last updated