public async Task GetAlerts() { var apiresponse = Utilities.GetWarframeInfo(); if (string.IsNullOrEmpty(apiresponse)) { return; } var warframe = Warframe.FromJson(apiresponse); var activeAlerts = warframe.Alerts; string[] alertstor = new string[20]; var embed = new EmbedBuilder(); for (int i = 0; i < activeAlerts.Count; i++) { string tmpalert4 = "None"; var tmpalert1 = Utilities.ReplaceInfo(activeAlerts[i].MissionInfo.Location); var tmpalert2 = Utilities.ReplaceInfo(activeAlerts[i].MissionInfo.MissionType); var tmpalert3 = activeAlerts[i].MissionInfo.MissionReward.Credits; if (activeAlerts[i].MissionInfo.MissionReward.Items == null) { tmpalert4 = "None"; } else { if (activeAlerts[i].MissionInfo.MissionReward.Items.Count == 1) { tmpalert4 = Utilities.ReplaceRewardInfo(activeAlerts[i].MissionInfo.MissionReward.Items[0]); } } alertstor[i] = $"**Location**: {tmpalert1}\n **Mission Type**: {tmpalert2}\n**Credits**: {tmpalert3}\n**Items**: {tmpalert4}\n**Expires**: {Utilities.ExpireFisTime(activeAlerts[i].Expiry.Date.NumberLong)}"; } for (int i = 0; i < alertstor.Length; i++) { if (alertstor[i] == null) { break; } var alertcount = i + 1; embed.AddField("**Alert " + alertcount + "**:", alertstor[i], true); } embed.WithTitle("**Current Alerts**"); embed.WithFooter("warframe alert ver 1.0", "http://3rdshifters.org/headerLogo.png"); embed.WithColor(new Color(188, 66, 244)); //embed.WithThumbnailUrl("http://3rdshifters.org/voidtear.png"); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
public async Task CurrentSortie() { string url = "http://content.warframe.com/dynamic/worldState.php"; string apiresponse; using (WebClient client = new WebClient()) { client.Encoding = Encoding.UTF8; apiresponse = client.DownloadString(url); } if (string.IsNullOrEmpty(apiresponse)) { await Context.Channel.SendMessageAsync("There was an error, please try again later"); return; } var warframe = Warframe.FromJson(apiresponse); var activeSortie = warframe.Sorties; //this is a List<Sorties> //set the time from unix to current var activationDate = activeSortie[0].Activation.Date; var datime = Convert.ToInt64(activationDate.NumberLong); var curtime = DateTimeOffset.FromUnixTimeMilliseconds(datime).DateTime.ToLocalTime(); //set variables with all the info needed. probably not the cleanest way string bossname = Utilities.GetSortieBoss(activeSortie[0].Boss); string firstmisnode = Utilities.ReplaceInfo(activeSortie[0].Variants[0].Node); string firstmistype = Utilities.GetSortieType(activeSortie[0].Variants[0].ModifierType); string firstmis = Utilities.ReplaceInfo(activeSortie[0].Variants[0].MissionType); string secmistype = Utilities.ReplaceInfo(activeSortie[0].Variants[1].ModifierType); string secmis = Utilities.ReplaceInfo(activeSortie[0].Variants[1].MissionType); string secmisnode = Utilities.ReplaceInfo(activeSortie[0].Variants[1].Node); string thirdmis = Utilities.ReplaceInfo(activeSortie[0].Variants[2].MissionType); string thirdmistype = Utilities.ReplaceInfo(activeSortie[0].Variants[2].ModifierType); string thirdmisnode = Utilities.ReplaceInfo(activeSortie[0].Variants[2].Node); var embed = new EmbedBuilder(); embed.WithTitle("Sortie Information"); embed.WithDescription("Start Time: " + curtime); embed.AddField("First Mission", firstmis, true); embed.AddField("Modifier", firstmistype, true); embed.AddField("Planet", firstmisnode, true); embed.AddField("Second Mission", secmis, true); embed.AddField("Modifier", secmistype, true); embed.AddField("Planet", secmisnode, true); embed.AddField("Third Mission", thirdmis, true); embed.AddField("Modifier", thirdmistype, true); embed.AddField("Planet", thirdmisnode, true); embed.AddField("Final Boss", bossname, true); embed.WithColor(new Color(188, 66, 244)); embed.WithFooter("warframe alert ver 1.0", "http://3rdshifters.org/headerLogo.png"); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
public async Task CheckNews() { var json = Utilities.GetWarframeInfo(); if (string.IsNullOrEmpty(json)) { return; } var warframe = Warframe.FromJson(json); var news = warframe.Events; var embed = new EmbedBuilder(); string newsLink = ""; string newsMsg = ""; List <string> newsList1 = new List <string>(); List <string> newsList2 = new List <string>(); foreach (var n in news) { var curtime = Utilities.TimeSince(n.Date.Date.NumberLong); var time = Int64.Parse(curtime); foreach (var t in n.Messages) { if (t.LanguageCode == "en") { DateTimeOffset timePosted = DateTimeOffset.FromUnixTimeMilliseconds(Int64.Parse(n.Date.Date.NumberLong)); newsMsg = t.MessageMessage; newsLink = n.Prop.AbsoluteUri; newsList1.Add($"{newsMsg}: "); newsList2.Add($"{newsLink}\n Posted on: {timePosted.LocalDateTime}"); break; } } if (embed.Fields.Count > 6) { break; } } for (int i = newsList1.Count - 1; i >= 0; i--) { embed.AddField(newsList1[i], newsList2[i]); } embed.WithTitle("News Alerts"); embed.WithFooter("warframe alert ver 1.0", "http://3rdshifters.org/headerLogo.png"); embed.WithColor(new Color(188, 66, 244)); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
public async Task ListInvasions() { var apiresponse = Utilities.GetWarframeInfo(); if (string.IsNullOrEmpty(apiresponse)) { return; } var invasions = Warframe.FromJson(apiresponse); var invasionRewards = invasions.Invasions; var dacount = 1; var embed = new EmbedBuilder(); string defReward = ""; foreach (var reward in invasionRewards) { if (reward.Completed) { continue; } var atkReward = ""; if (reward.AttackerReward.AnythingArray == null) { atkReward = "Nothing"; } atkReward = reward.AttackerReward.ErReward == null ? "Nothing" : Utilities.ReplaceRewardInfo(reward.AttackerReward.ErReward.CountedItems[0].ItemType); if (reward.AttackerReward.AnythingArray == null) { defReward = Utilities.ReplaceRewardInfo(reward.DefenderReward.CountedItems[0].ItemType); } if (!atkReward.Contains("Nothing")) { embed.AddField($"Invasion {dacount}: Attack Reward: {atkReward} ", $"On {Utilities.ReplaceInfo(reward.Node)} Faction: {reward.AttackerMissionInfo.Faction} vs {reward.DefenderMissionInfo.Faction}"); } var faction1 = Utilities.ReplaceInfo(reward.DefenderMissionInfo.Faction.ToString()); embed.AddField($"Invasion {dacount}: Defender Reward: {defReward} ", $"On {Utilities.ReplaceInfo(reward.Node)} Faction: {Utilities.ReplaceInfo(reward.DefenderMissionInfo.Faction.ToString())} vs {Utilities.ReplaceInfo(reward.AttackerMissionInfo.Faction.ToString())}"); dacount = dacount + 1; } embed.WithTitle("Current Invasions"); embed.WithColor(new Color(188, 66, 244)); embed.WithFooter("warframe alert ver 1.0", "http://3rdshifters.org/headerLogo.png"); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
public async Task ListFissure([Remainder] string msg) { var json = Utilities.GetWarframeInfo(); var embed = new EmbedBuilder(); if (string.IsNullOrEmpty(json)) { await Context.Channel.SendMessageAsync("There was an error, please try again later!"); return; } bool fisfound = false; string damsg = ""; string exptime = ""; var warinfo = Warframe.FromJson(json); var fissures = warinfo.ActiveMissions; embed.WithFooter("warframe alert ver 1.0", "http://3rdshifters.org/headerLogo.png"); embed.WithColor(new Color(188, 66, 244)); foreach (var fissure in fissures) { if (Utilities.GetMissions(fissure.MissionType).ToLower().Contains(msg.ToLower())) { damsg = $"Planet: {Utilities.ReplaceInfo(fissure.Node)} Relic: {Utilities.ReplaceInfo(fissure.Modifier)}\n{exptime}"; exptime = Utilities.ExpireFisTime(fissure.Expiry.Date.NumberLong); embed.AddField($"{Utilities.GetMissions(fissure.MissionType)}", damsg); fisfound = true; } } if (fisfound) { embed.WithDescription($"{Utilities.FissureLink(msg.ToLower())}"); await Context.Channel.SendMessageAsync("", false, embed.Build()); } else { await Context.Channel.SendMessageAsync("No fissures found matching your request!"); } }
public async Task GetMissions() { string apiresponse = Utilities.GetWarframeInfo(); if (string.IsNullOrEmpty(apiresponse)) { await Context.Channel.SendMessageAsync("There was an error, please try again later"); return; } var warframe = Warframe.FromJson(apiresponse); var activeMissions = warframe.ActiveMissions; string[] fissurestor = new string[20]; var embed = new EmbedBuilder(); int dacount = 0; int fiscount = 1; foreach (ActiveMission am in activeMissions) { string type = am.MissionType; string damsg = $"{Utilities.GetMissions(type)}\n{Utilities.ReplaceInfo(am.Node)}\n{Utilities.ReplaceInfo(am.Modifier)}"; fissurestor[dacount] = damsg; if (fissurestor[dacount] == null) { break; } var exptime = Utilities.ExpireFisTime(am.Expiry.Date.NumberLong); embed.AddField($"**Fissure** **{fiscount}**", $"{damsg} \n Expires in: {exptime}", true); dacount = dacount + 1; fiscount = fiscount + 1; } embed.WithTitle("**Current Fissures**"); embed.WithFooter("warframe alert ver 1.0", "http://3rdshifters.org/headerLogo.png"); embed.WithColor(new Color(188, 66, 244)); await Context.Channel.SendMessageAsync("", false, embed.Build()); }