From de351e167c2180acde60acb789adf61ab791a4b6 Mon Sep 17 00:00:00 2001 From: Sarah Faey Date: Sun, 4 Dec 2022 11:40:32 +0100 Subject: [PATCH] everyone who is allowed do use slash commands can now sign up users ignoring the raid requirements --- DiscordBot/CommandHandlers/HandlerFunctions.cs | 2 +- .../CommandHandlers/SlashCommandHandler.cs | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/DiscordBot/CommandHandlers/HandlerFunctions.cs b/DiscordBot/CommandHandlers/HandlerFunctions.cs index af7fd09..3df0b5e 100644 --- a/DiscordBot/CommandHandlers/HandlerFunctions.cs +++ b/DiscordBot/CommandHandlers/HandlerFunctions.cs @@ -76,7 +76,7 @@ namespace DiscordBot.CommandHandlers public async Task SelectRole(SocketInteraction component, int raidId, string buttonType, bool allRoles, ulong userIdToSignUp, ulong signedUpByUserId) { - if(await IsRaidSignUpAllowed(component, raidId, buttonType)) + if(signedUpByUserId != 0 || await IsRaidSignUpAllowed(component, raidId, buttonType)) { List roles = new List(); roles = await _httpService.GetRoles(raidId, userIdToSignUp); diff --git a/DiscordBot/CommandHandlers/SlashCommandHandler.cs b/DiscordBot/CommandHandlers/SlashCommandHandler.cs index 791a120..8c87410 100644 --- a/DiscordBot/CommandHandlers/SlashCommandHandler.cs +++ b/DiscordBot/CommandHandlers/SlashCommandHandler.cs @@ -115,18 +115,15 @@ namespace DiscordBot.CommandHandlers } private async Task SignUpExternalUser(SocketSlashCommand command, int raidId) - { - if(await _handlerFunctions.IsRaidSignUpAllowed(command, raidId, Constants.ComponentIds.SIGN_UP_BUTTON)) + { + List roles = await _httpService.GetRoles(raidId, uint.MaxValue); + Tuple signUpAllowed = await _httpService.IsExternalSignUpAllowed(raidId); + if(!signUpAllowed.Item1) { - List roles = await _httpService.GetRoles(raidId, uint.MaxValue); - Tuple signUpAllowed = await _httpService.IsExternalSignUpAllowed(raidId); - if(!signUpAllowed.Item1) - { - await command.RespondAsync(signUpAllowed.Item2, ephemeral: true); - return; - } - await command.RespondAsync("Please choose a role.", components: ExternalRoleSelectionMessage.buildMessage(roles, raidId) , ephemeral: true); + await command.RespondAsync(signUpAllowed.Item2, ephemeral: true); + return; } + await command.RespondAsync("Please choose a role.", components: ExternalRoleSelectionMessage.buildMessage(roles, raidId) , ephemeral: true); } private async Task SendMessages(string message, int raidId)