# Bot Search

## An Example Command

```javascript
const Discord = require("discord.js"); //This is an example bot search 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 === "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 cybralist.com`);
		const botinfo = await dbl.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)
```

```javascript
let botFind = await dbl.search("bot id");

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

```javascript
{ // These are the responses from the api.

 "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
 
 // These are the responses from the api.

}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cybralist.com/npm-module/botsearch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
