Be less strict about exact order for setting reminders
This commit is contained in:
parent
a242f2756e
commit
0a71e6d6ce
|
@ -11,7 +11,7 @@ namespace DeukBot4.MessageHandlers
|
|||
{
|
||||
private static readonly Regex ReminderMatcher =
|
||||
new Regex(
|
||||
@".*(remind\s*((?<recipient>me)|<@!*(?<recipient>\d*)>)\s*to)(?<action>.*)(in\s+)(?<time>.*)",
|
||||
@".*(remind\s*((?<recipient>me)|<@!*(?<recipient>\d*)>)\s*)(\s+to(?<action>.+)|\s+in\s+(?<time>.+)){2}",
|
||||
RegexOptions.IgnoreCase);
|
||||
|
||||
public static async Task HandleReminder(SocketMessage message)
|
||||
|
@ -23,10 +23,12 @@ namespace DeukBot4.MessageHandlers
|
|||
}
|
||||
|
||||
var recipient = match.Groups["recipient"].Captures[0].Value;
|
||||
var action = match.Groups["action"].Value.Trim();
|
||||
var action = match.Groups["action"]?.Value.Trim();
|
||||
if (string.IsNullOrWhiteSpace(action))
|
||||
return;
|
||||
var time = match.Groups["time"].Value;
|
||||
var time = match.Groups["time"]?.Value;
|
||||
if (string.IsNullOrWhiteSpace(time))
|
||||
return;
|
||||
var timespan = ParseTime(time);
|
||||
if (!timespan.HasValue)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue