Beispiel #1
0
        public async Task ShowImage([Remainder] string keywords)
        {
            var  image   = DanbooruService.GetRandomImage(keywords.Split(' '));
            bool isImage = image.Contains("png") || image.Contains("jpg");

            await ReplyAsync(string.Empty, embed : new EmbedBuilder()
                             .WithTitle(isImage ? string.Empty : "Image not found!")
                             .WithImageUrl(isImage ? image : string.Empty)
                             .Build());
        }
Beispiel #2
0
 private void Client_OnReceiveMessage(Discord.Objects.Message message)
 {
     if (message.Content.ToLower().Equals("tutturu"))
     {
         client.SendMessage(message.Channel_Id, $"<@{message.Author.Id}> トゥットゥル~♪");
     }
     if (message.Content.ToLower().StartsWith("~show "))
     {
         List <string> tags = new List <string>(message.Content.Split(' '));
         tags.RemoveAt(0);
         string url = DanbooruService.GetRandomImage(tags);
         //client.SendMessage(message.Channel_Id, url ?? string.Format("No Images Found For ({0})", string.Join(", ", tags)));
         if (url != null)
         {
             client.SendFile(message.Channel_Id, new Uri(url));
         }
         else
         {
             client.SendMessage(message.Channel_Id, string.Format("No Images Found For ({0})", string.Join(", ", tags)));
         }
     }
 }