added account creation to the Discord bot

This commit is contained in:
Sarah Faey 2022-11-10 21:47:44 +01:00
parent 69337e69ae
commit 56cb43a479
18 changed files with 198 additions and 152 deletions

View file

@ -4,6 +4,7 @@
{
public const string HttpClientName = "Discord";
public const string ClaimType = "Role";
public const string GW2_ACCOUNT_REGEX = "^[a-zA-z ]{3,27}\\.[0-9]{4}$";
public static readonly int RaidEditPowerLevel = Roles.Moderator.PowerLevel;
public static class Roles

View file

@ -40,8 +40,8 @@ namespace Lieb.Data
GuildWars2Account bloodseeker = new GuildWars2Account() { AccountName = "Bloodseeker.2043" };
var users = new LiebUser[]
{
//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} },
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=2, Name="Simon", GuildWars2Accounts = new List<GuildWars2Account>(){ bloodseeker}}
@ -195,6 +195,16 @@ namespace Lieb.Data
context.Equipped.AddRange(equippedBuilds);
context.SaveChanges();
var discordMessage = new DiscordRaidMessage()
{
DiscordChannelId = 666954070388637697,
DiscordGuildId = 666953424734257182,
DiscordMessageId = 1040355092630614087,
RaidId = raid.RaidId
};
context.DiscordRaidMessages.Add(discordMessage);
context.SaveChanges();
#endif
}
}

View file

@ -204,11 +204,15 @@ namespace Lieb.Data
foreach(RaidSignUp signUp in raid.SignUps.Where(x => x.RaidRoleId == role.RaidRoleId))
{
apiRole.Users.Add(new ApiRaid.Role.User(){
AccountName = signUp.GuildWars2Account.AccountName,
Status = signUp.SignUpType.ToString(),
UserName = signUp.LiebUser.Name
});
if(signUp.SignUpType != SignUpType.SignedOff)
{
string status = signUp.SignUpType != SignUpType.SignedUp ? signUp.SignUpType.ToString() : string.Empty;
apiRole.Users.Add(new ApiRaid.Role.User(){
AccountName = signUp.GuildWars2Account.AccountName,
Status = status,
UserName = signUp.LiebUser.Name
});
}
}
apiRaid.Roles.Add(apiRole);
}

View file

@ -333,6 +333,7 @@ namespace Lieb.Data
if(raid.EndTimeUTC < DateTimeOffset.UtcNow)
{
errorMessage = $"The raid already ended.";
return false;
}