Skip to content
/ paul Public
forked from nitrodragon/wayne

A modular bot template for discord.js

Notifications You must be signed in to change notification settings

Kalakoi/paul

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

paul

A modular bot template for discord.js.

Getting Started

First, edit the bot.js file and fill out OWNERID, PREFIX, and TOKEN.

The OWNERID variable should be set to your Discord ID, which you can obtain by enabling developer mode (found in the "apperance" tab in settings), right clicking your name in the online list of any server, and then clicking "Copy ID".

The PREFIX variable is used to tell the bot what prefix your commands should use. Most bots use !.

The TOKEN variable is your Discord bot's token. You can get this from the Discord Developer Portal.

After you've filled these out, install the indev version of discord.js using NPM. Be sure you have node.js >=6.0.0, and then run npm install hydrabolt/discord.js#indev. If you need voice support, you can run npm install discord.js node-opus for node-opus support, or npm install discord.js opusscript for opusscript support.

Adding Commands

To add commands to the bot, create new .js files in the commands directory. After writing whatever JavaScript is neccesary for your command, add the following lines to the bottom of the file:

module.exports = {
  main: (bot, msg, settings) => {
	//your code goes here
  },
  args: '<string>',
  help: 'sample help text',
  hide: false
}

The main function gives you access to everything in the bot.js file. So, for example, to send a reply, you can just add msg.reply("reply") inside the main function, and it will run whenever the command is called.

The other three lines at the bottom help to generate the help text. If you set hide to true, it won't show up inside the help menu, but otherwise, you should include args and help, and fill them out to help the end user.

args tells the user what arguments they need to provide, and help is just to provide generic help text.

Running

Finally, to run the bot, a simple node bot.js will usually do. However, if you want to keep your bot running, I suggest you use forever. Install it with npm install forever -g, and then just run forever start bot.js inside the same folder as the bot.

Default Functionality

Paul provides four core commands within bot.js out of the box:

  • help - Generates a help message based on loaded commands
  • load <file> - Loads a new command from <file>
  • unload <file> - Unloads <file>, disabling the command
  • reload - Reloads all currently loaded commands

Alongside these, there are three commands in the commands folder by default. They can be removed, but they serve as good utility commands.

  • ping - Used to test if the bot is responding.
  • setgame - Changes the bot's status (what game they are "playing").

Roadmap

  • Configuration file support, and an easy way to access it.
  • Better logging

About

A modular bot template for discord.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%