everyone who is allowed do use slash commands can now sign up users ignoring the raid requirements

This commit is contained in:
Sarah Faey 2022-12-04 11:40:32 +01:00
parent 9c6386e137
commit de351e167c
2 changed files with 8 additions and 11 deletions

View file

@ -76,7 +76,7 @@ namespace DiscordBot.CommandHandlers
public async Task SelectRole(SocketInteraction component, int raidId, string buttonType, bool allRoles, ulong userIdToSignUp, ulong signedUpByUserId) 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<ApiRole> roles = new List<ApiRole>(); List<ApiRole> roles = new List<ApiRole>();
roles = await _httpService.GetRoles(raidId, userIdToSignUp); roles = await _httpService.GetRoles(raidId, userIdToSignUp);

View file

@ -116,17 +116,14 @@ namespace DiscordBot.CommandHandlers
private async Task SignUpExternalUser(SocketSlashCommand command, int raidId) private async Task SignUpExternalUser(SocketSlashCommand command, int raidId)
{ {
if(await _handlerFunctions.IsRaidSignUpAllowed(command, raidId, Constants.ComponentIds.SIGN_UP_BUTTON)) List<ApiRole> roles = await _httpService.GetRoles(raidId, uint.MaxValue);
Tuple<bool, string> signUpAllowed = await _httpService.IsExternalSignUpAllowed(raidId);
if(!signUpAllowed.Item1)
{ {
List<ApiRole> roles = await _httpService.GetRoles(raidId, uint.MaxValue); await command.RespondAsync(signUpAllowed.Item2, ephemeral: true);
Tuple<bool, string> signUpAllowed = await _httpService.IsExternalSignUpAllowed(raidId); return;
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("Please choose a role.", components: ExternalRoleSelectionMessage.buildMessage(roles, raidId) , ephemeral: true);
} }
private async Task SendMessages(string message, int raidId) private async Task SendMessages(string message, int raidId)