Fixed UserId patron table error

Added au and kz countries as en and kz languages respectively
Strikeout is thinner now on plants
This commit is contained in:
Toastie (DCS Team) 2024-11-04 19:19:53 +13:00
parent 945725e87c
commit 090f50b253
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
6 changed files with 75 additions and 42 deletions

View file

@ -2,6 +2,8 @@
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.1.0/) except date format. a-c-f-r-o Mostly based on [keepachangelog](https://keepachangelog.com/en/1.1.0/) except date format. a-c-f-r-o
## [5.1.19]
## [5.1.18] - 04.11.2024 ## [5.1.18] - 04.11.2024
### Added ### Added

View file

@ -15,6 +15,17 @@ service GrpcXp {
rpc AddReward(AddRewardRequest) returns (AddRewardReply); rpc AddReward(AddRewardRequest) returns (AddRewardReply);
rpc DeleteReward(DeleteRewardRequest) returns (DeleteRewardReply); rpc DeleteReward(DeleteRewardRequest) returns (DeleteRewardReply);
rpc SetServerExclusion(SetServerExclusionRequest) returns (SetServerExclusionReply);
}
message SetServerExclusionRequest {
uint64 guildId = 1;
bool serverExcluded = 2;
}
message SetServerExclusionReply {
bool success = 1;
} }
message GetXpLbRequest { message GetXpLbRequest {
@ -32,7 +43,8 @@ message XpLbUserReply {
string username = 2; string username = 2;
int64 xp = 3; int64 xp = 3;
int64 level = 4; int64 level = 4;
string avatar = 5; int64 levelPercent = 5;
string avatar = 6;
} }
message ResetUserXpRequest { message ResetUserXpRequest {

View file

@ -3,6 +3,7 @@ namespace EllieBot.Db.Models;
public class PatronUser public class PatronUser
{ {
public int Id { get; set; }
public string UniquePlatformUserId { get; set; } public string UniquePlatformUserId { get; set; }
public ulong UserId { get; set; } public ulong UserId { get; set; }
public int AmountCents { get; set; } public int AmountCents { get; set; }

View file

@ -169,7 +169,7 @@ public class PlantPickService : IEService, IExecNoCommand
Start = 0, Start = 0,
End = pass.GetGraphemeCount(), End = pass.GetGraphemeCount(),
Font = font, Font = font,
StrikeoutPen = new SolidPen(Color.White, 5), StrikeoutPen = new SolidPen(Color.White, 3),
TextDecorations = TextDecorations.Strikeout TextDecorations = TextDecorations.Strikeout
}; };

View file

@ -69,5 +69,8 @@ public partial class FlagTranslateService
YE ar YE ar
AL sq AL sq
AE ar AE ar
AU en
NZ en
KZ kz
"""; """;
} }

View file

@ -69,7 +69,7 @@ public class XpSvc : GrpcXp.GrpcXpBase, IGrpcSvc, IEService
rews = rews.Concat(roleRews.Select(x => new RewItemReply() rews = rews.Concat(roleRews.Select(x => new RewItemReply()
{ {
Level = x.Level, Level = x.Level,
Type = "Role", Type = x.Remove ? "RemoveRole" : "AddRole",
Value = guild.GetRole(x.RoleId)?.ToString() ?? x.RoleId.ToString() Value = guild.GetRole(x.RoleId)?.ToString() ?? x.RoleId.ToString()
})) }))
.OrderBy(x => x.Level); .OrderBy(x => x.Level);
@ -207,15 +207,15 @@ public class XpSvc : GrpcXp.GrpcXpBase, IGrpcSvc, IEService
public override async Task<GetXpLbReply> GetXpLb(GetXpLbRequest request, ServerCallContext context) public override async Task<GetXpLbReply> GetXpLb(GetXpLbRequest request, ServerCallContext context)
{ {
if (request.Page < 0) if (request.Page < 1)
throw new RpcException(new Status(StatusCode.InvalidArgument, "Page must be greater than or equal to 0")); throw new RpcException(new Status(StatusCode.InvalidArgument, "Page must be greater than or equal to 1"));
var guild = _client.GetGuild(request.GuildId); var guild = _client.GetGuild(request.GuildId);
if (guild is null) if (guild is null)
throw new RpcException(new Status(StatusCode.NotFound, "Guild not found")); throw new RpcException(new Status(StatusCode.NotFound, "Guild not found"));
var data = await _xp.GetGuildUserXps(request.GuildId, request.Page); var data = await _xp.GetGuildUserXps(request.GuildId, request.Page - 1);
var total = await _xp.GetTotalGuildUsers(request.GuildId); var total = await _xp.GetTotalGuildUsers(request.GuildId);
var reply = new GetXpLbReply var reply = new GetXpLbReply
@ -223,7 +223,7 @@ public class XpSvc : GrpcXp.GrpcXpBase, IGrpcSvc, IEService
Total = total Total = total
}; };
reply.Users.AddRange(await data var users = await data
.Select(async x => .Select(async x =>
{ {
var user = guild.GetUser(x.UserId); var user = guild.GetUser(x.UserId);
@ -260,8 +260,23 @@ public class XpSvc : GrpcXp.GrpcXpBase, IGrpcSvc, IEService
Level = new LevelStats(x.Xp).Level Level = new LevelStats(x.Xp).Level
}; };
}) })
.WhenAll()); .WhenAll();
reply.Users.AddRange(users);
return reply; return reply;
} }
public override async Task<SetServerExclusionReply> SetServerExclusion(
SetServerExclusionRequest request,
ServerCallContext context)
{
await Task.Yield();
var newValue = _xp.ToggleExcludeServer(request.GuildId);
return new()
{
Success = newValue
};
}
} }