Added Remove user via dropdown command
This commit is contained in:
parent
05487cba84
commit
bb5926d062
5 changed files with 97 additions and 4 deletions
|
@ -1,10 +1,7 @@
|
|||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using System.Reflection;
|
||||
using DiscordBot.Messages;
|
||||
using DiscordBot.Services;
|
||||
using SharedClasses.SharedModels;
|
||||
using DiscordBot.Messages;
|
||||
|
||||
namespace DiscordBot.CommandHandlers
|
||||
{
|
||||
|
@ -33,6 +30,10 @@ namespace DiscordBot.CommandHandlers
|
|||
ExternalRoleSelectionMessage.Parameters externalRoleParameters = ExternalRoleSelectionMessage.ParseId(component.Data.CustomId);
|
||||
await component.RespondWithModalAsync(ExternalUserNameModal.buildMessage(externalRoleParameters.RaidId, int.Parse(component.Data.Values.First())));
|
||||
break;
|
||||
case Constants.ComponentIds.REMOVE_USER_DROP_DOWN:
|
||||
RemoveUserMessage.Parameters removeUserParameters = RemoveUserMessage.ParseId(component.Data.CustomId);
|
||||
await RemoveUser(component, removeUserParameters);
|
||||
break;
|
||||
case Constants.ComponentIds.ACCOUNT_SELECT_DROP_DOWN:
|
||||
AccountSelectionMessage.Parameters accountParameters = AccountSelectionMessage.ParseId(component.Data.CustomId);
|
||||
int accountId = int.Parse(component.Data.Values.First());
|
||||
|
@ -55,5 +56,24 @@ namespace DiscordBot.CommandHandlers
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RemoveUser(SocketMessageComponent component, RemoveUserMessage.Parameters removeUserParameters)
|
||||
{
|
||||
ApiSignUp signOff = new ApiSignUp()
|
||||
{
|
||||
raidId = removeUserParameters.RaidId,
|
||||
signedUpByUserId = removeUserParameters.SignedUpByUserId
|
||||
};
|
||||
if (ulong.TryParse(component.Data.Values.First(), out ulong userId))
|
||||
{
|
||||
signOff.userId = userId;
|
||||
}
|
||||
else
|
||||
{
|
||||
signOff.userName = component.Data.Values.First();
|
||||
}
|
||||
await _httpService.SignOff(signOff);
|
||||
await _handlerFunctions.UpdateOrRespond(component, $"signed off {component.Data.Values.First()}", null, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -94,6 +94,10 @@ namespace DiscordBot.CommandHandlers
|
|||
await _httpService.SignOff(signOffExternal);
|
||||
await command.RespondAsync($"signed off {userName}", ephemeral:true);
|
||||
break;
|
||||
case Constants.SlashCommands.REMOVE_USER_DROPDOWN_COMMAND:
|
||||
ApiRaid raid = await _httpService.GetRaid(raidId);
|
||||
await command.RespondAsync("Which user do you want to sign off?", components: RemoveUserMessage.buildMessage(raid, command.User.Id), ephemeral: true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue