Added '.bank take' owner only command

This commit is contained in:
Kwoth
2022-08-11 14:39:44 +02:00
parent 0170536d1c
commit e9eb6ff2ad
3 changed files with 38 additions and 1 deletions

View File

@@ -11,10 +11,14 @@ public partial class Gambling
public partial class BankCommands : GamblingModule<IBankService>
{
private readonly IBankService _bank;
private readonly DiscordSocketClient _client;
public BankCommands(GamblingConfigService gcs, IBankService bank) : base(gcs)
public BankCommands(GamblingConfigService gcs,
IBankService bank,
DiscordSocketClient client) : base(gcs)
{
_bank = bank;
_client = client;
}
[Cmd]
@@ -68,5 +72,31 @@ public partial class Gambling
await ReplyErrorLocalizedAsync(strs.cant_dm);
}
}
private async Task BankTakeInternalAsync(long amount, ulong userId)
{
if (await _bank.WithdrawAsync(userId, amount))
{
await ReplyErrorLocalizedAsync(strs.take_fail(N(amount),
_client.GetUser(userId)?.ToString()
?? userId.ToString(),
CurrencySign));
return;
}
await ctx.OkAsync();
}
[Cmd]
[OwnerOnly]
[Priority(-1)]
public async Task BankTake(long amount, [Leftover] IUser user)
=> await BankTakeInternalAsync(amount, user.Id);
[Cmd]
[OwnerOnly]
[Priority(0)]
public async Task BankTake(long amount, ulong userId)
=> await BankTakeInternalAsync(amount, userId);
}
}

View File

@@ -1308,6 +1308,7 @@ medusalist:
medusainfo:
- medusainfo
- meinfo
# Bank stuff
bankdeposit:
- deposit
- d
@@ -1320,6 +1321,8 @@ bankbalance:
- balance
- b
- bal
banktake:
- take
# Patron
patron:
- patron

View File

@@ -2237,6 +2237,10 @@ bankbalance:
desc: "Shows your current bank balance available for withdrawal."
args:
- ""
banktake:
desc: "Takes the specified from a user's bank"
args:
- "500 @MoniLaunder"
patron:
desc: "Check your patronage status and command usage quota. Bot owners can check targeted user's patronage status."
args: