reworked the commandHandler

added Slash Commands
This commit is contained in:
Sarah Faey 2022-11-15 19:00:56 +01:00
parent 17dceda408
commit b8feed971c
15 changed files with 599 additions and 214 deletions

View file

@ -43,7 +43,8 @@ namespace Lieb.Data
//new LiebUser{Id=0, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List<GuildWars2Account>(){ linaith, sarah} },
new LiebUser{Id=194863625477816321, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List<GuildWars2Account>(){ linaith, sarah} },
#if DEBUG
new LiebUser{Id=194455125769715713, Name="Lisa", GuildWars2Accounts = new List<GuildWars2Account>(){ hierpiepts}},
//new LiebUser{Id=194455125769715713, Name="Lisa", GuildWars2Accounts = new List<GuildWars2Account>(){ hierpiepts}},
new LiebUser{Id=1, Name="Lisa", GuildWars2Accounts = new List<GuildWars2Account>(){ hierpiepts}},
new LiebUser{Id=2, Name="Simon", GuildWars2Accounts = new List<GuildWars2Account>(){ bloodseeker}}
#endif
};

View file

@ -196,7 +196,7 @@ namespace Lieb.Data
await context.SaveChangesAsync();
}
private ApiRaid ConvertRaid(Raid raid)
public static ApiRaid ConvertRaid(Raid raid)
{
ApiRaid apiRaid = new ApiRaid(){
Title = raid.Title,
@ -239,7 +239,8 @@ namespace Lieb.Data
apiRole.Users.Add(new ApiRaid.Role.User(){
AccountName = signUp.GuildWars2Account.AccountName,
Status = status,
UserName = signUp.LiebUser.Name
UserName = signUp.LiebUser.Name,
UserId = signUp.LiebUserId
});
}
}
@ -249,7 +250,7 @@ namespace Lieb.Data
return apiRaid;
}
private List<ApiRaid.DiscordMessage> ConvertMessages(IEnumerable<DiscordRaidMessage> messages)
public static List<ApiRaid.DiscordMessage> ConvertMessages(IEnumerable<DiscordRaidMessage> messages)
{
List<ApiRaid.DiscordMessage> apiMessages = new List<ApiRaid.DiscordMessage>();
foreach(DiscordRaidMessage message in messages)
@ -264,7 +265,7 @@ namespace Lieb.Data
return apiMessages;
}
private ApiUserReminder ConvertUserReminder(string message, Raid raid)
public static ApiUserReminder ConvertUserReminder(string message, Raid raid)
{
ApiUserReminder apiReminder = new ApiUserReminder()
{
@ -281,7 +282,7 @@ namespace Lieb.Data
return apiReminder;
}
private ApiChannelReminder ConvertChannelReminder(ulong discordServerId, ulong discordChannelId, string message)
public static ApiChannelReminder ConvertChannelReminder(ulong discordServerId, ulong discordChannelId, string message)
{
return new ApiChannelReminder()
{

View file

@ -102,7 +102,7 @@ namespace Lieb.Data
}
}
public async Task SignUp(int raidId, ulong liebUserId, int guildWars2AccountId, int plannedRoleId, SignUpType signUpType)
public async Task SignUp(int raidId, ulong liebUserId, int guildWars2AccountId, int plannedRoleId, SignUpType signUpType, ulong signedUpByUserId = 0)
{
if (!IsRoleSignUpAllowed(raidId, liebUserId, plannedRoleId, signUpType, true))
{
@ -127,7 +127,7 @@ namespace Lieb.Data
};
context.RaidSignUps.Add(signUp);
await context.SaveChangesAsync();
await LogSignUp(signUp);
await LogSignUp(signUp, signedUpByUserId);
}
await _discordService.PostRaidMessage(raidId);
}