Build() public method

public Build ( int t, SectionMaterial, m, SectionWeapon, w ) : System.Collections
t int
m SectionMaterial,
w SectionWeapon,
return System.Collections
Esempio n. 1
0
        public async Task List()
        {
            Note Note = await Context.NotesManager.GetNote(Context.User.Id);

            if (Note.CountNotes() > 0)
            {
                List <string>       Notes  = Note.ListNotes();
                List <EmbedBuilder> Embeds = new List <EmbedBuilder>();

                int          CharacterCount = 0;
                EmbedBuilder Builder        = new EmbedBuilder();

                Builder.Title = "Your Self Notes!";
                Builder.Color = Color.Blue;

                foreach (string RawNote in Notes)
                {
                    if (CharacterCount > 3000)
                    {
                        Embeds.Add(Builder);
                        Builder        = new EmbedBuilder();
                        Builder.Color  = Color.Blue;
                        CharacterCount = 0;
                    }

                    int    Index        = Notes.IndexOf(RawNote);
                    string FieldName    = $"ID: {Index}";
                    int    SubCharCount = FieldName.Length + RawNote.Length;

                    Builder.AddField(FieldName, RawNote);
                    CharacterCount = CharacterCount + SubCharCount;
                }

                if (CharacterCount <= 3000)
                {
                    Embeds.Add(Builder);
                }

                foreach (EmbedBuilder Build in Embeds)
                {
                    await ReplyAsync("", embed : Build.Build());
                }
            }
            else
            {
                await ReplyAsync("", embed : SimpleEmbed("You have no self notes!", false));
            }
        }