You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
4 years ago | |
---|---|---|
lib | 4 years ago | |
.gitignore | 4 years ago | |
LICENSE | 4 years ago | |
README.md | 4 years ago | |
index.js | 4 years ago | |
package.json | 4 years ago | |
yarn.lock | 4 years ago |
README.md
discord-microframework
Interaction-oriented NodeJS bot micro-framework for Discord.
Getting started
Prerequisites
- NodeJS
- NPM
- Yarn
Install
From npm
yarn add discord-microframework
or
npm i discord-microframework
Use
const Discord = require('discord-microframework');
Bot
Instanciation
const Bot = new Discord.Bot(name, token, logLevel);
name
stringtoken
stringlogLevel
string
Start / Stop
Bot.start();
Bot.stop();
Discord.Bot.startAll();
Discord.Bot.stopAll();
Command handler
Instanciation
const myCommandHandler = new Discord.CommandHandler(name, prefix, bots, channels, logLevel);
name
stringprefix
stringbots
boolean - Decide wether to handle commands from bots or not.
(default :false
)channels
array - Channels ID where commands are handled.
(default :null
— means everywhere)logLevel
string
Commands subscription
myCommandHandler.subscribe(command => {
// do something
});
cmd
string - Command without prefix and parametersargs
array - Command parametersargs_assoc
object - Associative command parameters (parsed askey=value
)del
function - Delete commandout
function - Output response (short for 'output')message
string
rep
function - Output response with mention (short for 'reply')message
string
dm
function - Output response in DMmessage
string
react
functionreaction(s)
string or array - Unicode emoji characters
Handler activation
Bot.use(myCommandHandler);
Reaction handler
Instanciation
const myReactionHandler = new Discord.ReactionHandler(name, emojis);
name
stringemojis
array - Unicode emoji characters
Handler activation
Bot.use(myReactionHandler);
Handler listening
myReactionHandler.listen(message, callbacks, user, remove, bots, logLevel);
Getters
Bot.channels()
Bot.guilds()
Bot.users()
Classes
Discord.RichEmbed
Built with
Node modules :
- discord.js - Discord bot API
- console-stamp - Timestamped logging
- p-queue - Ordered Promises resolution
- zen-observable - Observables implementation
Changelog
1.0.0
(2019-06-??) • Initial release