This package has been deprecated

Author message:

Use another module instead.

dbcm

1.3.2 • Public • Published

⚠️WARNING️ This package is now deprecated.

Discord Bot Commands Manager🤖

Version Maintenance License: MIT Downloads

Discord Bot Commands Manager(dbcm) is project to support discord bot command control in a few lines.

Install

  • NPM:
npm install dbcm --save
  • Yarn
yarn add dbcm

Usage

const Discord = require("discord.js")
const dbcm = require("dbcm")
const client = new dbcm.Client({
    dev: "Dev ID" || ["Dev ID", "Dev ID"], //That will ignore cooldown and blacklist.
    lang: "en-US", //This also can be setted by locale. (default: english) Supported languages: kr(korean), en(english) and pt(portuguese-brazil)
    disableEveryone: true, //discord.js client options are also valid.
    ignoresCooldown: ["User1", "User2"], //Specifying users to ignore cooldowns
    ignoreCooldownIfIsAdmin: true, //This will cause them to ignore cooldowns if they have admin permission
    cooldown: {
        time: 3000, //3 seconds
        msg: "%{message.author}, you're in cooldown to use the commands."
        /**
          * %{message.author} - mentions the author of msg
          * %{message.author.id} - The message author's user ID
          * %{message.guild.name} - The guild name
          * %{message.guild.id} - The id of guild
          * %{cmd.cooldown} - The cooldown of cmd in seconds. WARNING: That will appear in String type. Please use client.cooltime to get in Number type
        */
    },
 
    blacklist: {
        list: ["User ID"],
        msg: "%{message.author}, you're on blacklist."
        /**
          * %{message.author} - mentions the author of msg
          * %{message.author.id} - The message author's user ID
          * %{message.guild.name} - The guild name
          * ${message.guild.id} - The id of guild
        */
    }
})
 
 
//Registering the commands
client.registerCommands(require.resolve("./commands"), { createSample: true, jsFilter: true }) 
/*
If you type only client.registerCommands(require.resolve("./commands")), 
the two settings above will remain true which is the default.
*/
 
 
//Running the commands
client.on("message", async message => {
    //... your if(...) return options
 
    const args = message.content.slice("PREFIX".length).trim().split(/ +/g)
    const command = args.shift().toLowerCase()
    /*
    Some ways to get the command, such as message.content.split(" ") and a 
    few more lines, may not work because the command itself is contained in 
    the array. To solve this problem if even trying const command = <MessageArray>.shift() 
    doesn't work out, throw in the issues(https://github.com/Zero-Brazil734/dbcm/issues
    that check what the problem is.
    */
 
    //Running
    client.runCommand(command, msg, args, { dbpassword: "asdf1234", dbuser: "Anonymous" }) 
    /*
    Your own handling data, you can get it by placing it 
    in the object after args. (And of course you will need 
    to change the original exports.run to 
    exports.run = (client, message, args, yourdata) => { <CommandCode> })
    */
        .then(runned => {
            if(runned === true) return //do something
        })
        .catch(err => {
            throw new Error(err)
        })
    //The default is cooldown disabled
 
    //Utilities
    if(command === "discordStatus") { 
        utils.discordStatus("summary" || "status" || "unresolved_incidents" || "all_incidents" || "upcoming_maintenances" || "active_maintenances" || "all_maintenances", data => { //callback of the datas found
            console.log(data) 
        //Show this data in object form
        })
    }
 
    if(command === "reverse") { 
        msg.channel.send(utils.reverse(msg.content)) //Sending message with the message reversed of what you sent.
        /**
         * > utils.reverse("test")
         * > tset
        */
    }
 
    if(command === "numberFilter") {
        msg.reply(utils.numberFilter(args.join(" "), { toNumber: false }) //toNumber's default: false
        //Filter only the numbers in the message content and return it
    }
 
    //Other methods you may discover through IntelliSense
})

Example

Please visit dbcm-example

Author

👤 제로ㅣBrazil

🤝 Contributing

Contributions, issues and feature requests are very welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 제로ㅣBrazil.
This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator

Package Sidebar

Install

npm i dbcm

Weekly Downloads

35

Version

1.3.2

License

MIT

Unpacked Size

59.9 kB

Total Files

18

Last publish

Collaborators

  • zero734kr