New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discwork

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discwork

A discord.js command framework.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

discwork npm JavaScript Style Guide

💿 A Discord.js command framework. 🛠

Setup

The following will install discwork and Discord.js:

npm i -s discwork discord.js

For additional packages of Discord.js, see the Discord.js Installation page.

Usage

const Discord = require('discord.js')
const client = new Discord.Client()

var discwork = require('discwork')(client)

client.on('ready', () => {
  console.log(`MyBot logged in as ${client.user.tag}!`);
})

discwork.add(/^mb!ping$/, (message, matches) => { // Simple command
  message.reply(`${client.ping}ms`)
})

discwork.add(/^mb!echo (.+)$/, (message, matches) => { // Command with parameters
  message.reply(matches[1]) // Get first parameter (0th element of array is the full command text)
})

discwork.done()

client.login('token')

Documentation

.add

Adds a command.

Parameters
  • regex - The command RegExp, or an array of RegExpes
  • action - The command handler function
Example
discwork.add(/^mb!ping$/, (message, matches) => {
  message.reply(`${client.ping}ms`)
})

.done

Finishes the command list. Must be called after all commands were added.

Example
discwork.done()

Keywords

FAQs

Package last updated on 17 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc