0
0
Fork 0

Add a unique message for when someone selects the same vote in the dropdown that they are already voting for

This commit is contained in:
Oliver-Akins 2021-07-19 15:44:09 -06:00
parent b30e8deb68
commit 3b7a44e133

View file

@ -5,6 +5,19 @@ export async function selectQuote(data: any): Promise<object> {
let userID = data.member.user.id;
let oldVote = db.bracket.users[userID];
// Assert votes are different
if (oldVote === vote) {
return {
type: 4,
data: {
content: `You're already voting for that quote!`,
flags: 1 << 6,
}
};
};
// Set quote to 0 if it hasn't been voted for yet
if (!db.bracket.votes[vote]) {
db.bracket.votes[vote] = 0;