Пример #1
0
        public static async Task <EmbedBuilder> BuildCurrencyHelpEmbed(ICommandContext context)
        {
            EmbedBuilder emb = new EmbedBuilder()
            {
                Color        = Color.Teal,
                Title        = "Currency Command help",
                Description  = "Commands that have to do with hording Sheqels for all your octomoist purchases.",
                ThumbnailUrl = "https://cdn.apk4free.net/wp-content/uploads/2018/04/bitcoin.png",
                Footer       = await EmbedBuilderFunctions.AddFooter(context)
            };

            emb.AddField("Command name", "Currency", true);
            emb.AddField("Parameters", "top,balance,redeem,exchange,help,currencies,transfer", true);

            emb.AddField("Examples", "currency top\ncurrency top 69\ncurrency help"
                         + "\ncurrency redeem\ncurrency exchange 1000 Entropy Complexity\n" +
                         "currency exchange 1000 E C\ncurrency exchange 1 C E\ncurrency exchange 1,25 C E\n" +
                         "currency currencies\ncurrency transfer 100 Entropy @Margret@0027" +
                         "\ncurrency transfer 0,25 C @Margret@0027", false);

            emb.AddField("Remarks", "You can only redeem every 24 hours.\n" +
                         "Everyone is entitled to 300 🌕(E) starting credits type currency redeem to get them.\n" +
                         "The first argument of currency exchange is the amount you'll be exchanging, the second argument is "
                         + "the currency you'll be exchanging and the third argument is the currency you'll be converting to\n"
                         + "You can only use a , to represent a comma number for an exchange and transfer E.G. 1,5 and not 1.5 ", false);

            emb.WithCurrentTimestamp();

            return(emb);
        }
Пример #2
0
        public static async Task DisplayWeather(WeatherModel wm, SocketCommandContext context)
        {
            EmbedBuilder eb = new EmbedBuilder {
                Color = Color.Teal
            };

            eb.WithTitle($"Weather for {wm.Name},{wm.Sys.Country}");
            eb.WithDescription($"{wm.WeatherDescriptionModel.Description}");

            eb.AddField("Temperature", $"{ToFarenheit(wm.Main.Temp)}°F ({ToCelcius(wm.Main.Temp)}°C)", true);
            eb.AddField("Humidity", $"{wm.Main.Humidity}%", true);

            eb.AddField("Wind speed", $"{ToKmPerHour(wm.Wind.Speed)}km/h ({ToMilesPerHour(wm.Wind.Speed)}miles/h)", true);
            eb.AddField("Max Temperature", $"{ToFarenheit(wm.Main.Temp_max)}°F ({ToCelcius(wm.Main.Temp_max)}°C)", true);
            eb.AddField("Min Temperature", $"{ToFarenheit(wm.Main.Temp_min)}°F ({ToCelcius(wm.Main.Temp_min)}°C)", true);

            eb.WithThumbnailUrl($"http://openweathermap.org/img/w/{wm.WeatherDescriptionModel.Icon}.png");

            EmbedFooterBuilder efb = EmbedBuilderFunctions.AddFooter(context).Result;

            efb.Text += " - Powered by the API OpenWeatherMap";
            eb.WithFooter(efb);

            await context.Channel.SendMessageAsync(embed : eb.Build());
        }
Пример #3
0
        public static async Task <EmbedBuilder> GetTransferEmbed(ICommandContext context, EntityUser eu, EntityUser own, CurrencyEnum cu, double amount)
        {
            IGuildUser owner      = context.User as IGuildUser;
            IGuildUser transferee = await context.Guild.GetUserAsync(eu.Id);

            string ownerName    = owner.Nickname ?? owner.Username;
            string transferName = transferee.Nickname ?? transferee.Username;

            EmbedBuilder emb = new EmbedBuilder()
            {
                Color        = Color.Teal,
                Title        = $"Transferred {amount.RoundDownTwoDecimals()} {cu} succesfully",
                Footer       = await EmbedBuilderFunctions.AddFooter(context),
                ThumbnailUrl = "https://static.thenounproject.com/png/175569-200.png"
            };

            var desc = $"{ownerName} succesfully transferred {amount} {cu} to {transferName}";

            emb.Description = desc;
            emb.WithCurrentTimestamp();

            emb.AddField($"{ownerName}s Balance", $"\t{own.GetCurrencyAmount(CurrencyEnum.Complexity).RoundDownTwoDecimals()}🚀(C)\t"
                         + $"{own.GetCurrencyAmount(CurrencyEnum.Entropy).RoundDownTwoDecimals()}🌕(E)", false);

            emb.AddField($"{transferName}s Balance", $"\t{eu.GetCurrencyAmount(CurrencyEnum.Complexity).RoundDownTwoDecimals()}🚀(C)\t"
                         + $"{eu.GetCurrencyAmount(CurrencyEnum.Entropy).RoundDownTwoDecimals()}🌕(E)", false);

            return(emb);
        }
Пример #4
0
        public static async Task <EmbedBuilder> ShowExchangeRates(string[] currencies, ICommandContext context)
        {
            var emb = new EmbedBuilder()
            {
                Color        = Color.Teal,
                Footer       = await EmbedBuilderFunctions.AddFooter(context),
                Title        = "Currencies and exchange rates",
                Description  = "A listing of available currencies and their exchange rates.",
                ThumbnailUrl = "https://dogwatchcafe.com/wp-content/uploads/2017/04/currency_exchange1600.png"
            };

            emb.WithCurrentTimestamp();
            emb.AddField("Currencies", string.Join(",", currencies), true);

            string s = "";

            for (int i = 0; i < currencies.Length; i += 2)
            {
                var cur  = currencies[0];
                var cur2 = currencies[1];
                int A    = (int)Enum.Parse(typeof(ConversionRate), $"{cur}To{cur2}");
                int B    = (int)Enum.Parse(typeof(ConversionRate), $"{cur2}To{cur}");
                s += $"{A} {cur} = {B} {cur2}\n";
            }

            emb.AddField("Exchange Rates", s, false);

            return(emb);
        }
Пример #5
0
        public static async Task <EmbedBuilder> MakeGithubEmbed(GithubModel model, ICommandContext context)
        {
            EmbedBuilder emb = new EmbedBuilder()
            {
                Color        = Color.Teal,
                Title        = model.ProjectName,
                Url          = GithubParser.ProjectLink,
                ThumbnailUrl = "https://i.imgur.com/ASk5DlY.png"
            };

            emb.WithDescription(model.ProjectDescription);

            emb.AddField("Commits", model.Commits, true);
            emb.AddField("Stars", model.Stars, true);
            emb.AddField("Watchers", model.Watchers, true);
            emb.AddField("Author", model.AuthorName, true);

            emb.AddField("Found a bug,want to contribute or request a feature?", model.IssueLink);


            EmbedFooterBuilder footer = await EmbedBuilderFunctions.AddFooter(context);

            footer.Text += " - Powered by Github";
            emb.WithFooter(footer);

            return(emb);
        }
Пример #6
0
        public static async Task <EmbedBuilder> MakeImageEmbed(ImageModel model, int indx, ICommandContext context)
        {
            EmbedBuilder emb = new EmbedBuilder()
            {
                Color    = Color.Teal,
                Title    = model.Titles[indx],
                Url      = model.Links[indx],
                ImageUrl = model.Thumbs[indx]
            };

            EmbedFooterBuilder footer = await EmbedBuilderFunctions.AddFooter(context);

            footer.Text += " - Powered by Bing";
            emb.WithFooter(footer);

            return(emb);
        }
Пример #7
0
        public static async Task <EmbedBuilder> MakeBalanceEmbed(ICommandContext context, EntityUser eu)
        {
            var user = await context.Guild.GetUserAsync(eu.Id);

            EmbedBuilder emb = new EmbedBuilder()
            {
                Color        = Color.Teal,
                Title        = $"Balance for {user.Nickname ?? user.Username}",
                Footer       = await EmbedBuilderFunctions.AddFooter(context),
                ThumbnailUrl = user.GetAvatarUrl() ?? user.GetDefaultAvatarUrl(),
                Description  = $"Current balance:\t{eu.GetCurrencyAmount(CurrencyEnum.Complexity).RoundDownTwoDecimals()}🚀(C)\t "
                               + $"{eu.GetCurrencyAmount(CurrencyEnum.Entropy).RoundDownTwoDecimals()}🌕(E)"
            };

            emb.WithCurrentTimestamp();
            return(emb);
        }
Пример #8
0
        public static async Task <EmbedBuilder> MakeTradeEmbed(double addAmount, double removeAmount
                                                               , ICommandContext context, CurrencyEnum addCurrency, CurrencyEnum rmCurrency)
        {
            var user = context.User as IGuildUser;

            EmbedBuilder emb = new EmbedBuilder()
            {
                Color       = Color.Teal,
                Title       = $"Exchange by {user.Nickname ?? user.Username} successful",
                Description = $"{user.Nickname ?? user.Username} exchanged {removeAmount.RoundDownTwoDecimals()} {rmCurrency}"
                              + $" to {addAmount.RoundDownTwoDecimals()} {addCurrency}",
                ThumbnailUrl = user.GetAvatarUrl() ?? user.GetDefaultAvatarUrl(),
                Footer       = await EmbedBuilderFunctions.AddFooter(context)
            };

            return(emb);
        }
Пример #9
0
        public async static Task <EmbedBuilder> BuildRank(ICommandContext context, RankingModel ranking, IGuildUser user)
        {
            EmbedFooterBuilder footer = await EmbedBuilderFunctions.AddFooter(context);

            EmbedBuilder builder = new EmbedBuilder()
            {
                Color        = Color.Green,
                Title        = $"Rank for {user.Nickname ?? user.Username}",
                ThumbnailUrl = user.GetAvatarUrl(),
                Description  = $"So you want to know your standing huh? Well here it is.",
                Footer       = footer
            };

            builder.AddField("Qouted Ranking", $"#{ranking.QuoteRank}", true);
            builder.AddField("Quotes Created Ranking", $"#{ranking.CreatedRank}", true);
            builder.AddField("Voice Ranking", $"#{ranking.VCRank}", false);

            return(builder);
        }
Пример #10
0
        public static async Task <EmbedBuilder> MakeRedeemEmbed(ICommandContext context, EntityUser eu, double amount)
        {
            var user = context.User as IGuildUser;

            amount = Math.Round(amount, 2);

            EmbedBuilder emb = new EmbedBuilder()
            {
                Color        = Color.Teal,
                Title        = $"{user.Nickname ?? user.Username} has redeemed {amount} Entropy",
                Footer       = await EmbedBuilderFunctions.AddFooter(context),
                ThumbnailUrl = user.GetAvatarUrl() ?? user.GetDefaultAvatarUrl(),
                Description  = $"Redeemed {amount} Entropy \n" +
                               $"Current balance:\t{eu.GetCurrencyAmount(CurrencyEnum.Complexity).RoundDownTwoDecimals()}🚀(C)\t "
                               + $"{eu.GetCurrencyAmount(CurrencyEnum.Entropy).RoundDownTwoDecimals()}🌕(E)"
            };

            return(emb);
        }
Пример #11
0
        public static async Task <EmbedBuilder> MakeCurrencyError(string[] currencies, ICommandContext context)
        {
            EmbedBuilder emb = new EmbedBuilder()
            {
                Color        = Color.Red,
                Description  = "One of the specified currencies was not found",
                Title        = "Error with the currencies",
                Footer       = await EmbedBuilderFunctions.AddFooter(context),
                ThumbnailUrl = "https://cache.desktopnexus.com/thumbseg/541/541559-bigthumbnail.jpg"
            };

            emb.AddField("Possible currencies :heavy_dollar_sign:", string.Join(",", currencies), true);
            emb.AddField("Remark", "You don't have to type out the full name of the " +
                         "currency just the first letter already suffices. (case insensitive)");
            emb.AddField("See more", $"For a better list of the currencies you can run {Program.prefix}" +
                         "currency currencies");

            emb.WithCurrentTimestamp();

            return(emb);
        }
Пример #12
0
        public async static Task <EmbedBuilder> BuildRankEmbed(ICommandContext context, Scores[] scores, EntityUser[] users, int page, Enums.ScoreType type)
        {
            string title  = $"Oreocafé Ranking: Times Quoted- page {page+1}";
            string status = "Quotes";

            switch (type)
            {
            case Enums.ScoreType.Qouter:
                title  = $"Oreocafé Ranking: Quotes Created - page {page + 1}";
                status = "Quotes created";
                break;

            case Enums.ScoreType.VC:
                title  = $"Oreocafé Ranking: VC Score- page {page + 1}";
                status = "Points";
                break;
            }


            EmbedBuilder emb = new EmbedBuilder()
            {
                Title = title,
                Color = Color.Green
            };

            foreach (Scores score in scores)
            {
                int s = score.Quoted;

                switch (type)
                {
                case Enums.ScoreType.Qouter:
                    s = score.Quotes_Created;
                    break;

                case Enums.ScoreType.VC:
                    s = score.VC_Score;
                    break;
                }

                int indx = scores.IndexOf(score);
                int rank = indx + 1 + (page * RankingModule._pageAmount);

                EntityUser user  = users[indx];
                IGuildUser userg = await context.Guild.GetUserAsync(user.Id);

                if (userg != null)
                {
                    emb.AddField(new EmbedFieldBuilder()
                    {
                        Name     = $"Rank {rank}",
                        Value    = $"{userg.Nickname ?? userg.Username} ({s} {status})",
                        IsInline = false
                    });
                }
                else
                {
                    emb.AddField(new EmbedFieldBuilder()
                    {
                        Name     = $"Rank {rank}",
                        Value    = $"{user.Username} ({s} {status})",
                        IsInline = false
                    });
                }
            }

            EmbedFooterBuilder efb = await EmbedBuilderFunctions.AddFooter(context);

            emb.WithFooter(efb);

            return(emb);
        }