mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
.give will send dms again
This commit is contained in:
@@ -16,6 +16,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed `.deletexp` command
|
- Fixed `.deletexp` command
|
||||||
|
- `.give` command should send DMs again
|
||||||
|
|
||||||
## [4.1.2] - 16.04.2022
|
## [4.1.2] - 16.04.2022
|
||||||
|
|
||||||
|
@@ -339,7 +339,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!await _cs.TransferAsync(ctx.User.Id, receiver.Id, amount, ctx.User.ToString(), msg))
|
if (!await _cs.TransferAsync(_eb, ctx.User, receiver, amount, msg))
|
||||||
{
|
{
|
||||||
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
|
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
|
||||||
return;
|
return;
|
||||||
|
@@ -13,17 +13,26 @@ public static class CurrencyServiceExtensions
|
|||||||
// todo transfer should be a transaction
|
// todo transfer should be a transaction
|
||||||
public static async Task<bool> TransferAsync(
|
public static async Task<bool> TransferAsync(
|
||||||
this ICurrencyService cs,
|
this ICurrencyService cs,
|
||||||
ulong fromId,
|
IEmbedBuilderService ebs,
|
||||||
ulong toId,
|
IUser from,
|
||||||
|
IUser to,
|
||||||
long amount,
|
long amount,
|
||||||
string fromName,
|
string? note)
|
||||||
string note)
|
|
||||||
{
|
{
|
||||||
var fromWallet = await cs.GetWalletAsync(fromId);
|
var fromWallet = await cs.GetWalletAsync(from.Id);
|
||||||
var toWallet = await cs.GetWalletAsync(toId);
|
var toWallet = await cs.GetWalletAsync(to.Id);
|
||||||
|
|
||||||
var extra = new TxData("gift", fromName, note, fromId);
|
var extra = new TxData("gift", from.ToString()!, note, from.Id);
|
||||||
|
|
||||||
return await fromWallet.Transfer(amount, toWallet, extra);
|
if (await fromWallet.Transfer(amount, toWallet, extra))
|
||||||
|
{
|
||||||
|
await to.SendConfirmAsync(ebs,
|
||||||
|
string.IsNullOrWhiteSpace(note)
|
||||||
|
? $"Gift from {from}"
|
||||||
|
: $"Gift from {from}: {note}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -8,7 +8,6 @@ public interface IWallet
|
|||||||
public Task<bool> Take(long amount, TxData txData);
|
public Task<bool> Take(long amount, TxData txData);
|
||||||
public Task Add(long amount, TxData txData);
|
public Task Add(long amount, TxData txData);
|
||||||
|
|
||||||
// todo message
|
|
||||||
public async Task<bool> Transfer(
|
public async Task<bool> Transfer(
|
||||||
long amount,
|
long amount,
|
||||||
IWallet to,
|
IWallet to,
|
||||||
|
Reference in New Issue
Block a user