mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 00:34:26 -05:00 
			
		
		
		
	.give will send dms again
This commit is contained in:
		@@ -339,7 +339,7 @@ public partial class Gambling : GamblingModule<GamblingService>
 | 
			
		||||
            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));
 | 
			
		||||
            return;
 | 
			
		||||
 
 | 
			
		||||
@@ -13,17 +13,26 @@ public static class CurrencyServiceExtensions
 | 
			
		||||
    // todo transfer should be a transaction
 | 
			
		||||
    public static async Task<bool> TransferAsync(
 | 
			
		||||
        this ICurrencyService cs,
 | 
			
		||||
        ulong fromId,
 | 
			
		||||
        ulong toId,
 | 
			
		||||
        IEmbedBuilderService ebs,
 | 
			
		||||
        IUser from,
 | 
			
		||||
        IUser to,
 | 
			
		||||
        long amount,
 | 
			
		||||
        string fromName,
 | 
			
		||||
        string note)
 | 
			
		||||
        string? note)
 | 
			
		||||
    {
 | 
			
		||||
        var fromWallet = await cs.GetWalletAsync(fromId);
 | 
			
		||||
        var toWallet = await cs.GetWalletAsync(toId);
 | 
			
		||||
        var fromWallet = await cs.GetWalletAsync(from.Id);
 | 
			
		||||
        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 Add(long amount, TxData txData);
 | 
			
		||||
 | 
			
		||||
    // todo message
 | 
			
		||||
    public async Task<bool> Transfer(
 | 
			
		||||
        long amount,
 | 
			
		||||
        IWallet to,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user