mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Added '.bank take' owner only command
This commit is contained in:
@@ -11,10 +11,14 @@ public partial class Gambling
|
|||||||
public partial class BankCommands : GamblingModule<IBankService>
|
public partial class BankCommands : GamblingModule<IBankService>
|
||||||
{
|
{
|
||||||
private readonly IBankService _bank;
|
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;
|
_bank = bank;
|
||||||
|
_client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
@@ -68,5 +72,31 @@ public partial class Gambling
|
|||||||
await ReplyErrorLocalizedAsync(strs.cant_dm);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1308,6 +1308,7 @@ medusalist:
|
|||||||
medusainfo:
|
medusainfo:
|
||||||
- medusainfo
|
- medusainfo
|
||||||
- meinfo
|
- meinfo
|
||||||
|
# Bank stuff
|
||||||
bankdeposit:
|
bankdeposit:
|
||||||
- deposit
|
- deposit
|
||||||
- d
|
- d
|
||||||
@@ -1320,6 +1321,8 @@ bankbalance:
|
|||||||
- balance
|
- balance
|
||||||
- b
|
- b
|
||||||
- bal
|
- bal
|
||||||
|
banktake:
|
||||||
|
- take
|
||||||
# Patron
|
# Patron
|
||||||
patron:
|
patron:
|
||||||
- patron
|
- patron
|
||||||
|
@@ -2237,6 +2237,10 @@ bankbalance:
|
|||||||
desc: "Shows your current bank balance available for withdrawal."
|
desc: "Shows your current bank balance available for withdrawal."
|
||||||
args:
|
args:
|
||||||
- ""
|
- ""
|
||||||
|
banktake:
|
||||||
|
desc: "Takes the specified from a user's bank"
|
||||||
|
args:
|
||||||
|
- "500 @MoniLaunder"
|
||||||
patron:
|
patron:
|
||||||
desc: "Check your patronage status and command usage quota. Bot owners can check targeted user's patronage status."
|
desc: "Check your patronage status and command usage quota. Bot owners can check targeted user's patronage status."
|
||||||
args:
|
args:
|
||||||
|
Reference in New Issue
Block a user