diff --git a/Geekbot.net/Lib/IClients/CatClient.cs b/Geekbot.net/Lib/IClients/CatClient.cs index 2e606ed..7a7e8c6 100644 --- a/Geekbot.net/Lib/IClients/CatClient.cs +++ b/Geekbot.net/Lib/IClients/CatClient.cs @@ -1,6 +1,6 @@ using RestSharp; -namespace Geekbot.net.Modules +namespace Geekbot.net.Lib.IClients { public interface ICatClient { diff --git a/Geekbot.net/Lib/IClients/DogClient.cs b/Geekbot.net/Lib/IClients/DogClient.cs new file mode 100644 index 0000000..20feed1 --- /dev/null +++ b/Geekbot.net/Lib/IClients/DogClient.cs @@ -0,0 +1,19 @@ +using RestSharp; + +namespace Geekbot.net.Lib.IClients +{ + public interface IDogClient + { + IRestClient Client { get; set; } + } + + public class DogClient : IDogClient + { + public DogClient() + { + Client = new RestClient("http://random.dog"); + } + + public IRestClient Client { get; set; } + } +} \ No newline at end of file diff --git a/Geekbot.net/Lib/IClients/RedisClient.cs b/Geekbot.net/Lib/IClients/RedisClient.cs index b05e5ad..7fc890f 100644 --- a/Geekbot.net/Lib/IClients/RedisClient.cs +++ b/Geekbot.net/Lib/IClients/RedisClient.cs @@ -1,7 +1,7 @@ using System; using StackExchange.Redis; -namespace Geekbot.net.Lib +namespace Geekbot.net.Lib.IClients { public interface IRedisClient { diff --git a/Geekbot.net/Lib/StatsRecorder.cs b/Geekbot.net/Lib/StatsRecorder.cs index 3a38f73..8a17ff1 100644 --- a/Geekbot.net/Lib/StatsRecorder.cs +++ b/Geekbot.net/Lib/StatsRecorder.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Discord.WebSocket; +using Geekbot.net.Lib.IClients; using StackExchange.Redis; namespace Geekbot.net.Lib diff --git a/Geekbot.net/Modules/AdminCmd.cs b/Geekbot.net/Modules/AdminCmd.cs index fe88610..b6732af 100644 --- a/Geekbot.net/Modules/AdminCmd.cs +++ b/Geekbot.net/Modules/AdminCmd.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; using Discord.Commands; -using Geekbot.net.Lib; +using Geekbot.net.Lib.IClients; namespace Geekbot.net.Modules { diff --git a/Geekbot.net/Modules/Cat.cs b/Geekbot.net/Modules/Cat.cs index 5ca9017..0250e0a 100644 --- a/Geekbot.net/Modules/Cat.cs +++ b/Geekbot.net/Modules/Cat.cs @@ -1,6 +1,6 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; using Discord.Commands; +using Geekbot.net.Lib.IClients; using RestSharp; namespace Geekbot.net.Modules diff --git a/Geekbot.net/Modules/Counters.cs b/Geekbot.net/Modules/Counters.cs index e037b35..de535f4 100644 --- a/Geekbot.net/Modules/Counters.cs +++ b/Geekbot.net/Modules/Counters.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Discord; using Discord.Commands; -using Geekbot.net.Lib; +using Geekbot.net.Lib.IClients; namespace Geekbot.net.Modules { diff --git a/Geekbot.net/Modules/Dog.cs b/Geekbot.net/Modules/Dog.cs new file mode 100644 index 0000000..6e98d90 --- /dev/null +++ b/Geekbot.net/Modules/Dog.cs @@ -0,0 +1,25 @@ +using System.Threading.Tasks; +using Discord.Commands; +using Geekbot.net.Lib.IClients; +using RestSharp; + +namespace Geekbot.net.Modules +{ + public class Dog : ModuleBase + { + private readonly IDogClient dogClient; + public Dog(IDogClient dogClient) + { + this.dogClient = dogClient; + } + + [Command("dog", RunMode = RunMode.Async), Summary("Return a random image of a dog.")] + public async Task Say() + { + var request = new RestRequest("woof.json", Method.GET); + + dynamic response = dogClient.Client.Execute(request); + await ReplyAsync(response.Data["url"]); + } + } +} \ No newline at end of file diff --git a/Geekbot.net/Modules/GuildInfo.cs b/Geekbot.net/Modules/GuildInfo.cs index 950868f..9a03373 100644 --- a/Geekbot.net/Modules/GuildInfo.cs +++ b/Geekbot.net/Modules/GuildInfo.cs @@ -4,6 +4,7 @@ using Discord.Commands; using Discord; using Geekbot.net.Lib; using System.Linq; +using Geekbot.net.Lib.IClients; namespace Geekbot.net.Modules { diff --git a/Geekbot.net/Modules/Info.cs b/Geekbot.net/Modules/Info.cs index 49c4af2..a31fec9 100644 --- a/Geekbot.net/Modules/Info.cs +++ b/Geekbot.net/Modules/Info.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; +using System.Threading.Tasks; using Discord; using Discord.Commands; -using Geekbot.net.Lib; +using Geekbot.net.Lib.IClients; namespace Geekbot.net.Modules { diff --git a/Geekbot.net/Modules/UserInfo.cs b/Geekbot.net/Modules/UserInfo.cs index 7eeb4cb..728fb50 100644 --- a/Geekbot.net/Modules/UserInfo.cs +++ b/Geekbot.net/Modules/UserInfo.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Discord; using Discord.Commands; using Geekbot.net.Lib; +using Geekbot.net.Lib.IClients; namespace Geekbot.net.Modules { diff --git a/Geekbot.net/Modules/Youtube.cs b/Geekbot.net/Modules/Youtube.cs index b06fbdc..723ea9a 100644 --- a/Geekbot.net/Modules/Youtube.cs +++ b/Geekbot.net/Modules/Youtube.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; using Discord.Commands; -using Geekbot.net.Lib; +using Geekbot.net.Lib.IClients; using Google.Apis.Services; using Google.Apis.YouTube.v3; diff --git a/Geekbot.net/Program.cs b/Geekbot.net/Program.cs index d66c62b..cc33b50 100755 --- a/Geekbot.net/Program.cs +++ b/Geekbot.net/Program.cs @@ -54,6 +54,7 @@ namespace Geekbot.net map = new DependencyMap(); map.Add(new CatClient()); + map.Add(new DogClient()); map.Add(redis); map.Add(new RandomClient());