add: log to Discord the start of voting

This commit is contained in:
Sentennial 2022-09-15 14:17:43 -05:00
parent c5835fc847
commit f824cd5bd9

View File

@ -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'
}
};
}
@ -511,6 +524,8 @@ export default class MapVote extends BasePlugin {
}
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}`
}
]
}
});
}
}