Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.
/ purplewaffle Public archive

a discord.js command system

License

Notifications You must be signed in to change notification settings

oatmealine/purplewaffle

Repository files navigation

purplewaffle

Build Status

purplewaffle is a discord.js command system, aiming for flexibility and simplicity

i don't recommend using purplewaffle in it's current state, as it's heavily WIP

how to use

you dont need to change anything other than files in the script directory and the config.json file. (the config.json file is required to run the bot, and there's an example in config.example.json)

after youve changed everything to your needs, simply run it with node (node main.js (--v))

you can include the --v (or --verbose) parameter to see all verbose logs. if you ever get an error, re-run the bot in verbose mode and when you get the error, attach the log to the issue

config.json values

{
    "token": "", //the token for the bot
    "commandsFolder": "./commands", //the folder in which all the commands/scripts are stored in
    "ownerid": "", //your id, will be used for the OWNER permission (leave blank for autodetect via application)
    "prefix": "", //the prefix for the bot, ex. "pw-"
    "blacklist": [ //an array of user ids that will be prevented from using commands (must be number)

    ]
}

how to add commands

adding commands is very simple: add a .js file in your script directory, and an optional but recommended file with the same name, but with .meta.json instead of .js.

each command/script is a simple script (not to be confused with a module) that's ran in the event, specified in the meta json (message by default). for example, if you have the event be "message", then the script is ran when theres a command with the format prefix commandname arguments.

public script variables

  • message - the message value. (only in message event)
  • args - arguments of the message (message.content.split(" ")) (only in message event)
  • bot - the d.js client value

you can use any other value defined in main.js, too (example in help.js)

script metadata values

{
    "permissions": {
        "whitelist": false, //whether you want the command to be only executable by permissions in the list below
        "list": [] //the list of permissions able to execute the command (d.js permissions and OWNER for owner-only)
    },
    "clientPermissions": { //same as permissions, except permissions the bot needs to execute the command
        "whitelist": false,
        "list": ["SEND_MESSAGES"]
    },
    "event": "message", //what event to add the script to
    "description": "evaluate a piece of code" //the description (used in help.js)
}

credits

mat for owner id autodetect

leo60228 for patchEmitter()

purplewαffle