An open API service indexing awesome lists of open source software.

https://github.com/maxerbox/required-prefixe-fisherman

Fisherman middleware/plugin : Used to execute a command, only if the prefixe match with the one you want for the command
https://github.com/maxerbox/required-prefixe-fisherman

Last synced: 8 months ago
JSON representation

Fisherman middleware/plugin : Used to execute a command, only if the prefixe match with the one you want for the command

Awesome Lists containing this project

README

          

# Fisherman Required Prefixe

## Setup

### Adding the middleware to fisherman

```javascript
const fisherman = require("fisherman-discord.js")
var bot = new fisherman.Fisherman({prefixes: ["!", "cat!"]});
const _reqPrefixe = require("required-prefixe-fisherman");
var requirePrefixe = new _reqPrefixe({sendCode: true, code: 789}) //it will trigger the event fisherCode with a InvalidPrefixeException if the required prefixe is not respected
//If sendCode is set to false, it will just block the middleware chain and doesn't trigger a fishercode
bot.use(requirePrefixe);
```

### Setting up the command

```javascript
var register = bot.createRegister('test', 'test') //Create a register named "test"
register.textCommand('ping', {locales: {requiredPrefixe: "!"}, function (req, res) { //the command will be only trigerred if the prefixe "!" is used
var current = Date.now()
res.send('Pinging......').then((message) => {
message.edit((Date.now() - current) + 'ms')
})
})
```

This modules is used as example, and can be improved manually, like for example supporting and array of required prefixes