private static async Task CreateTestTransactions(DateTime now, [NotNull] ITransactions svc)
        {
            await svc.CreateTransaction(0, 1, 10, "TEST", "Note 1", now + TimeSpan.FromMinutes(1));

            await svc.CreateTransaction(0, 1, 1, "TEST2", "Note 3", now + TimeSpan.FromMinutes(3));

            await svc.CreateTransaction(1, 0, 5, "TEST", "Note 2", now + TimeSpan.FromMinutes(2));

            await svc.CreateTransaction(1, 2, 5, "TEST3", "Note 4", now + TimeSpan.FromMinutes(3));
        }
Exemplo n.º 2
0
        public async Task CreateDebt([NotNull] IUser user, decimal amount, [NotNull] string unit, [CanBeNull, Remainder] string note = null)
        {
            if (amount < 0)
            {
                await TypingReplyAsync("You cannot owe a negative amount!");
            }

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

            await ReplyAsync($"{Context.User.Mention} owes {TransactionFormatting.FormatCurrency(amount, unit)} to {user.Mention}");
        }
Exemplo n.º 3
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);
        }