1
0

rework ReminderModule

This commit is contained in:
2023-07-25 19:06:46 +08:00
parent 16723fee4d
commit 7b9342e6e1
3 changed files with 74 additions and 43 deletions

25
Budet-cho-bot/Utility.cs Normal file
View File

@@ -0,0 +1,25 @@
using Newtonsoft.Json.Linq;
namespace Discord_Bot;
public static class Utility
{
public static string ParseMessage(string message)
{
var time = message.Split(":");
if (time.Length != 2)
{
throw new ArgumentException("Время неправильное. Хуйня твоё время");
return null;
}
var now = DateTime.Now;
var date = new DateTime(now.Year, now.Month, now.Day, int.Parse(time[0]), int.Parse(time[1]), 0);
return Newtonsoft.Json.JsonConvert.SerializeObject(date);
}
public static DateTime ParseTime(string token)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<DateTime>(token);
}
}