34 lines
784 B
C#
34 lines
784 B
C#
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;
|
|
}
|
|
}
|
|
}
|