Exemplo n.º 1
0
        public async Task Urban([Remainder] string word)
        {
            WordDefine definition = await UDService.Define(word);

            Embed e = new EmbedBuilder()
            {
                Title       = $"Urban Dictionary Entry for {definition.Definitions[0].Word}",
                Description = definition.Definitions[0].Definition,
                Fields      = new List <EmbedFieldBuilder>()
                {
                    new EmbedFieldBuilder()
                    {
                        Name  = "Example",
                        Value = definition.Definitions[0].Example
                    }
                },
                Color  = Color.Orange,
                Footer = new EmbedFooterBuilder()
                {
                    Text = $"Definition ID: {definition.Definitions[0].DefId}"
                }
            }.Build();

            await ReplyAsync(embed : e);
        }
        private static bool CheckContent(WordDefine result)
        {
            var notNull = result.List.Any(); // There can still be no tags and sounds.

            if ((from item
                 in result.List
                 from prop
                 in item.GetType().GetProperties()
                 where prop.GetValue(item) == null && prop.Name != "CurrentVote"
                 select item).Any())
            {
                return(false);
            }
            return(notNull);
        }