reworkes sign up messages
This commit is contained in:
parent
57d8df1463
commit
03624a5859
9 changed files with 136 additions and 126 deletions
|
@ -22,34 +22,23 @@ namespace DiscordBot.CommandHandlers
|
||||||
public async Task Handler(SocketMessageComponent component)
|
public async Task Handler(SocketMessageComponent component)
|
||||||
{
|
{
|
||||||
string[] ids = component.Data.CustomId.Split('-');
|
string[] ids = component.Data.CustomId.Split('-');
|
||||||
List<ApiRole> roles = new List<ApiRole>();
|
|
||||||
int parsedRaidId = 0;
|
|
||||||
if(ids.Length > 1)
|
|
||||||
{
|
|
||||||
int.TryParse(ids[1],out parsedRaidId);
|
|
||||||
}
|
|
||||||
switch(ids[0])
|
switch(ids[0])
|
||||||
{
|
{
|
||||||
case Constants.ComponentIds.SIGN_UP_BUTTON:
|
case Constants.ComponentIds.SIGN_UP_BUTTON:
|
||||||
if(await _handlerFunctions.IsRaidSignUpAllowed(component, parsedRaidId, ids[0]))
|
RaidMessage.ButtonParameters signUpParameters = RaidMessage.ParseButtonId(component.Data.CustomId);
|
||||||
{
|
await _handlerFunctions.SelectRole(component, signUpParameters.RaidId, signUpParameters.ButtonType, false, component.User.Id, 0);
|
||||||
roles = await _httpService.GetRoles(parsedRaidId, component.User.Id);
|
break;
|
||||||
await component.RespondAsync("Please choose a role.", components: RoleSelectionMessage.buildMessage(roles, parsedRaidId, ids[0], false) , ephemeral: true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Constants.ComponentIds.MAYBE_BUTTON:
|
case Constants.ComponentIds.MAYBE_BUTTON:
|
||||||
case Constants.ComponentIds.BACKUP_BUTTON:
|
case Constants.ComponentIds.BACKUP_BUTTON:
|
||||||
case Constants.ComponentIds.FLEX_BUTTON:
|
case Constants.ComponentIds.FLEX_BUTTON:
|
||||||
if(await _handlerFunctions.IsRaidSignUpAllowed(component, parsedRaidId, ids[0]))
|
RaidMessage.ButtonParameters maybeParameters = RaidMessage.ParseButtonId(component.Data.CustomId);
|
||||||
{
|
await _handlerFunctions.SelectRole(component, maybeParameters.RaidId, maybeParameters.ButtonType, true, component.User.Id, 0);
|
||||||
roles = await _httpService.GetRoles(parsedRaidId, component.User.Id);
|
break;
|
||||||
await component.RespondAsync("Please choose a role.", components: RoleSelectionMessage.buildMessage(roles, parsedRaidId, ids[0], true) , ephemeral: true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Constants.ComponentIds.SIGN_OFF_BUTTON:
|
case Constants.ComponentIds.SIGN_OFF_BUTTON:
|
||||||
|
RaidMessage.ButtonParameters signOffParameters = RaidMessage.ParseButtonId(component.Data.CustomId);
|
||||||
ApiSignUp signOff = new ApiSignUp()
|
ApiSignUp signOff = new ApiSignUp()
|
||||||
{
|
{
|
||||||
raidId = parsedRaidId,
|
raidId = signOffParameters.RaidId,
|
||||||
userId = component.User.Id
|
userId = component.User.Id
|
||||||
};
|
};
|
||||||
await _httpService.SignOff(signOff);
|
await _httpService.SignOff(signOff);
|
||||||
|
@ -57,6 +46,5 @@ namespace DiscordBot.CommandHandlers
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -69,6 +69,75 @@ 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))
|
||||||
|
{
|
||||||
|
List<ApiRole> roles = new List<ApiRole>();
|
||||||
|
roles = await _httpService.GetRoles(raidId, userIdToSignUp);
|
||||||
|
if(roles.Count > 1)
|
||||||
|
{
|
||||||
|
await component.RespondAsync("Please choose a role.", components: RoleSelectionMessage.buildMessage(roles, raidId, buttonType, allRoles, userIdToSignUp, signedUpByUserId) , ephemeral: true);
|
||||||
|
}
|
||||||
|
else if(roles.Count == 1)
|
||||||
|
{
|
||||||
|
await SelectAccount(buttonType, raidId, component, roles.First().roleId, userIdToSignUp, signedUpByUserId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await component.RespondAsync("no role found.", ephemeral: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SelectAccount(string buttonType, int raidId, SocketInteraction component, int roleId, ulong userIdToSignUp, ulong signedUpByUserId)
|
||||||
|
{
|
||||||
|
|
||||||
|
List<ApiGuildWars2Account> accounts = await _httpService.GetSignUpAccounts(userIdToSignUp, raidId);
|
||||||
|
if(accounts.Count == 1)
|
||||||
|
{
|
||||||
|
ApiGuildWars2Account account = accounts.First();
|
||||||
|
await SignUp(buttonType, raidId, roleId, userIdToSignUp, account.GuildWars2AccountId, signedUpByUserId);
|
||||||
|
await component.RespondAsync("successfully signed up", ephemeral: true);
|
||||||
|
}
|
||||||
|
else if(accounts.Count > 1)
|
||||||
|
{
|
||||||
|
await component.RespondAsync("Please choose an account.", components: AccountSelectionMessage.buildMessage(accounts, raidId, buttonType, roleId, userIdToSignUp, signedUpByUserId) , ephemeral: true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await component.RespondAsync("no suitable Guild Wars 2 account found.", ephemeral: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SignUp(string buttonType, int raidId, int roleId, ulong userIdToSignUp, int gw2AccountId, ulong signedUpByUserId)
|
||||||
|
{
|
||||||
|
ApiSignUp signUp = new ApiSignUp()
|
||||||
|
{
|
||||||
|
raidId = raidId,
|
||||||
|
roleId = roleId,
|
||||||
|
gw2AccountId = gw2AccountId,
|
||||||
|
userId = userIdToSignUp,
|
||||||
|
signedUpByUserId = signedUpByUserId
|
||||||
|
};
|
||||||
|
|
||||||
|
switch(buttonType)
|
||||||
|
{
|
||||||
|
case Constants.ComponentIds.SIGN_UP_BUTTON:
|
||||||
|
await _httpService.SignUp(signUp);
|
||||||
|
break;
|
||||||
|
case Constants.ComponentIds.MAYBE_BUTTON:
|
||||||
|
await _httpService.SignUpMaybe(signUp);
|
||||||
|
break;
|
||||||
|
case Constants.ComponentIds.BACKUP_BUTTON:
|
||||||
|
await _httpService.SignUpBackup(signUp);
|
||||||
|
break;
|
||||||
|
case Constants.ComponentIds.FLEX_BUTTON:
|
||||||
|
await _httpService.SignUpFlex(signUp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//to avoid error messages because of no response...
|
//to avoid error messages because of no response...
|
||||||
public async Task Respond(SocketInteraction component)
|
public async Task Respond(SocketInteraction component)
|
||||||
|
|
|
@ -42,15 +42,7 @@ namespace DiscordBot.CommandHandlers
|
||||||
|
|
||||||
//sign up
|
//sign up
|
||||||
CreateAccountModal.Parameters createAccountParameters = CreateAccountModal.ParseId(modal.Data.CustomId);
|
CreateAccountModal.Parameters createAccountParameters = CreateAccountModal.ParseId(modal.Data.CustomId);
|
||||||
if(await _handlerFunctions.IsRaidSignUpAllowed(modal, createAccountParameters.RaidId, createAccountParameters.ButtonId))
|
await _handlerFunctions.SelectRole(modal, createAccountParameters.RaidId, createAccountParameters.ButtonId, false, modal.User.Id, 0);
|
||||||
{
|
|
||||||
List<ApiRole> roles = await _httpService.GetRoles(createAccountParameters.RaidId, modal.User.Id);
|
|
||||||
await modal.RespondAsync("Please choose a role.",
|
|
||||||
components: RoleSelectionMessage.buildMessage(roles, createAccountParameters.RaidId, createAccountParameters.ButtonId, false),
|
|
||||||
ephemeral: true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await _handlerFunctions.Respond(modal);
|
|
||||||
break;
|
break;
|
||||||
case Constants.ComponentIds.SIGN_UP_EXTERNAL_MODAL:
|
case Constants.ComponentIds.SIGN_UP_EXTERNAL_MODAL:
|
||||||
string userName = components.First(x => x.CustomId == Constants.ComponentIds.NAME_TEXT_BOX).Value;
|
string userName = components.First(x => x.CustomId == Constants.ComponentIds.NAME_TEXT_BOX).Value;
|
||||||
|
|
|
@ -24,77 +24,22 @@ namespace DiscordBot.CommandHandlers
|
||||||
string[] ids = component.Data.CustomId.Split('-');
|
string[] ids = component.Data.CustomId.Split('-');
|
||||||
switch(ids[0])
|
switch(ids[0])
|
||||||
{
|
{
|
||||||
case Constants.ComponentIds.SIGN_UP_DROP_DOWN:
|
case Constants.ComponentIds.ROLE_SELECT_DROP_DOWN:
|
||||||
RoleSelectionMessage.Parameters roleParameters = RoleSelectionMessage.ParseId(component.Data.CustomId);
|
RoleSelectionMessage.Parameters roleParameters = RoleSelectionMessage.ParseId(component.Data.CustomId);
|
||||||
ulong userIdToSignUp = component.User.Id;;
|
int parsedRoleId = int.Parse(component.Data.Values.First());
|
||||||
ulong signedUpByUserId = 0;
|
await _handlerFunctions.SelectAccount(roleParameters.ButtonType, roleParameters.RaidId, component, parsedRoleId, roleParameters.UserIdToSignUp, roleParameters.SignedUpByUserId);
|
||||||
if(roleParameters.UserIdToSignUp != 0)
|
|
||||||
{
|
|
||||||
userIdToSignUp = roleParameters.UserIdToSignUp;
|
|
||||||
signedUpByUserId = component.User.Id;
|
|
||||||
}
|
|
||||||
await ManageSignUp(roleParameters.ButtonType, roleParameters.RaidId, component, userIdToSignUp, signedUpByUserId);
|
|
||||||
break;
|
break;
|
||||||
case Constants.ComponentIds.SIGN_UP_EXTERNAL_DROP_DOWN:
|
case Constants.ComponentIds.ROLE_SELECT_EXTERNAL_DROP_DOWN:
|
||||||
ExternalRoleSelectionMessage.Parameters externalRoleParameters = ExternalRoleSelectionMessage.ParseId(component.Data.CustomId);
|
ExternalRoleSelectionMessage.Parameters externalRoleParameters = ExternalRoleSelectionMessage.ParseId(component.Data.CustomId);
|
||||||
await component.RespondWithModalAsync(ExternalUserNameModal.buildMessage(externalRoleParameters.RaidId, int.Parse(component.Data.Values.First())));
|
await component.RespondWithModalAsync(ExternalUserNameModal.buildMessage(externalRoleParameters.RaidId, int.Parse(component.Data.Values.First())));
|
||||||
break;
|
break;
|
||||||
case Constants.ComponentIds.ACCOUNT_SELECT_DROP_DOWN:
|
case Constants.ComponentIds.ACCOUNT_SELECT_DROP_DOWN:
|
||||||
AccountSelectionMessage.Parameters accountParameters = AccountSelectionMessage.ParseId(component.Data.CustomId);
|
AccountSelectionMessage.Parameters accountParameters = AccountSelectionMessage.ParseId(component.Data.CustomId);
|
||||||
int accountId = int.Parse(component.Data.Values.First());
|
int accountId = int.Parse(component.Data.Values.First());
|
||||||
await SignUp(accountParameters.ButtonType, accountParameters.RaidId, accountParameters.RoleId, accountParameters.UserIdToSignUp, accountId, accountParameters.SignedUpByUserId);
|
await _handlerFunctions.SignUp(accountParameters.ButtonType, accountParameters.RaidId, accountParameters.RoleId, accountParameters.UserIdToSignUp, accountId, accountParameters.SignedUpByUserId);
|
||||||
await component.RespondAsync("successfully signed up", ephemeral: true);
|
await component.RespondAsync("successfully signed up", ephemeral: true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ManageSignUp(string buttonType, int raidId, SocketMessageComponent component, ulong userIdToSignUp, ulong signedUpByUserId = 0)
|
|
||||||
{
|
|
||||||
if(! int.TryParse(component.Data.Values.First(), out int parsedRoleId)) return;
|
|
||||||
|
|
||||||
List<ApiGuildWars2Account> accounts = await _httpService.GetSignUpAccounts(userIdToSignUp, raidId);
|
|
||||||
if(accounts.Count == 1)
|
|
||||||
{
|
|
||||||
ApiGuildWars2Account account = accounts.First();
|
|
||||||
await SignUp(buttonType, raidId, parsedRoleId, userIdToSignUp, account.GuildWars2AccountId, signedUpByUserId);
|
|
||||||
await component.RespondAsync("successfully signed up", ephemeral: true);
|
|
||||||
}
|
|
||||||
else if(accounts.Count > 1)
|
|
||||||
{
|
|
||||||
await component.RespondAsync("Please choose an account.", components: AccountSelectionMessage.buildMessage(accounts, raidId, buttonType, parsedRoleId, userIdToSignUp, signedUpByUserId) , ephemeral: true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await component.RespondAsync("no suitable Guild Wars 2 account found.", ephemeral: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SignUp(string buttonType, int raidId, int roleId, ulong userIdToSignUp, int gw2AccountId, ulong signedUpByUserId = 0)
|
|
||||||
{
|
|
||||||
ApiSignUp signUp = new ApiSignUp()
|
|
||||||
{
|
|
||||||
raidId = raidId,
|
|
||||||
roleId = roleId,
|
|
||||||
gw2AccountId = gw2AccountId,
|
|
||||||
userId = userIdToSignUp,
|
|
||||||
signedUpByUserId = signedUpByUserId
|
|
||||||
};
|
|
||||||
|
|
||||||
switch(buttonType)
|
|
||||||
{
|
|
||||||
case Constants.ComponentIds.SIGN_UP_BUTTON:
|
|
||||||
await _httpService.SignUp(signUp);
|
|
||||||
break;
|
|
||||||
case Constants.ComponentIds.MAYBE_BUTTON:
|
|
||||||
await _httpService.SignUpMaybe(signUp);
|
|
||||||
break;
|
|
||||||
case Constants.ComponentIds.BACKUP_BUTTON:
|
|
||||||
await _httpService.SignUpBackup(signUp);
|
|
||||||
break;
|
|
||||||
case Constants.ComponentIds.FLEX_BUTTON:
|
|
||||||
await _httpService.SignUpFlex(signUp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,8 +22,6 @@ namespace DiscordBot.CommandHandlers
|
||||||
_handlerFunctions = new HandlerFunctions(_httpService);
|
_handlerFunctions = new HandlerFunctions(_httpService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task Handler(SocketSlashCommand command)
|
public async Task Handler(SocketSlashCommand command)
|
||||||
{
|
{
|
||||||
Tuple<bool, string> commandExecutionAllowed = await _httpService.IsSlashCommandAllowed(command.User.Id, command.Data.Name);
|
Tuple<bool, string> commandExecutionAllowed = await _httpService.IsSlashCommandAllowed(command.User.Id, command.Data.Name);
|
||||||
|
@ -99,24 +97,20 @@ namespace DiscordBot.CommandHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SignUpUser(SocketSlashCommand command, IUser user, int raidId)
|
private async Task SignUpUser(SocketSlashCommand command, IUser user, int raidId)
|
||||||
{
|
{
|
||||||
if(await _handlerFunctions.IsRaidSignUpAllowed(command, raidId, Constants.ComponentIds.SIGN_UP_BUTTON))
|
if(await _httpService.DoesUserExist(user.Id))
|
||||||
{
|
{
|
||||||
List<ApiRole> roles = await _httpService.GetRoles(raidId, user.Id);
|
Tuple<bool, string> signUpAllowed = await _httpService.IsSignUpAllowed(raidId, user.Id, true);
|
||||||
if(await _httpService.DoesUserExist(user.Id))
|
if(!signUpAllowed.Item1)
|
||||||
{
|
|
||||||
Tuple<bool, string> signUpAllowed = await _httpService.IsSignUpAllowed(raidId, user.Id, true);
|
|
||||||
if(!signUpAllowed.Item1)
|
|
||||||
{
|
|
||||||
await command.RespondAsync(signUpAllowed.Item2, ephemeral: true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await command.RespondAsync("Please choose a role.", components: RoleSelectionMessage.buildMessage(roles, raidId, Constants.ComponentIds.SIGN_UP_BUTTON, false, user.Id) , ephemeral: true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
await SignUpExternalUser(command, raidId, roles);
|
await command.RespondAsync(signUpAllowed.Item2, ephemeral: true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
await _handlerFunctions.SelectRole(command, raidId, Constants.ComponentIds.SIGN_UP_BUTTON, false, user.Id, command.User.Id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await SignUpExternalUser(command, raidId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,21 +119,16 @@ namespace DiscordBot.CommandHandlers
|
||||||
if(await _handlerFunctions.IsRaidSignUpAllowed(command, raidId, Constants.ComponentIds.SIGN_UP_BUTTON))
|
if(await _handlerFunctions.IsRaidSignUpAllowed(command, raidId, Constants.ComponentIds.SIGN_UP_BUTTON))
|
||||||
{
|
{
|
||||||
List<ApiRole> roles = await _httpService.GetRoles(raidId, uint.MaxValue);
|
List<ApiRole> roles = await _httpService.GetRoles(raidId, uint.MaxValue);
|
||||||
await SignUpExternalUser(command, raidId, roles);
|
Tuple<bool, string> 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SignUpExternalUser(SocketSlashCommand command, int raidId, List<ApiRole> roles)
|
|
||||||
{
|
|
||||||
Tuple<bool, string> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SendMessages(string message, int raidId)
|
private async Task SendMessages(string message, int raidId)
|
||||||
{
|
{
|
||||||
ApiRaid raid = await _httpService.GetRaid(raidId);
|
ApiRaid raid = await _httpService.GetRaid(raidId);
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
public const string FLEX_BUTTON = "flexButton";
|
public const string FLEX_BUTTON = "flexButton";
|
||||||
public const string SIGN_OFF_BUTTON = "signOffButton";
|
public const string SIGN_OFF_BUTTON = "signOffButton";
|
||||||
|
|
||||||
public const string SIGN_UP_DROP_DOWN = "signUpDropDown";
|
public const string ROLE_SELECT_DROP_DOWN = "roleSelectDropDown";
|
||||||
public const string SIGN_UP_EXTERNAL_DROP_DOWN = "signUpExternalDropDown";
|
public const string ROLE_SELECT_EXTERNAL_DROP_DOWN = "roleSelectExternalDropDown";
|
||||||
public const string ACCOUNT_SELECT_DROP_DOWN = "accountSelectDropDown";
|
public const string ACCOUNT_SELECT_DROP_DOWN = "accountSelectDropDown";
|
||||||
|
|
||||||
public const string NAME_TEXT_BOX = "nameTextbox";
|
public const string NAME_TEXT_BOX = "nameTextbox";
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace DiscordBot.Messages
|
||||||
{
|
{
|
||||||
var signUpSelect = new SelectMenuBuilder()
|
var signUpSelect = new SelectMenuBuilder()
|
||||||
.WithPlaceholder("Select an option")
|
.WithPlaceholder("Select an option")
|
||||||
.WithCustomId($"{Constants.ComponentIds.SIGN_UP_EXTERNAL_DROP_DOWN}-{raidId}")
|
.WithCustomId($"{Constants.ComponentIds.ROLE_SELECT_EXTERNAL_DROP_DOWN}-{raidId}")
|
||||||
.WithMinValues(1)
|
.WithMinValues(1)
|
||||||
.WithMaxValues(1);
|
.WithMaxValues(1);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace DiscordBot.Messages
|
||||||
return raid;
|
return raid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Embed CreateRaidMessage(ApiRaid raid)
|
private Embed CreateRaidMessage(ApiRaid raid)
|
||||||
{
|
{
|
||||||
var embed = new EmbedBuilder()
|
var embed = new EmbedBuilder()
|
||||||
{
|
{
|
||||||
|
@ -124,5 +124,27 @@ namespace DiscordBot.Messages
|
||||||
}
|
}
|
||||||
return rolesString;
|
return rolesString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ButtonParameters ParseButtonId(string customId)
|
||||||
|
{
|
||||||
|
ButtonParameters parameters = new ButtonParameters();
|
||||||
|
|
||||||
|
string[] ids = customId.Split('-');
|
||||||
|
if(ids.Length > 0)
|
||||||
|
{
|
||||||
|
parameters.ButtonType = ids[0];
|
||||||
|
}
|
||||||
|
if(ids.Length > 1)
|
||||||
|
{
|
||||||
|
int.TryParse(ids[1],out parameters.RaidId);
|
||||||
|
}
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ButtonParameters
|
||||||
|
{
|
||||||
|
public int RaidId;
|
||||||
|
public string ButtonType = string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@ namespace DiscordBot.Messages
|
||||||
{
|
{
|
||||||
public class RoleSelectionMessage
|
public class RoleSelectionMessage
|
||||||
{
|
{
|
||||||
public static MessageComponent buildMessage(List<ApiRole> roles, int raidId, string buttonType, bool allRoles, ulong userIdToSignUp = 0)
|
public static MessageComponent buildMessage(List<ApiRole> roles, int raidId, string buttonType, bool allRoles, ulong userIdToSignUp, ulong signedUpByUserId)
|
||||||
{
|
{
|
||||||
var signUpSelect = new SelectMenuBuilder()
|
var signUpSelect = new SelectMenuBuilder()
|
||||||
.WithPlaceholder("Select an option")
|
.WithPlaceholder("Select an option")
|
||||||
.WithCustomId($"{Constants.ComponentIds.SIGN_UP_DROP_DOWN}-{raidId}-{buttonType}-{userIdToSignUp}")
|
.WithCustomId($"{Constants.ComponentIds.ROLE_SELECT_DROP_DOWN}-{raidId}-{buttonType}-{userIdToSignUp}-{signedUpByUserId}")
|
||||||
.WithMinValues(1)
|
.WithMinValues(1)
|
||||||
.WithMaxValues(1);
|
.WithMaxValues(1);
|
||||||
|
|
||||||
|
@ -42,6 +42,10 @@ namespace DiscordBot.Messages
|
||||||
{
|
{
|
||||||
ulong.TryParse(ids[3],out parameters.UserIdToSignUp);
|
ulong.TryParse(ids[3],out parameters.UserIdToSignUp);
|
||||||
}
|
}
|
||||||
|
if(ids.Length > 4)
|
||||||
|
{
|
||||||
|
ulong.TryParse(ids[4],out parameters.SignedUpByUserId);
|
||||||
|
}
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +53,8 @@ namespace DiscordBot.Messages
|
||||||
{
|
{
|
||||||
public int RaidId;
|
public int RaidId;
|
||||||
public string ButtonType = string.Empty;
|
public string ButtonType = string.Empty;
|
||||||
public ulong UserIdToSignUp;
|
public ulong UserIdToSignUp;
|
||||||
|
public ulong SignedUpByUserId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue