1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00
Octobot/Commands/RemindCommand.cs
2023-02-01 22:00:09 +03:00

28 lines
1.2 KiB
C#

using Boyfriend.Data;
namespace Boyfriend.Commands;
public sealed class RemindCommand : ICommand {
public string[] Aliases { get; } = { "remind", "reminder", "remindme", "напомни", "напомнить", "напоминание" };
public Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
// 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 feedback = string.Format(Messages.FeedbackReminderAdded, DateTimeOffset.Now.Add(remindIn).ToUnixTimeSeconds());
cmd.Reply(feedback, ReplyEmojis.Success);
cmd.Audit(feedback);
}
cmd.ConfigWriteScheduled = true;
return Task.CompletedTask;
}
}