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
- Host: GitHub
- URL: https://github.com/maxerbox/required-prefixe-fisherman
- Owner: maxerbox
- Created: 2017-07-26T20:13:48.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-31T18:25:44.000Z (almost 9 years ago)
- Last Synced: 2025-03-17T07:54:12.759Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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