Skip to content

Commit

Permalink
fix: rich logging fix for userids, updated commandlist
Browse files Browse the repository at this point in the history
add: added bot.date and changed bot.time placeholder. They use timestamp tags now.
fix: fixed double log on server leave
  • Loading branch information
Wizkiller96 committed Nov 10, 2024
1 parent 22440cb commit 7f2dcd2
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/WizBot/Modules/Administration/Self/SelfService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public SelfService(
if (server.OwnerId != _client.CurrentUser.Id)
{
await server.LeaveAsync();
Log.Information("Left server {Name} [{Id}]", server.Name, server.Id);
}
else
{
Expand Down
16 changes: 8 additions & 8 deletions src/WizBot/Services/GrpcApi/XpSvc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ public override async Task<AddRewardReply> AddReward(AddRewardRequest request, S
_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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ private void WithDefault()
{
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()
Expand Down
2 changes: 1 addition & 1 deletion src/WizBot/_common/Services/CommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Command Executed after {ExecTime}s
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));
}

Expand Down
32 changes: 31 additions & 1 deletion src/WizBot/data/commandlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -3024,6 +3024,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"
Expand Down Expand Up @@ -3596,10 +3610,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": [
Expand Down

0 comments on commit 7f2dcd2

Please sign in to comment.