implemented polls in the discord bot

This commit is contained in:
Sarah Faey 2023-01-14 16:44:18 +01:00
parent 1d999e89bf
commit 715b14ecc5
13 changed files with 277 additions and 6 deletions

View file

@ -63,6 +63,19 @@ namespace DiscordBot.CommandHandlers
await modal.RespondAsync($"signing up failed", ephemeral: true);
}
break;
case Constants.ComponentIds.POLL_CUSTOM_ANSWER_MODAL:
PollCustomModal.Parameters pollParameters = PollCustomModal.ParseId(modal.Data.CustomId);
string modalAnswer = components.First(x => x.CustomId == Constants.ComponentIds.POLL_CUSTOM_ANSWER_TEXT_BOX).Value;
ApiPollAnswer answer = new ApiPollAnswer()
{
Answer = modalAnswer,
OptionId = 0,
PollId = pollParameters.PollId,
UserId = modal.User.Id
};
await _httpService.AnswerPoll(answer);
await modal.RespondAsync("Answer sent.", ephemeral: true);
break;
}
}
}