public static Almanax GetAlmanax(string date) { JObject json = JObject.Parse(File.ReadAllText("almanax.json")); Almanax almanax = new Almanax { ItemImage = (int)json[date]["itemImage"], Quest = (string)json[date]["quest"], Type = (string)json[date]["type"], Effect = (string)json[date]["effect"], Offering = (string)json[date]["offering"], }; return(almanax); }
/// <summary> /// Méthode de prise en charge de la commande almanax /// </summary> /// <param name="channel"></param> /// <param name="user"></param> /// <param name="date"></param> public void AlmanaxAsync(IMessageChannel channel, IUser user, string date = null) { if (date == null) { date = DateTime.Today.Day.ToString("D2") + "/" + DateTime.Today.Month.ToString("D2"); } Almanax almanax = JsonHelper.GetAlmanax(date); var builder = EmbedBuilderHelper.EmbedBuilderInformation(user) .WithThumbnailUrl("https://almanax.ordre2vlad.fr/images/items/" + almanax.ItemImage + ".png") .WithTitle("Almanax command") .AddField(almanax.Quest.Split(" : ")[0], almanax.Quest.Split(" : ")[1]) .AddField(almanax.Type, almanax.Effect) .AddField("Offrande", almanax.Offering); Reply("", builder); }