NadekoBot/NadekoBot.Modules.Searches/PlaceCommands.cs

82 lines
2.8 KiB
C#
Raw Normal View History

2016-12-17 00:16:14 +00:00
using Discord.Commands;
2016-12-09 03:22:23 +00:00
using NadekoBot.Extensions;
using System;
using System.Threading.Tasks;
2017-07-17 19:42:36 +00:00
using NadekoBot.Common;
using NadekoBot.Common.Attributes;
namespace NadekoBot.Modules.Searches
{
public partial class Searches
{
[Group]
2017-02-24 16:10:44 +00:00
public class PlaceCommands : NadekoSubmodule
{
2017-02-24 16:10:44 +00:00
private static string typesStr { get; } = string.Join(", ", Enum.GetNames(typeof(PlaceType)));
public enum PlaceType
{
Cage, //http://www.placecage.com
Steven, //http://www.stevensegallery.com
Beard, //http://placebeard.it
Fill, //http://www.fillmurray.com
Bear, //https://www.placebear.com
Kitten, //http://placekitten.com
Bacon, //http://baconmockup.com
Xoart, //http://xoart.link
}
[NadekoCommand, Usage, Description, Aliases]
2016-12-16 18:43:57 +00:00
public async Task Placelist()
{
await Context.Channel.SendConfirmAsync(GetText("list_of_place_tags", Prefix),
2017-02-24 16:10:44 +00:00
typesStr)
.ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
2016-12-17 00:16:14 +00:00
public async Task Place(PlaceType placeType, uint width = 0, uint height = 0)
{
2017-02-24 16:10:44 +00:00
var url = "";
switch (placeType)
{
case PlaceType.Cage:
url = "http://www.placecage.com";
break;
case PlaceType.Steven:
url = "http://www.stevensegallery.com";
break;
case PlaceType.Beard:
url = "http://placebeard.it";
break;
case PlaceType.Fill:
url = "http://www.fillmurray.com";
break;
case PlaceType.Bear:
url = "https://www.placebear.com";
break;
case PlaceType.Kitten:
url = "http://placekitten.com";
break;
case PlaceType.Bacon:
url = "http://baconmockup.com";
break;
case PlaceType.Xoart:
url = "http://xoart.link";
break;
}
var rng = new NadekoRandom();
if (width <= 0 || width > 1000)
width = (uint)rng.Next(250, 850);
if (height <= 0 || height > 1000)
height = (uint)rng.Next(250, 850);
url += $"/{width}/{height}";
2016-12-16 18:43:57 +00:00
await Context.Channel.SendMessageAsync(url).ConfigureAwait(false);
}
}
}
}