File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,24 @@ public async Task RemindMe(
3636 [ RemainingText , Description ( "The text to send when the reminder triggers." ) ] string reminder
3737 )
3838 {
39- DateTime t = HumanDateParser . HumanDateParser . Parse ( timetoParse ) ;
39+ string discordTimestampRegexExp = @"^<t:(\d+):?\w*>$" ;
40+ Match matchesDiscordTimestamp = Regex . Match ( timetoParse , discordTimestampRegexExp ) ;
41+
42+
43+ DateTime t ;
44+ if ( matchesDiscordTimestamp . Success )
45+ {
46+ // parse as timestamp
47+ // Extract the Unix timestamp from the matched pattern
48+ long unixTimestamp = long . Parse ( matchesDiscordTimestamp . Groups [ 1 ] . Value ) ;
49+ // Convert the Unix timestamp to a DateTime object
50+ t = DateTimeOffset . FromUnixTimeSeconds ( unixTimestamp ) . DateTime ;
51+ }
52+ else
53+ {
54+ t = HumanDateParser . HumanDateParser . Parse ( timetoParse ) ;
55+ }
56+
4057 if ( t <= DateTime . Now )
4158 {
4259 await ctx . RespondAsync ( $ "{ Program . cfgjson . Emoji . Error } Time can't be in the past!") ;
@@ -49,6 +66,7 @@ public async Task RemindMe(
4966 return ;
5067 }
5168#endif
69+
5270 string guildId ;
5371
5472 if ( ctx . Channel . IsPrivate )
You can’t perform that action at this time.
0 commit comments