Exemplo n.º 1
0
        public async Task DoSafe(EventContext e)
        {
            Locale locale = Locale.GetEntity(e.Guild.Id.ToDbLong());

            IPost s = null;

            if (e.arguments.ToLower().StartsWith("use"))
            {
                string[] a = e.arguments.Split(' ');
                e.arguments = e.arguments.Substring(a[0].Length);
                switch (a[0].Split(':')[1].ToLower())
                {
                case "safebooru":
                {
                    s = SafebooruPost.Create(e.arguments, ImageRating.SAFE);
                }
                break;

                case "gelbooru":
                {
                    s = GelbooruPost.Create(e.arguments, ImageRating.SAFE);
                }
                break;

                case "konachan":
                {
                    s = KonachanPost.Create(e.arguments, ImageRating.SAFE);
                }
                break;

                case "e621":
                {
                    s = E621Post.Create(e.arguments, ImageRating.SAFE);
                }
                break;

                default:
                {
                    await e.Channel.SendMessage("I do not support this image host :(");
                }
                break;
                }
            }
            else
            {
                s = SafebooruPost.Create(e.arguments, ImageRating.SAFE);
            }

            if (s == null)
            {
                await e.Channel.SendMessage(Utils.ErrorEmbed(locale, "We couldn't find an image with these tags!"));

                return;
            }

            await e.Channel.SendMessage(s.ImageUrl);
        }
Exemplo n.º 2
0
        public async Task RunGelbooru(EventContext e)
        {
            IPost s = GelbooruPost.Create(e.arguments, ImageRating.EXPLICIT);

            if (s == null)
            {
                await Utils.ErrorEmbed(Locale.GetEntity(e.Channel.Id), "Couldn't find anything with these tags!")
                .SendToChannel(e.Channel);
            }

            await Utils.Embed
            .SetTitle("Gelbooru")
            .SetImageUrl(s.ImageUrl)
            .SendToChannel(e.Channel.Id);
        }