1.1.0 • Published 5 years ago

everyapi.js v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Installation

$ npm install --save everyapi.js

Required packages

Functions

Updates:

/**
* 1.0.2 Fixed Fuction TopVotes() error
*/

/**
* 1.1.0 Now you want the <client> of discord and a token to be able to make a request to the website and the whole code is restructured and the function of TopVotes was removed
*/

getBot

/**
 * @param {string} [BotID] - ID of some server bot
 */

const every = require('everyapi.js')
const Every = new every(client, 'your every token')
Every.getBot(BotID)

/**
Return: {
name: Bot name
id: Bot id
owner: Owner id
prefix: Bot prefix
upvotes: Votes of the bot
invite: Invite bot url
avatar: Avatar url of the bot
}
 */

getUser

/**
 * @param {string} [UserID] - id of any user that has the role of developer on the server
 */

const every = require('everyapi.js')
const Every = new every(client, 'your every token')
Ever.getUser(BotID)

/**
Return: {
name: User name
id: User id
bots: Total user bots count
messages: Total messages sent by the user
}
 */

Example Bot (discord.js)

//Requiring Packages
const discord = require('discord.js'); //This can also be discord.js-commando or other node based packages!

//Create the bot client
const client = new Discord.Client();
const every = require('everyapi.js')
const Every = new every(client, 'your every token')

//Whenever someone types a message this gets activated.
//(If you use 'await' in your functions make sure you put async here)
client.on('message', async message => {

    //Set the prefix of the bot.
    const settings = {
      prefix: '/',
    }

    //This reads the first part of your message behind your prefix to see which command you want to use.
    var command = message.content.toLowerCase().slice(settings.prefix.length).split(' ')[0];

    //These are the arguments behind the commands.
    var args = message.content.split(' ').slice(1);

    //If the message does not start with your prefix return.
    //If the user that types a message is a bot account return.
    if (!message.content.startsWith(tokens.prefix) || message.author.bot) return;

    if (command === 'bot') {
		
		const bot = message.mentions.users.first()
		if(!bot || !bot.bot) return message.channel.send("No bot was mentioned or a user was mentioned")
		const data = await Every.getBot(bot.id)
		
		message.channel.send(`Information of ${data.name} bot
		
ID: ${data.id}
Prefix: ${data.prefix}
Owner: ${data.owner}
Votes: ${data.upvotes}
Invite: ${data.invite}
Avatar: ${data.avatar}`)
    }

    if (command === 'user') {

      const user = message.mentions.users.first()
		if(!user || !user.bot) return message.channel.send("No bot was mentioned or a user was mentioned")
		const data = await Every.gethUser(user.id)
		
		message.channel.send(`Information of ${data.name} user
		
ID: ${data.id}
Bots: ${data.bots}
Total send messages: ${data.messages}`)

    }
});

//Your secret token to log the bot in. (never show this to anyone!)
client.login('token')
1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago