fix/not sending all alarm embeds
This commit is contained in:
2 files changed
+8
-13
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dayzr-bot",
|
"name": "dayzr-bot",
|
||||||
"version": "12.4.8",
|
"version": "12.4.9",
|
||||||
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
|||||||
+7
-12
@@ -184,22 +184,17 @@ class DayzRBot extends Client {
|
|||||||
|
|
||||||
// Handle alarm pings
|
// Handle alarm pings
|
||||||
const maxEmbed = 10;
|
const maxEmbed = 10;
|
||||||
for (const [channel_id, data] of Object.entries(this.alarmPingQueue)) {
|
for (const [channel_id, data] of Object.entrries(this.alarmPingQueue)) {
|
||||||
const channel = this.GetChannel(channel_id);
|
const channel = this.GetChannel(channel_id);
|
||||||
if (!channel) continue;
|
if (!channel) continue;
|
||||||
for (const [role, embeds] of Object.entries(data)) {
|
for (const [role, embeds] of Object.entries(data)) {
|
||||||
if (embeds.length > maxEmbed) {
|
let embedArrays = [];
|
||||||
let embedArrays = [];
|
while (embeds.length > 0)
|
||||||
while (embeds.length > maxEmbed)
|
embedArrays.push(embeds.splice(0, maxEmbed))
|
||||||
embedArrays.push(embeds.splice(0, maxEmbed));
|
|
||||||
|
|
||||||
for (let i = 0; i < embedArrays.length; i++) {
|
for (let i = 0; i < embedArrays.length; i++) {
|
||||||
if (role == '-no-role-ping-') channel.send({ embeds: embedArrays[i] });
|
if (role == '-no-role-ping-') channel.send({ embeds: embedArrays[i] });
|
||||||
else channel.send({ content: `<@&${role}>`, embeds: embedArrays[i] });
|
else channel.send({ content: `<@&${role}>`, embeds: embedArrays[i] });
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (role == '-no-role-ping-') channel.send({ embeds: embeds });
|
|
||||||
else channel.send({ content: `<@&${role}>`, embeds: embeds });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user