Made soos more smooth, added server count to prometheus, fixed unhandled soundplayer error

This commit is contained in:
Essem 2021-08-16 23:04:11 -05:00
parent 382480e1c7
commit 560d3883ad
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
4 changed files with 22 additions and 11 deletions

View file

@ -27,6 +27,8 @@ Napi::Value Reverse(const Napi::CallbackInfo &info) {
if (soos) {
list<Image> copy = coalesced;
copy.reverse();
copy.pop_back();
copy.pop_front();
coalesced.insert(coalesced.end(), copy.begin(), copy.end());
} else {
coalesced.reverse();

20
package-lock.json generated
View file

@ -1159,9 +1159,9 @@
}
},
"node_modules/electron-to-chromium": {
"version": "1.3.806",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz",
"integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==",
"version": "1.3.807",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.807.tgz",
"integrity": "sha512-p8uxxg2a23zRsvQ2uwA/OOI+O4BQxzaR7YKMIGGGQCpYmkFX2CVF5f0/hxLMV7yCr7nnJViCwHLhPfs52rIYCA==",
"dev": true,
"peer": true
},
@ -1211,8 +1211,8 @@
}
},
"node_modules/eris-fleet": {
"version": "0.3.8",
"resolved": "git+ssh://git@github.com/esmBot/eris-fleet.git#d0998c55b4dcb4ac951b297637429961d277a291",
"version": "0.3.9",
"resolved": "git+ssh://git@github.com/esmBot/eris-fleet.git#29bdc8b50ab910d64ca78cbd6db751e4642b97d4",
"license": "MIT",
"peerDependencies": {
"eris": "^0.15.0"
@ -4522,9 +4522,9 @@
"integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg=="
},
"electron-to-chromium": {
"version": "1.3.806",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz",
"integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==",
"version": "1.3.807",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.807.tgz",
"integrity": "sha512-p8uxxg2a23zRsvQ2uwA/OOI+O4BQxzaR7YKMIGGGQCpYmkFX2CVF5f0/hxLMV7yCr7nnJViCwHLhPfs52rIYCA==",
"dev": true,
"peer": true
},
@ -4566,8 +4566,8 @@
}
},
"eris-fleet": {
"version": "git+ssh://git@github.com/esmBot/eris-fleet.git#d0998c55b4dcb4ac951b297637429961d277a291",
"from": "eris-fleet@github:esmBot/eris-fleet",
"version": "git+ssh://git@github.com/esmBot/eris-fleet.git#29bdc8b50ab910d64ca78cbd6db751e4642b97d4",
"from": "eris-fleet@esmBot/eris-fleet",
"requires": {}
},
"erlpack": {

View file

@ -15,6 +15,8 @@ class PrometheusWorker extends BaseServiceWorker {
}
res.write(`# HELP esmbot_command_count Number of times a command has been run
# TYPE esmbot_command_count counter
# HELP esmbot_server_count Number of servers/guilds the bot is in
# TYPE esmbot_server_count gauge
`);
if (process.env.API === "true") {
const servers = await this.ipc.command("image", { type: "stats" }, true);
@ -38,6 +40,9 @@ esmbot_connected_workers ${servers.length}
for (const [i, w] of Object.entries(counts)) {
res.write(`esmbot_command_count{command="${i}"} ${w}\n`);
}
const stats = await this.ipc.getStats();
res.write(`esmbot_server_count ${stats.guilds}\n`);
res.end();
});
this.httpServer.listen(process.env.METRICS, () => {

View file

@ -94,7 +94,11 @@ exports.nextSong = async (client, message, connection, track, info, music, voice
let playingMessage;
if (!music && this.players.get(voiceChannel.guild.id)) {
const playMessage = this.players.get(voiceChannel.guild.id).playMessage;
if (playMessage.channel.messages.get(playMessage.id)) playMessage.delete();
try {
playMessage.delete();
} catch {
// no-op
}
}
if (lastTrack === track) {
playingMessage = this.players.get(voiceChannel.guild.id).playMessage;