Skip to content

Commit

Permalink
added voice support for Server status changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FaiThiX committed Feb 21, 2024
1 parent 642a3d0 commit bed0757
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rustplusEvents/connected.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const DiscordMessages = require('../discordTools/discordMessages.js');
const Info = require('../structures/Info');
const Map = require('../structures/Map');
const PollingHandler = require('../handlers/pollingHandler.js');
const discordVoice = require('../discordTools/discordVoice.js');

module.exports = {
name: 'connected',
Expand Down Expand Up @@ -68,6 +69,8 @@ module.exports = {

await rustplus.map.writeMap(false, true);
await DiscordMessages.sendServerWipeDetectedMessage(guildId, serverId);
await discordVoice.sendDiscordVoiceMessage(guildId,
client.intlGet(guildId, 'wipeDetected'));
await DiscordMessages.sendInformationMapMessage(guildId);
}
else {
Expand All @@ -93,6 +96,8 @@ module.exports = {
}

await DiscordMessages.sendServerChangeStateMessage(guildId, serverId, 0);
await discordVoice.sendDiscordVoiceMessage(guildId,
client.intlGet(guildId, 'serverJustOnline'))
}

await DiscordMessages.sendServerMessage(guildId, serverId, null);
Expand Down
3 changes: 3 additions & 0 deletions src/rustplusEvents/disconnected.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
const DiscordMessages = require('../discordTools/discordMessages.js');

const Config = require('../../config');
const discordVoice = require('../discordTools/discordVoice.js');

module.exports = {
name: 'disconnected',
Expand Down Expand Up @@ -61,6 +62,8 @@ module.exports = {
if (client.activeRustplusInstances[guildId]) {
if (!client.rustplusReconnecting[guildId]) {
await DiscordMessages.sendServerChangeStateMessage(guildId, serverId, 1);
await discordVoice.sendDiscordVoiceMessage(guildId,
client.intlGet(guildId, 'serverJustOffline'))
await DiscordMessages.sendServerMessage(guildId, serverId, 2);
}

Expand Down

0 comments on commit bed0757

Please sign in to comment.