From a50a7b3b0ebf44895c63e5a02341744fd8001637 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 11 Jul 2024 18:46:09 +0000 Subject: [PATCH] add: Added user param to .bank balance command, but only Bot Owner can use it --- .../Modules/Gambling/Bank/BankCommands.cs | 21 +++++++++++++++++++ .../data/strings/commands/commands.en-US.yml | 2 ++ .../strings/responses/responses.en-US.json | 1 + 3 files changed, 24 insertions(+) diff --git a/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs b/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs index 7bf993fa0..ff78b4bba 100644 --- a/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Bank/BankCommands.cs @@ -73,6 +73,27 @@ public partial class Gambling await Response().Error(strs.cant_dm).SendAsync(); } } + + [Cmd] + [OwnerOnly] + public async Task BankBalance([Leftover] IUser user) + { + var bal = await _bank.GetBalanceAsync(user.Id); + + var eb = _sender.CreateEmbed() + .WithOkColor() + .WithDescription(GetText(strs.bank_balance_other(user.ToString(), N(bal)))); + + try + { + await Response().User(ctx.User).Embed(eb).SendAsync(); + await ctx.OkAsync(); + } + catch + { + await Response().Error(strs.cant_dm).SendAsync(); + } + } private async Task BankTakeInternalAsync(long amount, ulong userId) { diff --git a/src/NadekoBot/data/strings/commands/commands.en-US.yml b/src/NadekoBot/data/strings/commands/commands.en-US.yml index 158aa6815..58711fb9d 100644 --- a/src/NadekoBot/data/strings/commands/commands.en-US.yml +++ b/src/NadekoBot/data/strings/commands/commands.en-US.yml @@ -4265,8 +4265,10 @@ bankbalance: Shows how much currency is in your bank account. This differs from your cash amount, as the cash amount is publicly available, but only you have access to your bank balance. However, you have to withdraw it first in order to use it. + Bot Owner can also check another user's bank balance. ex: - '' + - '@User' params: - {} banktake: diff --git a/src/NadekoBot/data/strings/responses/responses.en-US.json b/src/NadekoBot/data/strings/responses/responses.en-US.json index 88b6abbcc..8e75be33a 100644 --- a/src/NadekoBot/data/strings/responses/responses.en-US.json +++ b/src/NadekoBot/data/strings/responses/responses.en-US.json @@ -1040,6 +1040,7 @@ "medusa_already_loaded": "Medusa {0} is already loaded", "medusa_invalid_not_found": "Medusa with that name wasn't found or the file was invalid", "bank_balance": "You have {0} in your bank account.", + "bank_balance_other": "User {0} has {1} in the bank.", "bank_deposited": "You deposited {0} to your bank account.", "bank_withdrew": "You withdrew {0} from your bank account.", "bank_withdraw_insuff": "You don't have sufficient {0} in your bank account.",