diff --git a/utils/services/prometheus.js b/utils/services/prometheus.js index 8ff2824..8fb4277 100644 --- a/utils/services/prometheus.js +++ b/utils/services/prometheus.js @@ -17,6 +17,8 @@ class PrometheusWorker extends BaseServiceWorker { # TYPE esmbot_command_count counter # HELP esmbot_server_count Number of servers/guilds the bot is in # TYPE esmbot_server_count gauge +# HELP esmbot_shard_count Number of shards the bot has +# TYPE esmbot_shard_count gauge `); if (process.env.API === "true") { const servers = await this.ipc.command("image", { type: "stats" }, true); @@ -43,6 +45,7 @@ esmbot_connected_workers ${servers.length} const stats = await this.ipc.getStats(); res.write(`esmbot_server_count ${stats.guilds}\n`); + res.write(`esmbot_shard_count ${stats.shardCount}\n`); res.end(); }); this.httpServer.listen(process.env.METRICS, () => { diff --git a/utils/soundplayer.js b/utils/soundplayer.js index e6cb8af..8e11dab 100644 --- a/utils/soundplayer.js +++ b/utils/soundplayer.js @@ -133,9 +133,13 @@ export async function nextSong(client, message, connection, track, info, music, await connection.volume(75); players.set(voiceChannel.guild.id, { player: connection, type: music ? "music" : "sound", host: message.author.id, voiceChannel: voiceChannel, originalChannel: message.channel, loop: loop, shuffle: shuffle, playMessage: playingMessage }); connection.once("error", (error) => { - if (playingMessage.channel.messages.get(playingMessage.id)) playingMessage.delete(); - const playMessage = players.get(voiceChannel.guild.id).playMessage; - if (playMessage.channel.messages.get(playMessage.id)) playMessage.delete(); + try { + if (playingMessage.channel.messages.get(playingMessage.id)) playingMessage.delete(); + const playMessage = players.get(voiceChannel.guild.id).playMessage; + if (playMessage.channel.messages.get(playMessage.id)) playMessage.delete(); + } catch { + // no-op + } manager.leave(voiceChannel.guild.id); connection.removeAllListeners("end"); connection.destroy();