npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@evodev/discord.plus

v2.1.2

Published

Discord Plus is a Wrapper for Discord.JS which utilizes Bot communications using Socket.IO. Easily communicate with other bots using Discord.Plus. Discord.Plus also has a built in command handler to help you make your bot easily.

Downloads

24

Readme

Discord.Plus


Discord Plus is a Wrapper for Discord.JS which utilizes Bot communications using Socket.IO. Easily communicate with other bots using Discord.Plus. Discord.Plus also has a built in command handler, machine learning and chat AI to help you make your bot easily.


How To Use


Command Handler Usage


  • set(name, value)

To set a command with value as value and name as the name.

  • get(name)

To return a command's value with name as name.

  • remove(name)

To remove a command with name as name.

  • has(name)

To know does a command with name as name is exist in the Class or no.

  • getAll()

To get all commands' name and value in Map.

  • getAllNames()

To get all commands' name in an Array.

  • getAllValues()

To get all commands' value in an Array.


Communicate Usage


  • on(event, callback)

To fire callback function when the event event got fired.

  • sendMessage(object) / sendMessage({ id: "The Bot Receiver's ID", message: "Your Message" })

To send message to other bot. Note: It will return an Object after the server send it to other bot.

  • blockUser(id)

To block a bot with id as ID so the bot cannot send message to your bot. Note: It will not stored into any database.

  • unblockUser(id)

To unblock a bot with id as ID.

  • blockedUsers()

To get all IDs of blocked users.


betterObject Usage


  • Object.prototype.forEach(callback)

To calls a function once for each item in an Object, in order.

  • Object.prototype.push(object)

To add new item to an Object.

  • Object.prototype.splice(index, howmany, replacewith)

To add/remove items from an Object, and return modified Object.


NeuralNetwork Usage


  • train(iterations, data)

To train your AI with data iterationsx times.

  • activate(input)

To see your AI's answer of input.


ChatBot Usage


  • trainData(arrayOfData)

Gives the ai the required data to reply to users.

  • getPrediction(string)

Get string prediction from trained data.

  • getResult(string)

Get all results and scores from all data. This can be used to find the most dominant one.


Command Handler Example


const { CommandHandler } = require("@evodev/discord.plus");
const { Client }         = require("discord.js");
const prefix             = "!";
const handler            = new CommandHandler();

handler.set("say", {
  name: "say",
  run: async (client, message, args) => {
    return message.channel.send(args.join(" "));
  }
});

client.on("message", async message => {
  const args = msg.content
    .trim()
    .slice(prefix.length)
    .split(/ +/g);
  const cmd = args.shift().toLowerCase();
  if (cmd.charAt(0) !== prefix) return;
  // Running command based on input
  if (!handler.has(cmd)) return;
  handler.get(cmd).run(client, message, args);
});

Communicate Example


let BetterDiscord = require("@evodev/discord.plus");
let cBD           = new BetterDiscord.Communicate("your_bot_token"); //you can put DiscordClient object here tho.

cBD.on("ready", () => {
  cBD.on("message", async res => {
    console.log(`${res.user.id}: ${res.message.content}`);
    let msgRes = await cBD.sendMessage({ message: "Received your message dude!", id: res.user.id });
    //you can do whatever you want with the msgRes object!
  });
});

NeuralNetwork Example


let { NeuralNetwork } = require("@evodev/discord.plus");
let ML                 = new NeuralNetwork();

ML.train(10000, [
	{ inputs: [0,0], outputs: [0] },
	{ inputs: [0,1], outputs: [0] },
	{ inputs: [1,0], outputs: [0] },
	{ inputs: [1,1], outputs: [1] }
]);

console.log(ML.activate([0,0])); // ~0 (0.01214291222508886)
console.log(ML.activate([0,1])); // ~0 (0.08100696632854297)
console.log(ML.activate([1,0])); // ~0 (0.07793351045035582)
console.log(ML.activate([1,1])); // ~1 (0.8780115291725155)

betterObject Example


require("@evodev/discord.plus").betterObject();

let object = { i: 0, o: 1 };

object.push({ k: 2 }); //{ i: 0, o: 1, k: 2 };

object.forEach((k,v) => {
  console.log(`${k} = ${v}`);
}); //1 = 0, o 1, k = 2

object.splice(2,2); //{ i: 0 }


ChatBot Example


const { ChatAI } = require("@evodev/discord.plus");
const chatbot = new ChatAI();

const data = [
  { input: "Hey there!"                          , output: "Hello!"                              },
  { input: "Thanks for downloading discord.plus!", output: "No problem!"                         },
  { input: "Enjoying using the lib?"             , output: "considering support us by donating!" }
]

// Return: considering support us by donating!
ai.getPrediction("Enjoying the lib?")

// Return an array of predictions and scores.
ai.getResult("thanks for the downloads!")

Support



Developer


  • Gaia#7541 (Discord)
  • Hyp3r#0001 (Discord)
  • Odd Stranger#7957 (Discord)

Want to support us?


  • Gaia's PayPal: nekomaru76

Note


  • You cannot distribute this library. You only can download and use it.
  • You cannot edit the library and then distribute it without All Developers' permission of this Library. You only can use it.
  • Don't try to put your DiscordClient object into sendMessage function.

Copyright (c) EvoDev Team, Inc - All Rights Reserved


  • This work is licensed under the Recex Shared Source License Version 1.0.
  • To view a copy of this license, visit the site.
  • Written by Gaia [email protected], October 2020.