feat: round ended implementation with discord logging

This commit is contained in:
Davide Fantino 2023-01-15 22:53:35 +01:00
parent 3ddc60cbf0
commit 4f78d480ce

View File

@ -645,7 +645,53 @@ export default class MapVote extends DiscordBasePlugin {
async endVotingGently() { async endVotingGently() {
this.endVoting(); this.endVoting();
await this.broadcast(this.options.voteWinnerBroadcastMessage + this.formatFancyLayer(Layers.layers.find((l) => l.layerid == this.updateNextMap()))); const winnerLayer = Layers.layers.find((l) => l.layerid == this.updateNextMap());
const fancyWinner = this.formatFancyLayer(winnerLayer);
await this.broadcast(this.options.voteWinnerBroadcastMessage + fancyWinner);
if (!this.options.logToDiscord) return
return await this.sendDiscordMessage({
embed: {
title: `Vote winner: ${fancyWinner}`,
color: 16761867,
fields: [
{
name: 'Map',
value: winnerLayer.map.name,
inline: true
},
{
name: 'Gamemode',
value: winnerLayer.gamemode,
inline: true
},
{
name: 'Version',
value: winnerLayer.version,
inline: true
},
{
name: 'LayerID',
value: winnerLayer.layerid,
inline: false
},
{
name: 'Team 1',
value: winnerLayer.teams[ 0 ].faction,
inline: true
},
{
name: 'Team 2',
value: winnerLayer.teams[ 1 ].faction,
inline: true
},
],
image: {
url: `https://squad-data.nyc3.cdn.digitaloceanspaces.com/main/${winnerLayer.layerid}.jpg`
},
},
timestamp: (new Date()).toISOString()
});
} }
endVoting() { endVoting() {
@ -760,7 +806,7 @@ export default class MapVote extends DiscordBasePlugin {
async logVoteToDiscord(message) { async logVoteToDiscord(message) {
if (!this.options.logToDiscord) return if (!this.options.logToDiscord) return
await this.sendDiscordMessage({ return await this.sendDiscordMessage({
embed: { embed: {
title: 'Vote Started', title: 'Vote Started',
color: 16761867, color: 16761867,