mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-24 00:13:52 -06:00
add: log to Discord the start of voting
This commit is contained in:
parent
c5835fc847
commit
f824cd5bd9
33
mapvote.js
33
mapvote.js
@ -1,6 +1,7 @@
|
|||||||
//Plugin by MaskedMonkeyMan
|
//Plugin by MaskedMonkeyMan
|
||||||
|
|
||||||
import BasePlugin from "./base-plugin.js";
|
import BasePlugin from "./base-plugin.js";
|
||||||
|
import DiscordBasePlugin from './discord-base-plugin.js';
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { Layers } from "../layers/index.js"
|
import { Layers } from "../layers/index.js"
|
||||||
@ -79,7 +80,19 @@ export default class MapVote extends BasePlugin {
|
|||||||
required: false,
|
required: false,
|
||||||
description: 'random layer list will not include the blacklisted layers or levels. (acceptable formats: Gorodok/Gorodok_RAAS/Gorodok_AAS_v1)',
|
description: 'random layer list will not include the blacklisted layers or levels. (acceptable formats: Gorodok/Gorodok_RAAS/Gorodok_AAS_v1)',
|
||||||
default: []
|
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'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,6 +524,8 @@ export default class MapVote extends BasePlugin {
|
|||||||
}
|
}
|
||||||
await this.broadcast(nominationStrings.join("\n"));
|
await this.broadcast(nominationStrings.join("\n"));
|
||||||
|
|
||||||
|
if (this.firstBroadcast)
|
||||||
|
await this.logVoteToDiscord(nominationStrings.join("\n"))
|
||||||
this.firstBroadcast = false;
|
this.firstBroadcast = false;
|
||||||
}
|
}
|
||||||
//const winners = this.currentWinners;
|
//const winners = this.currentWinners;
|
||||||
@ -584,4 +599,20 @@ export default class MapVote extends BasePlugin {
|
|||||||
|
|
||||||
return ties.map(i => this.nominations[ i ]);
|
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