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.
npm install @evodev/discord.plusset(name, value)value as value and name as the name.get(name)value with name as name.remove(name)name as name.has(name)name as name is exist in the Class or no.getAll()name and value in Map.getAllNames()name in an Array.getAllValues()value in an Array.on(event, callback)callback function when the event event got fired.sendMessage(object) / sendMessage({ id: "The Bot Receiver's ID", message: "Your Message" })blockUser(id)id as ID so the bot cannot send message to your bot. Note: It will not stored into any database.unblockUser(id)id as ID.blockedUsers()Object.prototype.forEach(callback)Object.prototype.push(object)Object.prototype.splice(index, howmany, replacewith)train(iterations, data)iterationsx times.activate(input)input.trainData(arrayOfData)getPrediction(string)getResult(string)js
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);
});
`
---
$3
---
`js
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!
});
});
`
---
$3
---
`js
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)
`
---
$3
---
`js
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 = 2object.splice(2,2); //{ i: 0 }
`
---
---
$3
---
`js
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!")
``