Пример #1
0
        public JEmbed Build()
        {
            JEmbed emb = new JEmbed();

            if (!isBM)
            {
                emb.Title = "Shop";
            }
            else
            {
                emb.Title = ":spy: Black Market :spy:";
            }
            emb.ThumbnailUrl = Constants.Images.ForkBot;
            emb.ColorStripe  = Constants.Colours.YORK_RED;
            var restock = new TimeSpan(4, 0, 0).Add(openDate - Var.CurrentDate());

            if (!isBM)
            {
                emb.Description = $"The shop will restock in {restock.Hours} hours and {restock.Minutes} minutes.";
            }
            else
            {
                emb.Description = $"Welcome to the Black Market... Buy somethin and get out. We'll restock in {restock.Hours} hours and {restock.Minutes} minutes.";
            }
            for (int i = 0; i < 5; i++)
            {
                var    itemID = items[i];
                string emote  = DBFunctions.GetItemEmote(items[i]);
                string name   = DBFunctions.GetItemName(itemID);
                string desc;
                desc = DBFunctions.GetItemDescription(itemID, isBM);
                int stockAmt = stock[i];
                int price    = DBFunctions.GetItemPrice(itemID);
                if (price < 0)
                {
                    price = -price;
                }
                emb.Fields.Add(new JEmbedField(x =>
                {
                    x.Header = $"{emote} {name.Replace("_", " ")} - {price} coins [{stockAmt} left in stock]";
                    x.Text   = desc;
                }));
            }

            if (!isBM)
            {
                var count = DBFunctions.GetRelevantNewsCount();

                if (count > 0)
                {
                    emb.Fields.Add(new JEmbedField(x =>
                    {
                        var newsPrice = DBFunctions.GetItemPrice("newspaper");
                        x.Header      = $"📰 Newspaper -  { newsPrice } [({count}) current article(s)]";
                        x.Text        = "The Daily Fork! Get all the now information of what's going on around ForkBot!";
                    }));
                }
            }

            return(emb);
        }