Ejemplo n.º 1
0
        public async void ListSongs(IMessageChannel channel, int page)
        {
            //Page enumeration works like an array, so pages actually start from 0,
            int arrayPage = page - 1;

            int pageRepresentation = page;
            int pageCount          = (ListSize() + 10 - 1) / 10;

            if (SongList.Count < 1)
            {
                var embedL = new EmbedBuilder()
                             .WithColor(new Color(240, 230, 231))
                             .WithDescription("Nenhuma musica na lista");
                await channel.SendMessageAsync("", false, embedL);

                return;
            }
            else if (ListSize() <= arrayPage * 10)
            {
                var embedL = new EmbedBuilder()
                             .WithColor(new Color(240, 230, 231))
                             .WithDescription("Não é possível exibir a " + page + "ª pagina pois não há musicas suficientes");
                await channel.SendMessageAsync("", false, embedL);

                return;
            }



            var embedList = new EmbedBuilder()
                            .WithColor(new Color(240, 230, 231))
                            .WithFooter(new EmbedFooterBuilder().WithText("Pagina " + pageRepresentation + "/" + pageCount));

            //10 Songs per page
            var i = arrayPage * 10;


            while (i < SongList.Count && i < ((arrayPage * 10) + 10))
            {
                EmbedFieldBuilder embedField = new EmbedFieldBuilder();

                YTSong cur = SongList[i];

                if (SongList[i] == SongList[CurrentSongID])
                {
                    embedField.WithName("`#" + (i + 1) + " - Atual `")
                    .WithIsInline(false)
                    .WithValue("[" + cur.Title + "](" + cur.Url + ")\n\n`" + cur.RequestAuthor.Username + " | " + cur.Duration + "`");
                }
                else
                {
                    embedField.WithName("`#" + (i + 1) + "`")
                    .WithIsInline(false)
                    .WithValue("[" + cur.Title + "](" + cur.Url + ")\n\n`" + cur.RequestAuthor.Username + " | " + cur.Duration + "`");
                }
                embedList.AddField(embedField);
                i++;
            }
            await MessageChannel.SendMessageAsync("", false, embedList);
        }
Ejemplo n.º 2
0
        private static Embed CreateMultipleEquipEmbedOutput(List <string> equipNames)
        {
            EmbedBuilder      builder      = new EmbedBuilder();
            EmbedFieldBuilder fieldBuilder = new EmbedFieldBuilder();

            if (equipNames.Count <= 5)
            {
                fieldBuilder.WithName("Found multiple matching equipment:");
                string value = string.Empty;
                for (int i = 0; i < 5 && i < equipNames.Count; i++)
                {
                    value += equipNames[i] + "\n";
                }
                fieldBuilder.WithValue(value);
                fieldBuilder.WithIsInline(false);
                builder.AddField(fieldBuilder);
            }
            else
            {
                fieldBuilder.WithName("Found multiple matching equipment:");
                string value = string.Empty;
                for (int i = 0; i < 5; i++)
                {
                    value += equipNames[i] + "\n";
                }
                if (equipNames.Count > 10)
                {
                    value += string.Format("\n*and {0} more matches*", equipNames.Count - 5);
                }

                fieldBuilder.WithValue(value);
                fieldBuilder.WithIsInline(true);
                builder.AddField(fieldBuilder);

                fieldBuilder = new EmbedFieldBuilder();
                fieldBuilder.WithName("\u200b");
                value = string.Empty;
                for (int i = 5; i < 10 && i < equipNames.Count; i++)
                {
                    value += equipNames[i] + "\n";
                }
                fieldBuilder.WithValue(value);
                fieldBuilder.WithIsInline(true);
                builder.AddField(fieldBuilder);
            }

            return(builder.WithColor(new Color(112, 141, 241)).Build());
        }
Ejemplo n.º 3
0
        public async Task TagAsync(string tagName)
        {
            var requestName = tagName;

            requestName.Replace(" ", "%20");

            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create("https://www.barbershoptags.com/api.php?fldlist=Title,SungBy,SheetMusic&SheetMusic=Yes&q=" + tagName);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            request.Credentials = CredentialCache.DefaultCredentials;
            Stream       receiveStream = response.GetResponseStream();
            StreamReader readStream    = new StreamReader(receiveStream, Encoding.UTF8);

            XmlSerializer serializer = new XmlSerializer(typeof(Tags));
            Tags          tags       = (Tags)serializer.Deserialize(readStream);
            var           embed      = new EmbedBuilder();

            embed.WithTitle("Found " + tags.TagList.Count + " results when searching for " + tagName);
            foreach (var item in tags.TagList)
            {
                var builder = new EmbedFieldBuilder();
                builder.WithName(item.Title);
                string content = "[Sheet Music](" + item.SheetMusic + ")";
                builder.WithValue(content);
                embed.WithFields(builder);
            }
            await ReplyAsync("", false, embed.Build());

            response.Close();
            readStream.Close();
        }
Ejemplo n.º 4
0
        public async void ShowSongSkippedEmbed(SocketUser usr)
        {
            if (CurrentSong() == null)
            {
                return;
            }

            DeleteCurMessage();

            YTSong curSong = CurrentSong();

            EmbedFieldBuilder songTitle = new EmbedFieldBuilder();

            songTitle.WithName("--")
            .WithIsInline(false)
            .WithValue("`Cortesia de " + usr.Username + "`");

            var embedSkip = new EmbedBuilder()
                            .WithColor(new Color(240, 230, 231))
                            .WithAuthor(author => { author.WithName(" Pulando musiquinha lixo").WithIconUrl("https://cdn.discordapp.com/avatars/390402848443203595/d2831182eb4d3177febd28f44b4ec936.png?size=256"); })
                            .WithThumbnailUrl(curSong.DefaultThumbnailUrl);


            embedSkip.AddField(songTitle);

            var msg = await MessageChannel.SendMessageAsync("", false, embedSkip);

            await Task.Delay(12000);

            await msg.DeleteAsync();
        }
Ejemplo n.º 5
0
        protected Embed BuildDefaultEmbed()
        {
            List <EmbedFieldBuilder> Fields = new List <EmbedFieldBuilder>();

            foreach (ReactMenu.OptionInfo o in Menu.Options)
            {
                EmbedFieldBuilder FB = new EmbedFieldBuilder();
                FB.WithName(o.Button.ToString())
                .WithValue(o.Description);


                Fields.Add(FB);
            }

            EmbedBuilder Builder = new EmbedBuilder();

            Builder.WithTitle(Title)
            .WithFields(Fields);

            if (User != null)
            {
                Builder.WithAuthor(User);
            }
            return(Builder.Build());
        }
Ejemplo n.º 6
0
        public IEnumerable <EmbedFieldBuilder> ListGeneralHelp()
        {
            var builders = new List <EmbedFieldBuilder>();

            var builder1 = new EmbedFieldBuilder();
            var builder2 = new EmbedFieldBuilder();
            var builder3 = new EmbedFieldBuilder();

            const string prefix = Config.Prefix;

            builder1
            .WithName($"{prefix}modules")
            .WithValue("To see a list of command modules.");

            builder2
            .WithName($"{prefix}commands [module]")
            .WithValue("To see a list of commands within a module.");

            builder3
            .WithName($"{prefix}help [command]")
            .WithValue("To see more information about a command.");

            builders.Add(builder1);
            builders.Add(builder2);
            builders.Add(builder3);

            return(builders);
        }
Ejemplo n.º 7
0
        public EmbedBuilder CurrentSongEmbed()
        {
            if (CurrentSong() == null)
            {
                return(null);
            }

            YTSong curSong = CurrentSong();

            // EmbedFieldBuilder embedField = new EmbedFieldBuilder();

            //  embedField.WithValue().

            EmbedFieldBuilder songTitle = new EmbedFieldBuilder();

            songTitle.WithName("Musica atual")
            .WithIsInline(false)
            .WithValue("[" + curSong.Title + "](" + curSong.Url + ")" +
                       "\n\n" + "`" + FormattedCurTime() + " / " + curSong.Duration + "`" +
                       "\n\n`Solicitada por:` " + curSong.RequestAuthor.Username);



            var embed = new EmbedBuilder()
                        .WithColor(new Color(240, 230, 231))
                        .WithThumbnailUrl(curSong.DefaultThumbnailUrl);

            embed.AddField(songTitle);
            //.AddField(songTitle);
            //.WithFooter(new EmbedFooterBuilder().WithText(curSong.RequestAuthor.Username));

            return(embed);
        }
Ejemplo n.º 8
0
        public async void ShowSongSkippedEmbed(int n)
        {
            if (CurrentSong() == null)
            {
                return;
            }

            DeleteCurMessage();

            YTSong curSong = CurrentSong();

            EmbedFieldBuilder songTitle = new EmbedFieldBuilder();

            songTitle.WithName("** " + (PreviousSongID + 1) + " # --> " + (curSong.Order + 1) + " #**")
            .WithIsInline(false)
            .WithValue("`" + "¯\\_(ツ)_/¯" + "`");

            var embedSkip = new EmbedBuilder()
                            .WithColor(new Color(240, 230, 231))
                            .WithAuthor(author => { author.WithName("Pulando " + n + " músicas").WithIconUrl("https://cdn.discordapp.com/avatars/390402848443203595/d2831182eb4d3177febd28f44b4ec936.png?size=256"); })
                            .WithThumbnailUrl(curSong.DefaultThumbnailUrl);

            embedSkip.AddField(songTitle);

            var msg = await MessageChannel.SendMessageAsync("", false, embedSkip);

            await Task.Delay(12000);

            await msg.DeleteAsync();
        }
Ejemplo n.º 9
0
        public async Task help()
        {
            EmbedBuilder embed = getHelpEmbed();

            string message = "";

            message += "!join <role>\n";
            message += "!leave\n";
            message += "!help <command>\n";

            EmbedFieldBuilder field = new EmbedFieldBuilder();

            field.WithName("Available Commands:");
            field.WithValue(message);

            EmbedFieldBuilder additionalHelp = new EmbedFieldBuilder();

            additionalHelp.WithName("For more help, type type the help command with a specific Command");
            additionalHelp.WithValue("Ex) !help join");

            embed.AddField(field);
            embed.AddField(additionalHelp);

            await send(embed);
        }
Ejemplo n.º 10
0
        public static Embed BuildEmbed(string sBranch, double iDays, string sVersion)
        {
            //Build the embed
            EmbedBuilder MyEmbedBuilder = new EmbedBuilder();

            MyEmbedBuilder.WithColor(new Color(43, 234, 152));
            MyEmbedBuilder.WithTitle("New DCS Update released!");
            MyEmbedBuilder.WithDescription("[DCS Update Page](http://updates.digitalcombatsimulator.com)");
            MyEmbedBuilder.WithThumbnailUrl("http://is1.mzstatic.com/image/thumb/Purple49/v4/71/b8/bc/71b8bca9-dfc5-e040-4e0f-54488d6a913b/source/175x175bb.jpg");

            EmbedFooterBuilder MyFooterBuilder = new EmbedFooterBuilder();

            MyFooterBuilder.WithText("Days since last update: " + iDays);
            MyFooterBuilder.WithIconUrl("https://cdn4.iconfinder.com/data/icons/small-n-flat/24/calendar-512.png");
            MyEmbedBuilder.WithFooter(MyFooterBuilder);

            EmbedFieldBuilder MyEmbedField = new EmbedFieldBuilder();

            MyEmbedField.WithIsInline(true);
            MyEmbedField.WithName("New " + sBranch + " release!");
            MyEmbedField.WithValue("Version: " + sVersion);

            MyEmbedBuilder.AddField(MyEmbedField);

            return(MyEmbedBuilder);
        }
Ejemplo n.º 11
0
        public async Task joinHelp()
        {
            EmbedBuilder embed = getHelpEmbed("!join <role>");

            EmbedFieldBuilder function = new EmbedFieldBuilder();

            function.WithName("Function:");
            function.WithValue("This command allows users to join roles in the server");

            EmbedFieldBuilder usage = new EmbedFieldBuilder();

            usage.WithName("Usage:");
            usage.WithValue("!join <role>\nEx) `!join guests`");

            EmbedFieldBuilder roles = new EmbedFieldBuilder();

            roles.WithName("Available Roles:");
            roles.WithValue("Students\nAlumni\nGuests");

            embed.AddField(function);
            embed.AddField(usage);
            embed.AddField(roles);

            await send(embed);
        }
Ejemplo n.º 12
0
        public async Task GameMessageTest([Remainder] string arg = "")
        {
            string[]     gameInfos = arg.Split(',');
            EmbedBuilder embed     = new EmbedBuilder();

            embed.WithTitle(gameInfos[0]);
            if (gameInfos.Length > 1)
            {
                embed.WithThumbnailUrl(gameInfos[1]);
            }
            if (gameInfos.Length > 2)
            {
                embed.WithDescription(gameInfos[2]);
            }
            if (gameInfos.Length > 3)
            {
                embed.WithUrl(gameInfos[3]);
            }

            EmbedFieldBuilder fieldBuilder = new EmbedFieldBuilder();

            fieldBuilder.WithName("Test Field");
            fieldBuilder.WithValue(123456);

            embed.WithFields(fieldBuilder);
            await Context.Channel.SendMessageAsync("", false, embed.Build());
        }
Ejemplo n.º 13
0
        Embed CreateKeepStarEmebed(KeepStarProgress progress)
        {
            EmbedBuilder embedBuilder = new EmbedBuilder();

            embedBuilder.WithColor(Color.Gold);
            embedBuilder.WithThumbnailUrl("https://imageserver.eveonline.com/Render/35834_128.png");
            embedBuilder.WithAuthor($"Operation Golden Throne - {progress.Complete * 100}%",
                                    "https://imageserver.eveonline.com/Corporation/98270640_128.png",
                                    "https://goonfleet.com/index.php/topic/269069-operation-golden-throne/");
            embedBuilder.WithFooter("Dontations can be made at 1DQ1-A, B-7DFU or JITA 4-4.");

            double totalAssets = Math.Round(progress.AssetHistory[0].Item1 / 1000000000, 1);
            double escrow      = Math.Round(progress.BuyOrdersEscrow / 1000000000, 1);

            EmbedFieldBuilder fieldBuilder = new EmbedFieldBuilder();

            fieldBuilder.WithName($"Total Assets: {totalAssets.ToString("N1")}b ISK");
            fieldBuilder.WithValue($"Buy orders in escrow: {escrow.ToString("N1")}b ISK");
            embedBuilder.AddField(fieldBuilder);

            fieldBuilder = new EmbedFieldBuilder();
            fieldBuilder.WithName("Currently needed: PI");
            fieldBuilder.WithValue("P2: Viral Agent, Rocket Fuel, Polyaramids...\n⌴");
            embedBuilder.AddField(fieldBuilder);

            double totalPI = Math.Round(progress.TotalPI / 1000000000, 1);
            double p1      = Math.Round(progress.P1 / 1000000000, 1);
            double p2      = Math.Round(progress.P2 / 1000000000, 1);
            double p3      = Math.Round(progress.P3 / 1000000000, 1);
            double p4      = Math.Round(progress.P4 / 1000000000, 1);

            fieldBuilder = new EmbedFieldBuilder();
            fieldBuilder.WithName($"PI: {totalPI.ToString("N1")}b ISK");
            fieldBuilder.WithIsInline(true);
            fieldBuilder.WithValue($"P1: {p1.ToString("N1")}b ISK\n" +
                                   $"P2: {p2.ToString("N1")}b ISK\n" +
                                   $"P3: {p3.ToString("N1")}b ISK\n" +
                                   $"P4: {p4.ToString("N1")}b ISK\n");
            embedBuilder.AddField(fieldBuilder);

            double wallet = Math.Round(progress.Wallet / 1000000000, 1);

            fieldBuilder = new EmbedFieldBuilder();
            fieldBuilder.WithName($"Wallet: {wallet.ToString("N1")}b ISK");
            fieldBuilder.WithIsInline(true);

            string output = "";

            for (int i = 0; i < progress.AssetHistory.Count; i++)
            {
                float  walletHistory = progress.AssetHistory[i].Item1;
                double formated      = Math.Round(walletHistory / 1000000000, 1);

                output += $"{progress.AssetHistory[i].Item2}: {formated.ToString("N1")}b ISK\n";
            }
            fieldBuilder.WithValue(output);
            embedBuilder.AddField(fieldBuilder);

            return(embedBuilder.Build());
        }
Ejemplo n.º 14
0
        public async Task GetAllShopRoles()
        {
            var user       = _context.User as SocketGuildUser;
            var serverData = ServerDataManager.GetServerDataByServerId(_context.Guild.Id);

            if (user == null)
            {
                return;
            }

            var shopRoles = serverData.GetShopRoleModel();

            var builder = new EmbedBuilder();

            builder.WithAuthor(user.Username, user.GetAvatarUrl());
            builder.WithColor(255, 183, 229);

            var embedField = new EmbedFieldBuilder();

            embedField.WithName("Shop Roles");

            //todo: add page system
            foreach (var shopRole in shopRoles)
            {
                embedField.Value += _context.Guild.GetRole(shopRole.Value.GetRoleId()).Mention + "\n";
            }
            builder.AddField(embedField);

            await _context.Channel.SendMessageAsync("", false, builder.Build());
        }
Ejemplo n.º 15
0
        private static Embed CreateMultipleShardsCardEmbedOutput(List <ShardsCard> cards)
        {
            EmbedBuilder      builder      = new EmbedBuilder();
            EmbedFieldBuilder fieldBuilder = new EmbedFieldBuilder();

            if (cards.Count <= 5)
            {
                fieldBuilder.WithName("Found multiple matching cards:");
                string value = string.Empty;
                for (int i = 0; i < 5 && i < cards.Count; i++)
                {
                    value += cards[i].Name + "\n";
                }
                fieldBuilder.WithValue(value);
                fieldBuilder.WithIsInline(false);
                builder.AddField(fieldBuilder);
            }
            else
            {
                fieldBuilder.WithName("Found multiple matching cards:");
                string value = string.Empty;
                for (int i = 0; i < 5; i++)
                {
                    value += cards[i].Name + "\n";
                }
                if (cards.Count > 10)
                {
                    value += string.Format("\n*and {0} more matches*", cards.Count - 10);
                }

                fieldBuilder.WithValue(value);
                fieldBuilder.WithIsInline(true);
                builder.AddField(fieldBuilder);

                fieldBuilder = new EmbedFieldBuilder();
                fieldBuilder.WithName("\u200b");
                value = string.Empty;
                for (int i = 5; i < 10 && i < cards.Count; i++)
                {
                    value += cards[i].Name + "\n";
                }
                fieldBuilder.WithValue(value);
                fieldBuilder.WithIsInline(true);
                builder.AddField(fieldBuilder);
            }
            return(builder.WithColor(new Color(112, 141, 241)).Build());
        }
Ejemplo n.º 16
0
        public async void ListSongs(IMessageChannel channel)
        {
            if (SongList.Count < 1)
            {
                var embedL = new EmbedBuilder()
                             .WithColor(new Color(240, 230, 231))
                             .WithDescription("Nenhuma musica na lista");
                await channel.SendMessageAsync("", false, embedL);

                return;
            }

            var i = 0;

            int pageCount = (ListSize() + 10 - 1) / 10;


            var embedList = new EmbedBuilder()
                            .WithColor(new Color(240, 230, 231))
                            .WithFooter(new EmbedFooterBuilder().WithText("Pagina 1/" + pageCount));

            //Will only show the first page, each page contains 10 songs
            while (i < SongList.Count && i < 10)
            {
                EmbedFieldBuilder embedField = new EmbedFieldBuilder();

                YTSong cur = SongList[i];

                if (SongList[i] == SongList[CurrentSongID])
                {
                    embedField.WithName("`#" + (i + 1) + " - Atual `")
                    .WithIsInline(false)
                    .WithValue("[" + cur.Title + "](" + cur.Url + ")\n\n`" + cur.RequestAuthor.Username + " | " + cur.Duration + "`");
                }
                else
                {
                    embedField.WithName("`#" + (i + 1) + "`")
                    .WithIsInline(false)
                    .WithValue("[" + cur.Title + "](" + cur.Url + ")\n\n`" + cur.RequestAuthor.Username + " | " + cur.Duration + "`");
                }
                embedList.AddField(embedField);
                i++;
            }
            await MessageChannel.SendMessageAsync("", false, embedList);
        }
Ejemplo n.º 17
0
        public static EmbedFieldBuilder CreateEmbedField(string title, string discription, bool inline)
        {
            EmbedFieldBuilder ebf = new EmbedFieldBuilder();

            ebf.WithName(title);
            ebf.WithValue(discription);
            ebf.WithIsInline(inline);
            return(ebf);
        }
Ejemplo n.º 18
0
        private static EmbedFieldBuilder CreateEmbedField(bool inline, string name, object value)
        {
            EmbedFieldBuilder FieldBuilder = new EmbedFieldBuilder();

            FieldBuilder.WithIsInline(inline);
            FieldBuilder.WithName(name);
            FieldBuilder.WithValue(value);
            return(FieldBuilder);
        }
Ejemplo n.º 19
0
        public static EmbedFieldBuilder SetField(String name, String value, Boolean inline = false)
        {
            EmbedFieldBuilder field = new EmbedFieldBuilder();

            field.WithName(name);
            field.WithValue(value);
            field.WithIsInline(inline);
            return(field);
        }
Ejemplo n.º 20
0
        public EmbedFieldBuilder CreateCommandInfoEmbedField([NotNull] CommandInfo command)
        {
            var fieldBuilder = new EmbedFieldBuilder();

            fieldBuilder.WithName(command.GetFullCommand());
            fieldBuilder.WithValue(command.Summary ?? "No summary available.");

            return(fieldBuilder);
        }
Ejemplo n.º 21
0
        public IEnumerable <EmbedFieldBuilder> ListCommandHelp(CommandInfo command)
        {
            var builders = new List <EmbedFieldBuilder>();

            var builder1 = new EmbedFieldBuilder();
            var builder2 = new EmbedFieldBuilder();

            var usage = new StringBuilder();

            usage.Append($"{command.Name} ");

            foreach (var parameter in command.Parameters)
            {
                usage.Append($"[{parameter.Name }] ");
            }

            builder2
            .WithName("Usage")
            .WithValue(usage);

            builders.Add(builder2);

            var aliases = new StringBuilder();

            if (command.Aliases.Count != 1)
            {
                foreach (var alias in command.Aliases)
                {
                    aliases.Append($"{alias}, ");
                }
            }
            else
            {
                aliases.Append("None");
            }

            builder1
            .WithName("Aliases")
            .WithValue(aliases);


            foreach (var parameter in command.Parameters)
            {
                var builder3 = new EmbedFieldBuilder();

                builder3
                .WithName(parameter.Name)
                .WithValue($"\n{parameter.Summary}");

                builders.Add(builder3);
            }

            return(builders);
        }
Ejemplo n.º 22
0
            public async Task <RuntimeResult> ListAvailableRolesAsync()
            {
                var getServerRolesResult = await _characterRoles.GetCharacterRolesAsync(this.Context.Guild);

                if (!getServerRolesResult.IsSuccess)
                {
                    return(getServerRolesResult.ToRuntimeResult());
                }

                var serverRoles = getServerRolesResult.Entity.ToList();

                var eb = _feedback.CreateEmbedBase();

                eb.WithTitle("Available character roles");
                eb.WithDescription
                (
                    "These are the roles you can apply to your characters to automatically switch you to that role " +
                    "when you assume the character.\n" +
                    "\n" +
                    "In order to avoid mentioning everyone that has the role, use the numerical ID or role name" +
                    " instead of the actual mention. The ID is listed below along with the role name."
                );

                if (!serverRoles.Any())
                {
                    eb.WithFooter("There aren't any character roles available in this server.");
                }
                else
                {
                    foreach (var characterRole in serverRoles)
                    {
                        var discordRole = this.Context.Guild.GetRole((ulong)characterRole.DiscordID);
                        if (discordRole is null)
                        {
                            continue;
                        }

                        var ef = new EmbedFieldBuilder();
                        ef.WithName($"{discordRole.Name} ({discordRole.Id})");

                        var roleStatus = characterRole.Access == RoleAccess.Open
                            ? "open to everyone"
                            : "restricted";

                        ef.WithValue($"*This role is {roleStatus}.*");

                        eb.AddField(ef);
                    }
                }

                await _feedback.SendEmbedAsync(this.Context.Channel, eb.Build());

                return(RuntimeCommandResult.FromSuccess());
            }
Ejemplo n.º 23
0
        public async Task Deck(string argument = null, params string[] deckNames)
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            switch (argument)
            {
            case "add":
                context.AddDecks(deckNames);
                context.SaveToJson();
                break;

            case "remove":
                context.RemoveDecks(deckNames);
                context.SaveToJson();
                break;

            default:
                if (context.UsedDecks.Count > 0)
                {
                    EmbedBuilder embed = new EmbedBuilder();

                    EmbedFieldBuilder usedField = new EmbedFieldBuilder();
                    usedField.WithName("Current Decks");
                    string description = string.Empty;
                    foreach (Deck deck in context.UsedDecks)
                    {
                        description += string.Format("{2} {0} - {1}" + Environment.NewLine, deck.Name, deck.Description, deck.Emoji);
                    }
                    usedField.WithValue(description);

                    EmbedFieldBuilder unusedField = new EmbedFieldBuilder();
                    unusedField.WithName("Avaliable Decks");
                    description = string.Empty;
                    List <Deck> unusedDecks = (List <Deck>)Decks.GetAllDecks();
                    unusedDecks.RemoveAll(s => context.UsedDecks.Contains(s));
                    foreach (Deck deck in unusedDecks)
                    {
                        description += string.Format("{2} {0} - {1}" + Environment.NewLine, deck.Name, deck.Description, deck.Emoji);
                    }
                    unusedField.WithValue(description);

                    embed.AddField(usedField);
                    embed.AddField(unusedField);

                    await ReplyAsync("", false, embed.Build());
                }
                else
                {
                    await ReplyAsync("You currently have no decks.");
                }

                break;
            }
        }
Ejemplo n.º 24
0
        public async Task ShowAvailablePronounFamiliesAsync()
        {
            EmbedFieldBuilder CreatePronounField(IPronounProvider pronounProvider)
            {
                var ef = new EmbedFieldBuilder();

                ef.WithName(pronounProvider.Family);

                var value = $"{pronounProvider.GetSubjectForm()} ate {pronounProvider.GetPossessiveAdjectiveForm()} " +
                            $"pie that {pronounProvider.GetSubjectForm()} brought with " +
                            $"{pronounProvider.GetReflexiveForm()}.";

                value = value.Transform(To.SentenceCase);

                ef.WithValue($"*{value}*");

                return(ef);
            }

            var pronounProviders = _pronouns.GetAvailablePronounProviders().ToList();

            if (!pronounProviders.Any())
            {
                await _feedback.SendErrorAsync(this.Context, "There doesn't seem to be any pronouns available.");

                return;
            }

            var fields      = pronounProviders.Select(CreatePronounField);
            var description = "Each field below represents a pronoun that can be used with a character. The title of " +
                              "each field is the pronoun family that you use when selecting the pronoun, and below it" +
                              "is a short example of how it might be used.";

            var paginatedEmbedPages = PageFactory.FromFields
                                      (
                fields,
                description: description
                                      );

            var paginatedEmbed = new PaginatedEmbed(_feedback, _interactivity, this.Context.User).WithPages
                                 (
                paginatedEmbedPages.Select
                (
                    p => p.WithColor(Color.DarkPurple).WithTitle("Available pronouns")
                )
                                 );

            await _interactivity.SendInteractiveMessageAndDeleteAsync
            (
                this.Context.Channel,
                paginatedEmbed,
                TimeSpan.FromMinutes(5.0)
            );
        }
Ejemplo n.º 25
0
        public async Task Help(ModuleInfo module)
        {
            var pages      = new List <PageBuilder>();
            var pageFields = new List <EmbedFieldBuilder>();

            foreach (CommandInfo command in module.Commands)
            {
                EmbedFieldBuilder embedField = new EmbedFieldBuilder();
                embedField.WithName(HelpUtilities.GetCommandUsage(command));
                embedField.WithValue(command.Summary ?? "no information given");
                pageFields.Add(embedField);
            }

            if (pageFields.Count <= 25)
            {
                PageBuilder page = new PageBuilder();
                page.WithTitle(module.Name);
                page.WithFields(pageFields);
                pages.Add(page);

                var builder = new EmbedBuilder();
                builder.WithTitle(module.Name);
                builder.WithFields(pageFields);
                await ReplyAsync("", false, builder.Build());
            }
            else
            {
                while (pageFields.Count > 0)
                {
                    PageBuilder page = new PageBuilder();
                    page.WithTitle(module.Name);
                    page.WithFields(pageFields.Take(25));
                    pages.Add(page);
                    if (pageFields.Count > 25)
                    {
                        pageFields.RemoveRange(0, 24);
                    }
                    else
                    {
                        pageFields.Clear();
                    }
                }

                var paginator = new StaticPaginatorBuilder()
                                .WithUsers(Context.User)
                                .WithPages(pages)
                                .WithFooter(PaginatorFooter.PageNumber | PaginatorFooter.Users)
                                .WithDefaultEmotes()
                                .Build();

                await _interactivity.SendPaginatorAsync(paginator, Context.Channel, TimeSpan.FromMinutes(2));
            }
        }
Ejemplo n.º 26
0
        public async Task Say10()
        {
            if (119019602574442497 != Context.User.Id)
            {
                // Secrurity check
                await ReplyAsync("This is a debug command, you cannot use it!");

                return;
            }
            EmbedBuilder MyEmbedBuilder = new EmbedBuilder();

            MyEmbedBuilder.WithColor(new Color(43, 234, 152));
            MyEmbedBuilder.WithTitle("Your title");

            MyEmbedBuilder.WithUrl("http://www.google.com");
            //MyEmbedBuilder.WithDescription("My description");
            MyEmbedBuilder.WithDescription("[Google](http://www.google.com)");

            MyEmbedBuilder.WithThumbnailUrl("https://forum.codingwithstorm.com/Themes/Modern/images/vertex_image/social_twitter_icon.png");
            MyEmbedBuilder.WithImageUrl("https://forum.codingwithstorm.com/Themes/Modern/images/vertex_image/social_facebook_icon.png");

            //Footer
            EmbedFooterBuilder MyFooterBuilder = new EmbedFooterBuilder();

            MyFooterBuilder.WithText("Your text");
            MyFooterBuilder.WithIconUrl("https://forum.codingwithstorm.com/Smileys/Koloboks/wink3.gif");
            MyEmbedBuilder.WithFooter(MyFooterBuilder);

            //Author
            EmbedAuthorBuilder MyAuthorBuilder = new EmbedAuthorBuilder();

            MyAuthorBuilder.WithName("Your Name");
            MyAuthorBuilder.WithUrl("http://www.google.com");
            MyEmbedBuilder.WithAuthor(MyAuthorBuilder);

            //EmbedField
            EmbedFieldBuilder MyEmbedField = new EmbedFieldBuilder();

            MyEmbedField.WithIsInline(true);
            MyEmbedField.WithName("Your Field Name");
            MyEmbedField.WithValue("Your value");
            MyEmbedField.WithValue("[Youtube](http://www.youtube.com)");

            MyEmbedBuilder.AddField(MyEmbedField);
            MyEmbedBuilder.AddField(MyEmbedField);
            MyEmbedBuilder.AddField(MyEmbedField);
            MyEmbedBuilder.AddField(MyEmbedField);
            MyEmbedBuilder.AddField(MyEmbedField);
            MyEmbedBuilder.AddField(MyEmbedField);
            MyEmbedBuilder.AddField(MyEmbedField);

            await ReplyAsync("Swaaaag:", false, MyEmbedBuilder);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Generates a Discord Embed for the given <paramref name="stream"/>
        /// </summary>
        /// <param name="stream"></param>
        /// <returns>Discord Embed with Stream Information</returns>
        public static Embed GetStreamEmbed(ILiveBotStream stream, ILiveBotUser user, ILiveBotGame game)
        {
            // Build the Author of the Embed
            EmbedAuthorBuilder authorBuilder = new EmbedAuthorBuilder();

            authorBuilder.WithName(user.DisplayName);
            authorBuilder.WithIconUrl(user.AvatarURL);
            authorBuilder.WithUrl(user.ProfileURL);

            // Build the Footer of the Embed
            EmbedFooterBuilder footerBuilder = new EmbedFooterBuilder();

            footerBuilder.WithText("Stream start time");

            // Add Basic information to EmbedBuilder
            EmbedBuilder builder = new EmbedBuilder();

            builder.WithColor(Color.DarkPurple);

            builder.WithAuthor(authorBuilder);
            builder.WithFooter(footerBuilder);

            builder.WithTimestamp(stream.StartTime);
            builder.WithDescription(stream.Title);
            builder.WithUrl(stream.StreamURL);
            builder.WithThumbnailUrl(user.AvatarURL);

            // Add Status Field
            //EmbedFieldBuilder statusBuilder = new EmbedFieldBuilder();
            //statusBuilder.WithIsInline(false);
            //statusBuilder.WithName("Status");
            //statusBuilder.WithValue("");
            //builder.AddField(statusBuilder);

            // Add Game field
            EmbedFieldBuilder gameBuilder = new EmbedFieldBuilder();

            gameBuilder.WithIsInline(true);
            gameBuilder.WithName("Game");
            gameBuilder.WithValue(game.Name);
            builder.AddField(gameBuilder);

            // Add Stream URL field
            EmbedFieldBuilder streamURLField = new EmbedFieldBuilder();

            streamURLField.WithIsInline(true);
            streamURLField.WithName("Stream");
            streamURLField.WithValue(stream.StreamURL);
            builder.AddField(streamURLField);

            return(builder.Build());
        }
Ejemplo n.º 28
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var builder = new EmbedFieldBuilder();
            var id      = Guid.NewGuid();

            builder.WithName(txtTitle.Text).WithValue(txtContent.Text);
            embeds.Add(id, builder);
            ListViewItem lvItem = new ListViewItem(txtTitle.Text);

            lvItem.SubItems.Add(txtContent.Text);
            lvItem.SubItems.Add(id.ToString());
            listView1.Items.Add(lvItem);
        }
Ejemplo n.º 29
0
        private static async Task <Embed> CreateEquipEmbedOutput(string equipName)
        {
            EmbedBuilder      builder      = new EmbedBuilder();
            EmbedFieldBuilder fieldBuilder = new EmbedFieldBuilder();

            builder.WithImageUrl(CreateEquipLink(equipName));
            fieldBuilder.WithIsInline(false);
            fieldBuilder.WithName(string.Format("{0}(Equipment)", equipName));

            // get ah prices from the hexprice api
            SearchRequest searchQuery = new SearchRequest()
            {
                SearchQuery = equipName,
            };
            HttpResponseMessage response = await Program.httpClient.PostAsJsonAsync("items/search", searchQuery);

            if (response.IsSuccessStatusCode)
            {
                SearchResult[] resultList = await response.Content.ReadAsAsync <SearchResult[]>();

                int  resultIndex;
                bool foundExactMatch = false;
                for (resultIndex = 0; resultIndex < resultList.Length; resultIndex++)
                {
                    if (resultList[resultIndex].Item.LinkName.Equals(equipName, StringComparison.OrdinalIgnoreCase))
                    {
                        foundExactMatch = true;
                        break;
                    }
                }

                if (foundExactMatch)
                {
                    int platBuyout = resultList[resultIndex].CurrentCheapestPlat;
                    int goldBuyout = resultList[resultIndex].CurrentCheapestGold;

                    fieldBuilder.WithValue(string.Format("Lowest Buyout: [{0} | {1}]({2})", platBuyout == -1 ? "none" : string.Format("{0}p", platBuyout), goldBuyout == -1 ? "none" : string.Format("{0}g", goldBuyout), CreateHexPriceLink(resultList[resultIndex])));
                }
                else
                {
                    fieldBuilder.WithValue("Couldn't find AH data.");
                }
            }
            else
            {
                fieldBuilder.WithValue("Couldn't connect to hexprice.com.");
            }

            builder.AddField(fieldBuilder);
            return(builder.WithColor(new Color(112, 141, 241)).Build());
        }
Ejemplo n.º 30
0
        /// <inheritdoc/>
        public IEnumerable <EmbedFieldBuilder> ListBotInfo()
        {
            var builders = new List <EmbedFieldBuilder>();

            var builder1 = new EmbedFieldBuilder();
            var builder2 = new EmbedFieldBuilder();
            var builder3 = new EmbedFieldBuilder();
            var builder4 = new EmbedFieldBuilder();
            var builder5 = new EmbedFieldBuilder();
            var builder6 = new EmbedFieldBuilder();

            builder1
            .WithName("Developer")
            .WithValue(Developer)
            .WithIsInline(true);

            builder2
            .WithName("Library")
            .WithValue(Library)
            .WithIsInline(true);

            builder3
            .WithName("Version")
            .WithValue(Version)
            .WithIsInline(true);

            builder4
            .WithName("Uptime")
            .WithValue(GetUptime())
            .WithIsInline(true);

            builder5
            .WithName("Client")
            .WithValue(GetClientStats())
            .WithIsInline(true);

            builder6
            .WithName("OS")
            .WithValue(GetOperatingSystem())
            .WithIsInline(true);

            builders.Add(builder1);
            builders.Add(builder2);
            builders.Add(builder3);
            builders.Add(builder4);
            builders.Add(builder5);
            builders.Add(builder6);

            return(builders);
        }