1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-30 02:59:54 +03:00

Add reminder creation feedback (#24)

This commit is contained in:
Macintxsh 2023-02-02 07:48:18 +03:00 committed by GitHub
parent eaeacc1206
commit 233d471600
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 167 additions and 142 deletions

View file

@ -9,14 +9,20 @@ public sealed class RemindCommand : ICommand {
// TODO: actually make this good
var remindIn = CommandProcessor.GetTimeSpan(args, 0);
var reminderText = cmd.GetRemaining(cleanArgs, 1, "ReminderText");
if (reminderText is not null)
GuildData.Get(cmd.Context.Guild).MemberData[cmd.Context.User.Id].Reminders.Add(new Reminder {
RemindAt = DateTimeOffset.Now.Add(remindIn),
ReminderText = reminderText,
ReminderChannel = cmd.Context.Channel.Id
});
var reminderOffset = DateTimeOffset.Now.Add(remindIn);
if (reminderText is not null) {
GuildData.Get(cmd.Context.Guild).MemberData[cmd.Context.User.Id].Reminders.Add(
new Reminder {
RemindAt = reminderOffset,
ReminderText = reminderText,
ReminderChannel = cmd.Context.Channel.Id
});
cmd.ConfigWriteScheduled = true;
cmd.ConfigWriteScheduled = true;
var feedback = string.Format(Messages.FeedbackReminderAdded, reminderOffset.ToUnixTimeSeconds().ToString());
cmd.Reply(feedback, ReplyEmojis.Reminder);
}
return Task.CompletedTask;
}