mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-24 01:23:52 -06:00
added cancelauto command
This commit is contained in:
parent
c1e6f93aa7
commit
4339815acd
@ -11,6 +11,7 @@ The `MapVote` plugin for squad js based on the original version https://github.c
|
|||||||
#### Admin Commands
|
#### Admin Commands
|
||||||
- `!vote start` - Starts a vote with 6 layers, random modes
|
- `!vote start` - Starts a vote with 6 layers, random modes
|
||||||
- `!vote cancel` - Cancels current round of voting
|
- `!vote cancel` - Cancels current round of voting
|
||||||
|
- `!vote cancelauto` - Cancel scheduled automatic start of vote
|
||||||
- `!vote restart` - Restarts voting with 6 random maps and modes
|
- `!vote restart` - Restarts voting with 6 random maps and modes
|
||||||
- `!vote broadcast` - Broadcasts current voting results - happens every 7m automatically
|
- `!vote broadcast` - Broadcasts current voting results - happens every 7m automatically
|
||||||
|
|
||||||
|
14
mapvote.js
14
mapvote.js
@ -139,6 +139,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
bypassRaasFilter: false
|
bypassRaasFilter: false
|
||||||
};
|
};
|
||||||
this.or_options = { ...this.options };
|
this.or_options = { ...this.options };
|
||||||
|
this.autovotestart = null;
|
||||||
|
|
||||||
this.onNewGame = this.onNewGame.bind(this);
|
this.onNewGame = this.onNewGame.bind(this);
|
||||||
this.onPlayerDisconnected = this.onPlayerDisconnected.bind(this);
|
this.onPlayerDisconnected = this.onPlayerDisconnected.bind(this);
|
||||||
@ -183,7 +184,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.tallies = [];
|
this.tallies = [];
|
||||||
this.nominations = [];
|
this.nominations = [];
|
||||||
this.factionStrings = [];
|
this.factionStrings = [];
|
||||||
if (this.options.automaticVoteStart) setTimeout(this.beginVoting, toMils(this.options.voteWaitTimeFromMatchStart));
|
if (this.options.automaticVoteStart) this.autovotestart = setTimeout(this.beginVoting, toMils(this.options.voteWaitTimeFromMatchStart));
|
||||||
setTimeout(() => this.setSeedingMode(true), 10000);
|
setTimeout(() => this.setSeedingMode(true), 10000);
|
||||||
}, 10000)
|
}, 10000)
|
||||||
}
|
}
|
||||||
@ -323,6 +324,17 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.endVoting();
|
this.endVoting();
|
||||||
await this.warn(steamID, "Ending current vote");
|
await this.warn(steamID, "Ending current vote");
|
||||||
return;
|
return;
|
||||||
|
case "cancelauto": //cancels the current vote and wont set next map to current winnner
|
||||||
|
if (!isAdmin) return;
|
||||||
|
|
||||||
|
if (!this.autovotestart) {
|
||||||
|
await this.warn(steamID, "There is no automatic vote start scheduled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearTimeout(this.autovotestart);
|
||||||
|
this.autovotestart = null;
|
||||||
|
await this.warn(steamID, "Ending current vote");
|
||||||
|
return;
|
||||||
case "broadcast":
|
case "broadcast":
|
||||||
if (!this.votingEnabled) {
|
if (!this.votingEnabled) {
|
||||||
await this.warn(steamID, "There is no vote running right now");
|
await this.warn(steamID, "There is no vote running right now");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user