mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 18:23:52 -06:00
Merge pull request #4 from Coolisbetter/logToDiscord
add: log to Discord the start of voting
This commit is contained in:
commit
be0463988c
33
mapvote.js
33
mapvote.js
@ -1,6 +1,7 @@
|
||||
//Plugin reworked by JetDave, original version by MaskedMonkeyMan
|
||||
|
||||
import BasePlugin from "./base-plugin.js";
|
||||
import DiscordBasePlugin from './discord-base-plugin.js';
|
||||
|
||||
import fs from "fs";
|
||||
import { Layers } from "../layers/index.js"
|
||||
@ -94,6 +95,18 @@ export default class MapVote extends BasePlugin {
|
||||
required: false,
|
||||
description: 'Message that is sent as broadcast to announce a vote',
|
||||
default: "✯ MAPVOTE ✯ Vote for the next map by writing in chat the corresponding number!"
|
||||
},
|
||||
logToDiscord: {
|
||||
required: false,
|
||||
description: 'Log votes to Discord',
|
||||
default: false
|
||||
},
|
||||
...DiscordBasePlugin.optionsSpecification,
|
||||
channelID: {
|
||||
required: false,
|
||||
description: 'The ID of the channel to log votes to.',
|
||||
default: '',
|
||||
example: '667741905228136459'
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -590,7 +603,9 @@ export default class MapVote extends BasePlugin {
|
||||
}
|
||||
if (this.nominations[ 0 ]) nominationStrings.push(formatChoice(0, this.nominations[ 0 ], this.tallies[ 0 ], (this.options.hideVotesCount || this.firstBroadcast)))
|
||||
await this.broadcast(nominationStrings.join("\n"));
|
||||
|
||||
|
||||
if (this.firstBroadcast)
|
||||
await this.logVoteToDiscord(nominationStrings.join("\n"))
|
||||
this.firstBroadcast = false;
|
||||
}
|
||||
//const winners = this.currentWinners;
|
||||
@ -664,4 +679,20 @@ export default class MapVote extends BasePlugin {
|
||||
|
||||
return ties.map(i => this.nominations[ i ]);
|
||||
}
|
||||
|
||||
async logVoteToDiscord(message) {
|
||||
if (!this.options.logToDiscord) return
|
||||
await this.sendDiscordMessage({
|
||||
embed: {
|
||||
title: 'Vote Started',
|
||||
color: 16761867,
|
||||
fields: [
|
||||
{
|
||||
name: 'Options:',
|
||||
value: `${message}`
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user