# Hey Developer, Welcome 👋

Cybralist is a npm module prepared for the api of cybralist.com website.

## Hey Developer, Welcome 👋

Cybralist.com is a npm module prepared for the api of [cybralist.com](https://cybralist.com) website.

Hey there developer 👋, here you can access the [cybralist.com](https://cybralist.com) website's api and module. If you find any problem, feel free to join our [discord server](https://discord.gg/cybrancee) and let us know.

{% content-ref url="/pages/-MdVj5kKohDQFKCDFsR5" %}
[Getting Started Npm](/npm-module/introduction)
{% endcontent-ref %}

{% content-ref url="/pages/v4PyS522IZvLHBSZ2Vom" %}
[Getting Started Python](/python-package/getting-started-python)
{% endcontent-ref %}

{% content-ref url="/pages/F5POn3mDD3gdr2gV0Ciu" %}
[API](/api/has-voted)
{% endcontent-ref %}


# Getting Started Npm

Cybralist is a npm module prepared for the api of [cybralist.com](https://cybralist.com) website.

## Download Module

```
npm i cybralist.js
```

## Define Module

```
const cybralist = require("cybralist.js");

const dbl = new cybralist("TOKEN-HERE", client);
//This token is not your bot token.
//You can get this token from https://cybralist.com when you submit a bot.
```


# 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

```javascript
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")
```

```javascript
let hasVote = await dbl.hasVoted("USER ID");

if(hasVote === true) {

  console.log("Voted")

} else {

  console.log("Vote please.")

}
```

```javascript
{ // this is the method of getting informations from the api

  "voted": "true/false"

}
```


# Bot Search

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

## 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.

}
```


# Server Count

This will post the server count on the cybralist.com website

```javascript
const Discord = require("discord.js");
const client = new Discord.Client();
const cybralist = require("cybralist.js");
const dbl = new cybralist("TOKEN-HERE", client);

client.on("ready", () => {

    dbl.serverCount();

})

client.login("BOT_TOKEN");
```


# Getting Started Python

Bhbotlist is a python package prepared for the api of [cybralist.com](https://cybralist.com) website.

## Download Module

```
pip install cybralist
```

## Define Module

```
from cybralist import cybralist
from discord.ext import commands

client = commands.Bot(command_prefix="!") 
dbl = cybralist(client,"token of cybralist")
```


# Server Count

This will post the server count on the cybralist.com website

```
from cybralist import cybralist
from discord.ext import commands

client = commands.Bot(command_prefix="!") 
dbl = cybralist(client,"token of cybralist")

@client.event
async def on_ready():
  x = await dbl.serverCountPost()
  print(x)

client.run("token")
```


# Has Voted

<mark style="color:blue;">`GET`</mark> `https://api.cybralist.co.in/vote/check/:userID`

#### Headers

| Name                                            | Type   | Description                                                        |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | It is the client token from [cybralist.com](https://cybralist.com) |

#### Parameter

| Name                                     | Type   | Description                                    |
| ---------------------------------------- | ------ | ---------------------------------------------- |
| userID<mark style="color:red;">\*</mark> | string | It specifies which user data you will withdraw |

{% tabs %}
{% tab title="200: OK It means you are good to go." %}

```javascript
{
    voted: true/false
}
```

{% endtab %}

{% tab title="401: Unauthorized It means the user id you entered is wrong." %}

```javascript
{
    "error": "You must enter a user id."
}
```

{% endtab %}

{% tab title="403: Forbidden It means you have not entered the bot token." %}

```javascript
{
  "error": "You must enter a bot token."
}
```

{% endtab %}

{% tab title="404: Not Found It means you have entered a invalid bot token." %}

```javascript
{
 "error": "You entered an invalid bot token."
}
```

{% endtab %}
{% endtabs %}


# Stats

<mark style="color:green;">`POST`</mark> `https://api.cyrbalist/post/stats`

Post bot's stats.

#### Headers

| Name                                            | Type    | Description                                               |
| ----------------------------------------------- | ------- | --------------------------------------------------------- |
| ServerCount<mark style="color:red;">\*</mark>   | integer | The client server count.                                  |
| Authorization<mark style="color:red;">\*</mark> | string  | The bot token from [cybralist.com](https://cybralist.com) |
| ShardCount                                      | integer | The client shard count.                                   |

{% tabs %}
{% tab title="401: Unauthorized It means you've not entered the bot token." %}

```javascript
{
  "error": "You must enter a bot token."
}
```

{% endtab %}

{% tab title="404: Not Found It means you've entered invalid bot token." %}

```javascript
{
  "error": "You entered an invalid bot token."
}
```

{% endtab %}
{% endtabs %}


# Search

<mark style="color:blue;">`GET`</mark> `https://api.cybralist.com/bots/:bot_id`

#### Path Parameters

| Name                                      | Type   | Description                                                                       |
| ----------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| bot\_id<mark style="color:red;">\*</mark> | string | Required id of a bot that must be added on [cybralist.com](https://cybralist.com) |

{% tabs %}
{% tab title="200: OK This means you are good to go." %}

```javascript
{
 "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
}
```

{% endtab %}

{% tab title="404: Not Found This means you've entered invalid bot id." %}

```javascript
{
   "error": "You entered invalid bot id."
}
```

{% endtab %}
{% endtabs %}


