| Lines of Code | 51 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 6 | class FisherResponse { |
||
| 7 | /** |
||
| 8 | * Creates an instance of FisherResponse. |
||
| 9 | * @param {Fisherman} client |
||
| 10 | * @param {FisherRouter} router |
||
| 11 | */ |
||
| 12 | constructor (client, router) { |
||
| 13 | /** |
||
| 14 | * @private |
||
| 15 | * @type {FisherRouter} |
||
| 16 | */ |
||
| 17 | this.router = router |
||
| 18 | /** |
||
| 19 | * @private |
||
| 20 | * @type {Fisherman} |
||
| 21 | */ |
||
| 22 | this.client = client |
||
| 23 | } |
||
| 24 | /** |
||
| 25 | * |
||
| 26 | * Emit a "fisherCode" event |
||
| 27 | * @param {(number|FisherCode)} code The code to send |
||
| 28 | * @param {Error} [err = null] An error to pass |
||
|
|
|||
| 29 | * @fires Fisherman#fisherCode |
||
| 30 | * @memberof FisherResponse |
||
| 31 | */ |
||
| 32 | sendCode (code, err = null) { |
||
| 33 | /** |
||
| 34 | * Emitted when a fisherCode is by the router, or when something bad happenned |
||
| 35 | * @event Fisherman#fisherCode |
||
| 36 | * @param {FisherRouter} router the router |
||
| 37 | * @param {FisherCode} code the fisherman code |
||
| 38 | * @param {Error} err the error |
||
| 39 | */ |
||
| 40 | this.client.emit('fisherCode', this.router, code, err) |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * |
||
| 45 | * Same as channel.send() |
||
| 46 | * @see https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=send |
||
| 47 | * @param {string} text |
||
| 48 | * @param {Object} [data = {}] |
||
| 49 | * @returns {Promise<Message|Message[]>} |
||
| 50 | * @memberof FisherResponse |
||
| 51 | */ |
||
| 52 | send (text, data = {}) { |
||
| 53 | return this.router.request.channel.send(text, data) |
||
| 54 | } |
||
| 55 | } |
||
| 56 | module.exports = FisherResponse |
||
| 57 |