internal async Task UpdateFiles() { float preTotal = float.Parse((await extraCoinsText.ReadAllLinesAsync())[0]); float donations = float.Parse((await donationsText.ReadAllLinesAsync())[0].Substring(1)); extraCoins = donations + bits + subs + missedCoins; if (kraken) { extraCoins += resubs; if (preTotal == extraCoins) { return; } await krakenText.WriteAllLinesAsync(new List <string> { $"Next kraken: {(extraCoins - totalKrakens).ToString("0.00")}/{nextKraken}", $"Krakens released: {(nextKraken / 11) - 1}" }); } if (preTotal == extraCoins) { return; } await extraCoinsText.WriteLineAsync(extraCoins.ToString("0.00")); }
void FillPersonalizedWhisperCommands() { whisperCommands.Add("forceupdate", new Command(async(args) => { if (args.isBroadcaster || args.isModerator || args.isOwner) { await UpdateFiles(); } return(0); })); whisperCommands.Add("dndanswerrewards", new Command(async(args) => { if (args.isOwner == false) { return(0); } var r = await dndRewardsText.ReadAllLinesAsync(); List <List <string> > splits = new List <List <string> >(); foreach (var l in r) { splits.Add(l.Split(new[] { '"' }).ToList()); } foreach (var l in splits) { for (int i = 0; i < l.Count; i++) { l.RemoveAt(i); } } List <string> names = new List <string>(); for (int i = 1; i < splits.Count; i++) { names.Add(splits[i][3]); } foreach (var name in names) { if (name.Length > 0) { bot.coinSystem.AddCoins(name, 533); } } return(0); })); whisperCommands.Add("giveaways", new Command(async(args) => { if (args.isBroadcaster || args.isOwner) { string msg = ""; foreach (var g in giveawayQueue) { msg += $"{g.name}: {g.months} months, tier {g.tier}\n"; } if (tier1subs > 0) { msg += $"{tier1subs} tier 1 subs\n"; } var paste = await bot.PasteOnPasteBin(msg, $"{DateTime.Now.Year}.{DateTime.Now.Month}.{DateTime.Now.Day} IggiBot giveaways"); bot.SendWhisper(args.Caller, paste); return(5); } return(0); })); whisperCommands.Remove("giveaways"); }