This package has been deprecated

Author message:

Sorry, Please use cords-handler-advanced instead.

cords-handler

1.2.24 • Public • Published

What Is Cords-Handler?

Cords-Handler Is An Basic Events/Commands Handler
And Much More.....

New Features!

・ Cooldown Bug Fix

Events Handler

const cordshandler = require("cords-handler");
const discord = require("discord.js");
const client = new discord.Client();
const chclient = new cordshandler.Client();
let eventhandler = new cordshandler.EventHandler(client, chclient);
eventhandler.setEventFolder("./events");
eventhandler.loader();
client.login("token");

Commands Handler

const cordshandler = require("cords-handler");
const discord = require("discord.js");
const client = new discord.Client();
const chclient = new cordshandler.Client();
let cmdhandler = new cordshandler.CommandHandler(client, chclient);
cmdhandler.setPrefix("prefix");
//---Optional---\\
cmdhandler.setOwners(["Array", "Of", "Owner", "IDs"], "Not An Owner Error.");
cmdhandler.setPrefix2("prefix2");
cmdhandler.setPrefix3("prefix3");
cmdhandler.setPrefix4("prefix4");
cmdhandler.setPrefix5("prefix5");
//---Optional---\\
cmdhandler.setCommandFolder("./commands"); // you should parse commands to categories like /commands/economy/balance.js

cmdhandler.loader();
client.login("token");

Command Overlay

module.exports = {
  name: "command name",
  aliases: ["array", "of", "aliases"], // if none aliases:[]
  cooldown: "5s", //if no cooldown just delete this part.
  cooldownError: "Wait 5 Seconds After Using This Command!", //if no cooldown just delete this part.
  botPerms: "REQUIRED_PERMISSION_FOR_CLIENT", //if no need to bot permissions remove this part.
  botPermsError: "I dont have required permissions", //if no need to bot permissions remove this part.
  userPerms: "REQUIRED_PERMISSION_FOR_USER", //if no need to user permissions remove this part.
  userPermsError: "You dont have required permissions", //if no need to user permissions remove this part.
  onlyOwner: true, //if not an only owner command remove this part.
  run: async (client, message, args) => {},
};

Discord Embed Paginations

const cordshandler = require("cords-handler");
const discord = require("discord.js");
const client = new discord.Client();
client.on("message", async (msg) => {
  if (msg.content === "!embed") {
    let page1 = new discord.MessageEmbed()
      .setColor("RANDOM")
      .setDescription("Thats Page 1!");
    let page2 = new discord.MessageEmbed()
      .setColor("RANDOM")
      .setDescription("Thats Page 2!");
    let pages = [page1, page2];
    let pagination = new cordshandler.Pagination(client);
    pagination.setTimeout("5s"); // after 5 second it will delete the reactions.
    pagination.setMessage(msg); // set the message.
    pagination.setPages(pages); // set the embed pages.
    pagination.start();
  }
});
client.login("token");

Events

There Are Currently 5 Events,These Are:
commandsLoaded:The Event That Will Run When All Commands Are Loaded!
eventsLoaded:The Event That Will Run When All Events Are Loaded!
commandUsed:The Event That Will Run When A Command Is Used!
commandNotFound:The Event That Will Run When A Message Starts With Prefix But Not A Command!
catchError:The Event That Will Run When There Is An Error!

Usage Of Events

Commands/Events Loaded Event

const { Client } = require("discord.js");
const client = new Client();
const chandler = require("cords-handler");
const chclient = new chandler.Client();
chclient.on("commandsLoaded/eventsLoaded", async () => {
  console.log("All Commands/Events Has Loaded!");
});
let cmdhandler = new chandler.CommandHandler(client, chclient)
  .setCommandFolder("./commands")
  .setPrefix("!")
  .loader();

Command Used Event

const { Client } = require("discord.js");
const client = new Client();
const chandler = require("cords-handler");
const chclient = new chandler.Client();
chclient.on("commandUsed", async (data) => {
  console.log(data);
});
let cmdhandler = new chandler.CommandHandler(client, chclient)
  .setCommandFolder("./commands")
  .setPrefix("!")
  .loader();

Command Not Found Event

const { Client } = require("discord.js");
const client = new Client();
const chandler = require("cords-handler");
const chclient = new chandler.Client();
chclient.on("commandNotFound", async (data) => {
  console.log(data);
});
let cmdhandler = new chandler.CommandHandler(client, chclient)
  .setCommandFolder("./commands")
  .setPrefix("!")
  .loader();

Catch Error Event

const { Client } = require("discord.js");
const client = new Client();
const chandler = require("cords-handler");
const chclient = new chandler.Client();
chclient.on("catchError", async (data) => {
  console.log(data);
});
let cmdhandler = new chandler.CommandHandler(client, chclient)
  .setCommandFolder("./commands")
  .setPrefix("!")
  .loader();

Console:

{ command: 'test/test.js', message: 'Cannot Read name.' }`

Note

Event Listeners Must Be Above Of The Handler's Definition.

EasyCord

const { Client } = require("discord.js");
const client = new Client();
const chandler = require("cords-handler");
const chclient = new chandler.Client();
client.on("message", async (msg) => {
  let easycord = await new chandler.EasyCord(client);
  let m1 = await msg.channel.send("hi");
  easycord.editAfter(m1, "this message has edited", 1000); // this function will edit the message after 1 second
  easycord.deleteAfter(m1, 1000); // this function will delete the message after 1 second
  easycord.createdAt(msg.author); // this function will return the user's account creation date(1 Years,2 Days,10 Hours,34 Minutes,54 Seconds Ago.)
  easycord.userFlags(msg.author); // this function will return the user's badges as an array
  easycord.messageAwaiter(msg, 3000, msg.author); // this function will create a message collector
  easycord.setSlowMode("6s", msg.channel); // this function will set a slowmode in the channel
  easycord.autoPublish(); // this function will auto publish the messages at all news channels
});

Await Reactions

const { Client } = require("discord.js");
const client = new Client();
const chandler = require("cords-handler");
const chclient = new chandler.Client();
client.on("message", async (msg) => {
  const message = await msg.channel.send("Do You Confirm?");
  const awaitreactions = await new lib.AwaitReactions().start(
    message,
    msg.author,
    ["✅", "👌", "❌"],
    5000
  );
  if (awaitreactions === "✅") return msg.channel.send("You Confirmed!");
  if (awaitreactions === "👌") return msg.channel.send("Command Stopped");
  if (awaitreactions === "❌") return msg.channel.send("Ok Bye.");
  if (!awaitreactions)
    return msg.channel.send("You Havent Reacted In 5 Seconds.");
});

Contact Us

Github
Discord Sever
Email Adress: info@cordshandler.tk
When You Sent A Mail Wait 2-3 Minutes And Check Your Spams Folder/Mail Box.

Package Sidebar

Install

npm i cords-handler

Weekly Downloads

6

Version

1.2.24

License

ISC

Unpacked Size

36.6 kB

Total Files

14

Last publish

Collaborators

  • adebowale
  • freakthedev