Пример #1
0
        public async Task UrbanAsync(EventContext e)
        {
            if (string.IsNullOrEmpty(e.arguments))
            {
                return;
            }

            Locale               locale = Locale.GetEntity(e.Channel.Id.ToDbLong());
            UrbanDictionaryApi   api    = new UrbanDictionaryApi(Global.UrbanKey);
            UrbanDictionaryEntry entry  = api.GetEntry(e.arguments);

            if (entry != null)
            {
                IDiscordEmbed embed = Utils.Embed
                                      .SetAuthor(entry.Term,
                                                 "http://cdn9.staztic.com/app/a/291/291148/urban-dictionary-647813-l-140x140.png",
                                                 "http://www.urbandictionary.com/define.php?term=" + e.arguments)
                                      .SetDescription(locale.GetString("miki_module_general_urban_author", entry.Author));

                embed.AddInlineField(locale.GetString("miki_module_general_urban_definition"), entry.Definition);
                embed.AddInlineField(locale.GetString("miki_module_general_urban_example"), entry.Example);
                embed.AddInlineField(locale.GetString("miki_module_general_urban_rating"), "👍 " + entry.ThumbsUp + "  👎 " + entry.ThumbsDown);

                await embed.SendToChannel(e.Channel);
            }
            else
            {
                await Utils.ErrorEmbed(locale, "This term couldn't been found!")
                .SendToChannel(e.Channel.Id);
            }
        }