()
| 3 | |
| 4 | class MediaStatsCommand extends Command { |
| 5 | async run() { |
| 6 | if (!this.permissions.has("EMBED_LINKS")) { |
| 7 | this.success = false; |
| 8 | return this.getString("permissions.noEmbedLinks"); |
| 9 | } |
| 10 | await this.acknowledge(); |
| 11 | const embed = { |
| 12 | embeds: [ |
| 13 | { |
| 14 | author: { |
| 15 | name: this.getString("commands.responses.mediastats.header"), |
| 16 | iconURL: this.client.user.avatarURL(), |
| 17 | }, |
| 18 | color: 0xff0000, |
| 19 | description: this.getString("commands.responses.mediastats.connected", { |
| 20 | params: { length: connections.size.toString() }, |
| 21 | }), |
| 22 | fields: [{ name: "", value: "" }], |
| 23 | }, |
| 24 | ], |
| 25 | }; |
| 26 | embed.embeds[0].fields = []; |
| 27 | let i = 0; |
| 28 | for (const connection of connections.values()) { |
| 29 | const count = await connection.getCount().catch(() => {}); |
| 30 | if (!count) continue; |
| 31 | embed.embeds[0].fields.push({ |
| 32 | name: this.getString("commands.responses.mediastats.server", { |
| 33 | params: { num: (connection.name ? `${i++} (${connection.name})` : i++).toString() }, |
| 34 | }), |
| 35 | value: this.getString("commands.responses.mediastats.runningJobs", { params: { count: count.toString() } }), |
| 36 | }); |
| 37 | } |
| 38 | return embed; |
| 39 | } |
| 40 | |
| 41 | static description = "Gets some statistics about the media servers"; |
| 42 | static aliases = ["imgstat", "imstats", "imgstats", "imstat", "imagestats", "mstat", "mstats"]; |
nothing calls this directly
no test coverage detected