Make it so the user can only vote one time for each question

This commit is contained in:
Oliver-Akins 2021-12-02 17:29:08 -06:00
parent e52fbb74bb
commit fec987114f

View file

@ -73,7 +73,11 @@ export const run_twitch = (): void => {
// Check if the user is voting
let match = message.match(/\((?<choice>[A-F])\i)/)
if (match && question_index != -1) {
if (
match // choice found in message
&& users[context.username] == null // user not voted yet
&& question_index != -1 // quiz started
) {
let choice: string = (match as any).choice;
// Update the user's answer