(message, [piece])
| 13 | } |
| 14 | |
| 15 | async run(message, [piece]) { |
| 16 | if (piece === 'everything') return this.everything(message); |
| 17 | if (piece instanceof Store) { |
| 18 | const timer = new Stopwatch(); |
| 19 | await piece.loadAll(); |
| 20 | await piece.init(); |
| 21 | if (this.client.shard) { |
| 22 | await this.client.shard.broadcastEval(` |
| 23 | if (String(this.options.shards) !== '${this.client.options.shards}') this.${piece.name}.loadAll().then(() => this.${piece.name}.init()); |
| 24 | `); |
| 25 | } |
| 26 | return message.sendLocale('COMMAND_RELOAD_ALL', [piece, timer.stop()]); |
| 27 | } |
| 28 | |
| 29 | try { |
| 30 | const itm = await piece.reload(); |
| 31 | const timer = new Stopwatch(); |
| 32 | if (this.client.shard) { |
| 33 | await this.client.shard.broadcastEval(` |
| 34 | if (String(this.options.shards) !== '${this.client.options.shards}') this.${piece.store}.get('${piece.name}').reload(); |
| 35 | `); |
| 36 | } |
| 37 | return message.sendLocale('COMMAND_RELOAD', [itm.type, itm.name, timer.stop()]); |
| 38 | } catch (err) { |
| 39 | piece.store.set(piece); |
| 40 | return message.sendLocale('COMMAND_RELOAD_FAILED', [piece.type, piece.name]); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | async everything(message) { |
| 45 | const timer = new Stopwatch(); |
nothing calls this directly
no test coverage detected