Exemple #1
0
        public async Task SetReminderAsync(
            [Summary("The number in minutes")] double minutes,
            [Summary("The (optional) messages")] params string[] messages)
        {
            if (minutes <= 0)
            {
                throw new Exception("Please provide a positive number.");
            }

            var user         = Context.User;
            var dateToRemind = DateTime.UtcNow.AddMinutes(minutes);

            var stringBuilder = new StringBuilder();

            foreach (var message in messages)
            {
                stringBuilder.Append($"{message} ");
            }

            _timerService.AddReminder(dateToRemind, user, stringBuilder.ToString());

            // Tell the user that he will be notified
            await ReplyAsync(
                embed : $"Reminder set for {dateToRemind:U}".EmbedMessage(
                    "You will be reminded via a personal messages.")).ConfigureAwait(false);
        }