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) { if (soos) {
list<Image> copy = coalesced; list<Image> copy = coalesced;
copy.reverse(); copy.reverse();
copy.pop_back();
copy.pop_front();
coalesced.insert(coalesced.end(), copy.begin(), copy.end()); coalesced.insert(coalesced.end(), copy.begin(), copy.end());
} else { } else {
coalesced.reverse(); coalesced.reverse();

20
package-lock.json generated
View file

@ -1159,9 +1159,9 @@
} }
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.3.806", "version": "1.3.807",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.807.tgz",
"integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==", "integrity": "sha512-p8uxxg2a23zRsvQ2uwA/OOI+O4BQxzaR7YKMIGGGQCpYmkFX2CVF5f0/hxLMV7yCr7nnJViCwHLhPfs52rIYCA==",
"dev": true, "dev": true,
"peer": true "peer": true
}, },
@ -1211,8 +1211,8 @@
} }
}, },
"node_modules/eris-fleet": { "node_modules/eris-fleet": {
"version": "0.3.8", "version": "0.3.9",
"resolved": "git+ssh://git@github.com/esmBot/eris-fleet.git#d0998c55b4dcb4ac951b297637429961d277a291", "resolved": "git+ssh://git@github.com/esmBot/eris-fleet.git#29bdc8b50ab910d64ca78cbd6db751e4642b97d4",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"eris": "^0.15.0" "eris": "^0.15.0"
@ -4522,9 +4522,9 @@
"integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg==" "integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg=="
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.806", "version": "1.3.807",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.807.tgz",
"integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==", "integrity": "sha512-p8uxxg2a23zRsvQ2uwA/OOI+O4BQxzaR7YKMIGGGQCpYmkFX2CVF5f0/hxLMV7yCr7nnJViCwHLhPfs52rIYCA==",
"dev": true, "dev": true,
"peer": true "peer": true
}, },
@ -4566,8 +4566,8 @@
} }
}, },
"eris-fleet": { "eris-fleet": {
"version": "git+ssh://git@github.com/esmBot/eris-fleet.git#d0998c55b4dcb4ac951b297637429961d277a291", "version": "git+ssh://git@github.com/esmBot/eris-fleet.git#29bdc8b50ab910d64ca78cbd6db751e4642b97d4",
"from": "eris-fleet@github:esmBot/eris-fleet", "from": "eris-fleet@esmBot/eris-fleet",
"requires": {} "requires": {}
}, },
"erlpack": { "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 res.write(`# HELP esmbot_command_count Number of times a command has been run
# TYPE esmbot_command_count counter # 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") { if (process.env.API === "true") {
const servers = await this.ipc.command("image", { type: "stats" }, 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)) { for (const [i, w] of Object.entries(counts)) {
res.write(`esmbot_command_count{command="${i}"} ${w}\n`); 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(); res.end();
}); });
this.httpServer.listen(process.env.METRICS, () => { this.httpServer.listen(process.env.METRICS, () => {

View file

@ -94,7 +94,11 @@ exports.nextSong = async (client, message, connection, track, info, music, voice
let playingMessage; let playingMessage;
if (!music && this.players.get(voiceChannel.guild.id)) { if (!music && this.players.get(voiceChannel.guild.id)) {
const playMessage = this.players.get(voiceChannel.guild.id).playMessage; 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) { if (lastTrack === track) {
playingMessage = this.players.get(voiceChannel.guild.id).playMessage; playingMessage = this.players.get(voiceChannel.guild.id).playMessage;