Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict'
- const BaseCommand = require('./BaseCommand')
- class ParamCommand extends BaseCommand {
- /**
- *
- * @param {string} textPattern
- * @param {string} [handler]
- * @param {Array} ...arguments the arguments passed to parameter
- */
- constructor(textPattern, handler, ...parameters) {
- super()
- this._regexp = new RegExp()
- this._handler = handler
- this._param = parameters
- }
- /**
- * @param {Scope} scope
- * @returns {boolean}
- */
- test(scope) {
- return scope.message.text &&
- scope.message.text.indexOf(this._textPattern) > -1
- }
- /**
- * @returns {string}
- */
- get handlerName() {
- return this._handler
- }
- }
- module.exports = ParamCommand
Advertisement
Add Comment
Please, Sign In to add comment