0.0.6 • Published 3 years ago

discord-wr v0.0.6

Weekly downloads
8
License
MIT
Repository
-
Last release
3 years ago

Discord Wrapper

This is a wrapper for discord.js's client.

Installing

NPM:
  npm i discord-wr

Yarn:
  yarn add discord-wr

Creating a client

// Typescript
import { Client } from 'discord-wr';
// Javascript
const { Client } = require('discord-wr');

const client = new Client({
  token: process.env.BOT_TOKEN, // The token the bot needs to log in.     (required)
  prefix: '!',                  // The prefix used for message handling.  (optional)
  terminal: true                // Create a terminal when bot is ready.   (optional)
  // All options under the next heading.
})

Client Options

  • token (string) : The token the bot should log in with. (Bot automatically logs in)
  • prefix? (string) : The prefix to be used by the command handler. (Required if using command handler)
  • botCheck? (boolean) : Should the command handler check if a message's author is a bot. (Defaults to true)
  • autoHelp? (boolean | string) : Automatically generate a help command. (If the value is a string, it will be used as the command's embed colour.)
  • terminal? (boolean) : Open a terminal when the bot is ready.
  • discord? (object) : Other options used by discord. [Source]

Commands

This requires the option prefix to be set.

Command Type

type Command = {
  group?: string,                                 // Group                  (defaults to General)
  name: string,                                   // Name of command
  desc?: string,                                  // Description for command
  dm?: boolean,                                   // Allow command in DM    (defaults to false)
  noHelp?: boolean,                               // Don't show on help
  handler: (msg: Message, args: string[]) => void // Runs when command called
}

Adding

client.addCommand({commandType})

// Example
client.addCommand({
  name: 'Ping',
  desc: 'Pong!',
  dm: true,
  handler: (msg) => {
    msg.channel.send('Pong!');
  }
})

Removing

client.removeCommand('name of command')

// Example
client.removeCommand('ping');
0.0.6

3 years ago

0.0.5

3 years ago

0.0.4-ALPHA

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago