Skip to content

Commit

Permalink
Fix for #293
Browse files Browse the repository at this point in the history
  • Loading branch information
alexemanuelol committed Mar 15, 2024
1 parent 83e2e93 commit 97679cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 10 additions & 2 deletions src/discordTools/discordMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ module.exports = {
await module.exports.sendMessage(guildId, content, null, instance.channelId.events);
},

sendActivityNotificationMessage: async function (guildId, serverId, color, text, steamId, title = null) {
sendActivityNotificationMessage: async function (guildId, serverId, color, text, steamId, title = null, everyone = false) {
const instance = Client.client.getInstance(guildId);

let png = null;
Expand All @@ -355,6 +355,10 @@ module.exports = {
embeds: [DiscordEmbeds.getActivityNotificationEmbed(guildId, serverId, color, text, steamId, png, title)]
}

if (everyone) {
content.content = '@everyone';
}

await module.exports.sendMessage(guildId, content, null, instance.channelId.activity);
},

Expand Down Expand Up @@ -574,13 +578,17 @@ module.exports = {
await Client.client.interactionEditReply(interaction, content);
},

sendBattlemetricsEventMessage: async function (guildId, battlemetricsId, title, description, fields = null) {
sendBattlemetricsEventMessage: async function (guildId, battlemetricsId, title, description, fields = null, everyone = false) {
const instance = Client.client.getInstance(guildId);

const content = {
embeds: [DiscordEmbeds.getBattlemetricsEventEmbed(guildId, battlemetricsId, title, description, fields)]
}

if (everyone) {
content.content = '@everyone';
}

await module.exports.sendMessage(guildId, content, null, instance.channelId.activity);
},

Expand Down
12 changes: 8 additions & 4 deletions src/handlers/battlemetricsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ module.exports = {
tracker: content.name
});
await DiscordMessages.sendActivityNotificationMessage(
guildId, content.serverId, Constants.COLOR_ACTIVE, str, null, content.title);
guildId, content.serverId, Constants.COLOR_ACTIVE, str, null, content.title,
content.everyone);
if (rustplus && (rustplus.serverId === content.serverId) && content.inGame) {
rustplus.sendInGameMessage(str);
}
Expand All @@ -139,7 +140,8 @@ module.exports = {
tracker: content.name
});
await DiscordMessages.sendActivityNotificationMessage(
guildId, content.serverId, Constants.COLOR_ACTIVE, str, null, content.title);
guildId, content.serverId, Constants.COLOR_ACTIVE, str, null, content.title,
content.everyone);
if (rustplus && (rustplus.serverId === content.serverId) && content.inGame) {
rustplus.sendInGameMessage(str);
}
Expand All @@ -157,7 +159,8 @@ module.exports = {
});

await DiscordMessages.sendActivityNotificationMessage(
guildId, content.serverId, Constants.COLOR_INACTIVE, str, null, content.title);
guildId, content.serverId, Constants.COLOR_INACTIVE, str, null, content.title,
content.everyone);
if (rustplus && (rustplus.serverId === content.serverId) && content.inGame) {
rustplus.sendInGameMessage(str);
}
Expand Down Expand Up @@ -431,6 +434,7 @@ module.exports = {
`__**${client.intlGet(guildId, 'old')}:**__ ${oldName}\n` +
`__**${client.intlGet(guildId, 'new')}:**__ ${newName}`;

await DiscordMessages.sendBattlemetricsEventMessage(guildId, battlemetricsId, title, description);
await DiscordMessages.sendBattlemetricsEventMessage(guildId, battlemetricsId, title, description, null,
instance.trackers[trackerId].everyone);
},
}

0 comments on commit 97679cf

Please sign in to comment.