예제 #1
0
        /// <summary>
        /// Gets all the servers that exist in the servers JSON file
        /// and gives you an embed that lets you visualize their information.
        /// </summary>
        /// <returns>Embed object with server information</returns>
        public async Task <Discord.Embed> GetAllServers()
        {
            var authBuilder = new EmbedAuthorBuilder()
            {
                Name    = $"Server List",
                IconUrl = "https://www.tophattwaffle.com/wp-content/uploads/2017/11/1024_png-300x300.png",
            };

            Server[] servers = await DataBaseUtil.GetServersAsync();

            List <EmbedFieldBuilder> fieldBuilder = new List <EmbedFieldBuilder>();

            foreach (var s in servers)
            {
                fieldBuilder.Add(new EmbedFieldBuilder {
                    Name = $"{s.address}", Value = $"Prefix: `{s.name}`\n{s.description}", IsInline = false
                });
            }

            var builder = new EmbedBuilder()
            {
                Fields = fieldBuilder,
                Author = authBuilder,
                Color  = new Color(243, 128, 72),

                Description = $""
            };

            return(builder);
        }