add basic create and list reminder api
This commit is contained in:
33
Budet-cho-bot/Repositories/CronRepository.cs
Normal file
33
Budet-cho-bot/Repositories/CronRepository.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Budet_cho_bot.Helpers;
|
||||
using Discord_Bot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Budet_cho_bot.Repositories
|
||||
{
|
||||
public class CronRepository
|
||||
{
|
||||
public async Task<int> SetCronTask(string taskType, string task)
|
||||
{
|
||||
var config = Functions.GetConfig();
|
||||
config[taskType] = task;
|
||||
Functions.SaveConfig(config);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public async Task<string> GetCronTask(string taskType)
|
||||
{
|
||||
var config = Functions.GetConfig();
|
||||
if (config.TryGetValue(taskType, out var tasks))
|
||||
{
|
||||
return tasks.ToString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user