mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 20:43:52 -06:00
add: log to Discord the start of voting
This commit is contained in:
parent
c5835fc847
commit
f824cd5bd9
35
mapvote.js
35
mapvote.js
@ -1,6 +1,7 @@
|
||||
//Plugin 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"
|
||||
@ -79,7 +80,19 @@ export default class MapVote extends BasePlugin {
|
||||
required: false,
|
||||
description: 'random layer list will not include the blacklisted layers or levels. (acceptable formats: Gorodok/Gorodok_RAAS/Gorodok_AAS_v1)',
|
||||
default: []
|
||||
}
|
||||
},
|
||||
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'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -510,7 +523,9 @@ export default class MapVote extends BasePlugin {
|
||||
nominationStrings.push(formatChoice(choice, this.nominations[ choice ].replace(/\_/gi, ' ').replace(/\sv\d{1,2}/gi, '') + ' ' + this.factionStrings[ choice ], this.tallies[ choice ], this.firstBroadcast));
|
||||
}
|
||||
await this.broadcast(nominationStrings.join("\n"));
|
||||
|
||||
|
||||
if (this.firstBroadcast)
|
||||
await this.logVoteToDiscord(nominationStrings.join("\n"))
|
||||
this.firstBroadcast = false;
|
||||
}
|
||||
//const winners = this.currentWinners;
|
||||
@ -584,4 +599,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