fix: rich logging fix for userids, updated commandlist

add: added bot.date and changed bot.time placeholder. They use timestamp tags now.
fix: fixed double log on server leave
This commit is contained in:
Kwoth
2024-11-07 05:38:22 +00:00
parent 9e96679099
commit 89ca56c77c
5 changed files with 45 additions and 12 deletions

View File

@@ -71,7 +71,6 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, INService
if (server.OwnerId != _client.CurrentUser.Id)
{
await server.LeaveAsync();
Log.Information("Left server {Name} [{Id}]", server.Name, server.Id);
}
else
{

View File

@@ -159,14 +159,14 @@ public class XpSvc : GrpcXp.GrpcXpBase, IGrpcSvc, INService
_xp.SetRoleReward(request.GuildId, request.Level, rid, request.Type == "RemoveRole");
success = true;
}
else if (request.Type == "Currency")
{
if (!int.TryParse(request.Value, out var amount))
throw new RpcException(new Status(StatusCode.InvalidArgument, "Invalid amount"));
_xp.SetCurrencyReward(request.GuildId, request.Level, amount);
success = true;
}
// else if (request.Type == "Currency")
// {
// if (!int.TryParse(request.Value, out var amount))
// throw new RpcException(new Status(StatusCode.InvalidArgument, "Invalid amount"));
//
// _xp.SetCurrencyReward(request.GuildId, request.Level, amount);
// success = true;
// }
return new()
{

View File

@@ -12,7 +12,11 @@ public sealed partial class ReplacementPatternStore
{
Register("%bot.time%",
static ()
=> DateTime.Now.ToString("HH:mm " + TimeZoneInfo.Local.StandardName.GetInitials()));
=> TimestampTag.FromDateTime(DateTime.UtcNow, TimestampTagStyles.ShortTime).ToString());
Register("%bot.date%",
static ()
=> TimestampTag.FromDateTime(DateTime.UtcNow, TimestampTagStyles.ShortDate).ToString());
}
private void WithClient()

View File

@@ -165,7 +165,7 @@ public class CommandHandler : INService, IReadyExecutor, ICommandHandler
Log.Information("Succ | g:{GuildId} | c: {ChannelId} | u: {UserId} | msg: {Message}",
channel?.Guild.Id.ToString() ?? "-",
channel?.Id.ToString() ?? "-",
usrMsg.Author.Id,
usrMsg.Author.Id.ToString(),
usrMsg.Content.TrimTo(10));
}

View File

@@ -3030,6 +3030,20 @@
"Bot Owner Only"
]
},
{
"Aliases": [
".rakeback",
".rb"
],
"Description": "Try to claim any rakeback that you have avaialable.\nRakeback is accumulated by betting (not by winning or losing).\nDefault rakeback is 0.05 * house edge\nHouse edge is defined per game",
"Usage": [
".rakeback"
],
"Submodule": "Gambling",
"Module": "Gambling",
"Options": null,
"Requirements": []
},
{
"Aliases": [
".race"
@@ -3601,10 +3615,26 @@
"Options": null,
"Requirements": []
},
{
"Aliases": [
".waifuclaims",
".claims",
".wcs"
],
"Description": "Shows all of your currently claimed waifus.",
"Usage": [
".waifuclaims"
],
"Submodule": "WaifuClaimCommands",
"Module": "Gambling",
"Options": null,
"Requirements": []
},
{
"Aliases": [
".waifuclaim",
".claim"
".claim",
".wc"
],
"Description": "Claim a waifu for yourself by spending currency. You must spend at least 10% more than her current value unless she set `.affinity` towards you.",
"Usage": [