/// <summary> /// 阪神算 /// </summary> public Hanshin(string _filename = "hanshin.json") { filename = _filename; if (System.IO.File.Exists(filename)) { hdb = JsonMgr <HanshinDB> .Load(filename); } else { hdb = new HanshinDB(); hdb.map = new Dictionary <int, string>(); hdb.map[334] = "334"; hdb.map[29] = "33-4"; JsonMgr <HanshinDB> .Save(hdb, filename); } rat = new RatEvaluator(); }
/// <summary> /// Slack /// </summary> public SlackBot(string filename = "config.json") { if (System.IO.File.Exists(filename)) { conf = JsonMgr <Config> .Load(filename); } else { var _conf = new Config(); _conf.token = "<YOUR BOT TOKEN HERE>"; _conf.next_procon = DateTime.MinValue; _conf.procon_notice_time = 0; _conf.manager_ids = new List <string>() { "<MANAGER USERNAME HERE>" }; _conf.channels = new List <string>() { "<CHANNEL HERE (without #)>" }; _conf.procon_notice_channels = new List <string>() { "<PROCON NOTICE CHANNEL HERE (without #)>" }; JsonMgr <Config> .Save(_conf, filename); throw new Exception(string.Format("{0}を設定してください。", filename)); } client = new SlackSocketClient(conf.token); channel_ids = new List <string>(); core = new BotCore(conf); IsConnected = false; // プロコン残り日数表通知用 timer_procon = new System.Timers.Timer(); timer_procon.Interval = 1000; timer_procon.Elapsed += Timer_procon_Elapsed; }