properly handle deleting HandleActivePlayersList prev. embeds
This commit is contained in:
1 file changed
+7
-5
+7
-5
@@ -5,6 +5,8 @@ const { SendConnectionLogs, DetectCombatLog } = require('./AdminLogsHandler');
|
|||||||
// custom util imports
|
// custom util imports
|
||||||
const { FetchServerSettings } = require('../util/NitradoAPI');
|
const { FetchServerSettings } = require('../util/NitradoAPI');
|
||||||
|
|
||||||
|
let lastSendMessage;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
HandlePlayerLogs: async (client, guildId, stats, line) => {
|
HandlePlayerLogs: async (client, guildId, stats, line) => {
|
||||||
@@ -217,11 +219,11 @@ module.exports = {
|
|||||||
.setTitle(`Players Online:`)
|
.setTitle(`Players Online:`)
|
||||||
.setDescription(des || (nodes ? "No Players Online :(" : ""))
|
.setDescription(des || (nodes ? "No Players Online :(" : ""))
|
||||||
|
|
||||||
return channel.send({ embeds: [PlayersEmbed, activePlayersEmbed] }).then(sentMessage => {
|
if (lastSendMessage) lastSendMessage.delete().catch(error => client.sendError(channel, `HandleActivePlayersList Error: \n${error}`)); // Remove previous message before reprinting
|
||||||
setTimeout(() => {
|
|
||||||
sentMessage.delete().catch(error => client.sendError(channel, `HandleActivePlayersList Error: \n${error}`));
|
return channel.send({ embeds: [PlayersEmbed, activePlayersEmbed] }).then(sentMessage =>
|
||||||
}, 360000);
|
lastSendMessage = sentMessage
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user