Ejemplo n.º 1
0
        public async Task CreateDebt(IUser user, decimal amount, string unit, [Remainder] string?note = null)
        {
            if (amount < 0)
            {
                await RespondAsync("You cannot owe a negative amount!");

                return;
            }

            var message = $"{Context.User.Mention} owes {TransactionFormatting.FormatCurrency(amount, unit)} to {user.Mention}";

            var confirmed = await InteractionUtility.ConfirmAsync(_client, Context.Channel, TimeSpan.FromMinutes(1), message);

            if (!confirmed)
            {
                await RespondAsync("Confirmation timed out. Cancelled transaction!");

                return;
            }

            await _transactions.CreateTransaction(user.Id, Context.User.Id, amount, unit, note, DateTime.UtcNow);

            await RespondAsync(message);
        }