Add Checkem Command
This commit is contained in:
parent
ee4c09e7ea
commit
1295ed6206
7 changed files with 211 additions and 8 deletions
40
Geekbot.net/Lib/CheckEmImageProvider.cs
Normal file
40
Geekbot.net/Lib/CheckEmImageProvider.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Geekbot.net.Lib
|
||||
{
|
||||
public class CheckEmImageProvider : ICheckEmImageProvider
|
||||
{
|
||||
private string[] checkEmImageArray;
|
||||
private int totalCheckEmImages;
|
||||
private Random rnd;
|
||||
|
||||
public CheckEmImageProvider()
|
||||
{
|
||||
var path = Path.GetFullPath("./Storage/checkEmPics");
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var rawCheckEmPics = File.ReadAllText(path);
|
||||
checkEmImageArray = rawCheckEmPics.Split("\n");
|
||||
totalCheckEmImages = checkEmImageArray.Length;
|
||||
rnd = new Random();
|
||||
Console.WriteLine($"- Loaded {totalCheckEmImages} CheckEm Images");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("checkEmPics File not found");
|
||||
Console.WriteLine($"Path should be {path}");
|
||||
}
|
||||
}
|
||||
|
||||
public string GetRandomCheckEmPic()
|
||||
{
|
||||
return checkEmImageArray[rnd.Next(0, totalCheckEmImages)];
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICheckEmImageProvider
|
||||
{
|
||||
string GetRandomCheckEmPic();
|
||||
}
|
||||
}
|
|
@ -6,21 +6,22 @@ using System.Text.RegularExpressions;
|
|||
|
||||
namespace Geekbot.net.Lib
|
||||
{
|
||||
class Fortunes : IFortunes
|
||||
class FortunesProvider : IFortunesProvider
|
||||
{
|
||||
private string[] fortuneArray;
|
||||
private int totalFortunes;
|
||||
private Random rnd;
|
||||
|
||||
public Fortunes()
|
||||
public FortunesProvider()
|
||||
{
|
||||
var path = Path.GetFullPath("./fortunes");
|
||||
var path = Path.GetFullPath("./Storage/fortunes");
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var rawFortunes= File.ReadAllText(path);
|
||||
fortuneArray = rawFortunes.Split("%");
|
||||
totalFortunes = fortuneArray.Length;
|
||||
rnd = new Random();
|
||||
Console.WriteLine($"- Loaded {totalFortunes} Fortunes");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ namespace Geekbot.net.Lib
|
|||
}
|
||||
}
|
||||
|
||||
public interface IFortunes
|
||||
public interface IFortunesProvider
|
||||
{
|
||||
string GetRandomFortune();
|
||||
string GetFortune(int id);
|
38
Geekbot.net/Modules/CheckEm.cs
Normal file
38
Geekbot.net/Modules/CheckEm.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
|
||||
namespace Geekbot.net.Modules
|
||||
{
|
||||
public class CheckEm : ModuleBase
|
||||
{
|
||||
private readonly Random rnd;
|
||||
private readonly ICheckEmImageProvider checkEmImages;
|
||||
public CheckEm(Random RandomClient, ICheckEmImageProvider checkEmImages)
|
||||
{
|
||||
this.rnd = RandomClient;
|
||||
this.checkEmImages = checkEmImages;
|
||||
}
|
||||
[Command("checkem", RunMode = RunMode.Async), Summary("Check for dubs")]
|
||||
public async Task MuhDubs()
|
||||
{
|
||||
try
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"Check em {Context.User.Mention}");
|
||||
sb.AppendLine($"**{rnd.Next(100000, 99999999)}**");
|
||||
sb.AppendLine(checkEmImages.GetRandomCheckEmPic());
|
||||
|
||||
await ReplyAsync(sb.ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,8 +7,8 @@ namespace Geekbot.net.Modules
|
|||
{
|
||||
public class Fortune : ModuleBase
|
||||
{
|
||||
private readonly IFortunes fortunes;
|
||||
public Fortune(IFortunes fortunes)
|
||||
private readonly IFortunesProvider fortunes;
|
||||
public Fortune(IFortunesProvider fortunes)
|
||||
{
|
||||
this.fortunes = fortunes;
|
||||
}
|
||||
|
|
|
@ -68,9 +68,11 @@ namespace Geekbot.net
|
|||
}
|
||||
|
||||
services = new ServiceCollection();
|
||||
var fortunes = new Fortunes();
|
||||
var fortunes = new FortunesProvider();
|
||||
var checkEmImages = new CheckEmImageProvider();
|
||||
var RandomClient = new Random();
|
||||
services.AddSingleton<IFortunes>(fortunes);
|
||||
services.AddSingleton<IFortunesProvider>(fortunes);
|
||||
services.AddSingleton<ICheckEmImageProvider>(checkEmImages);
|
||||
services.AddSingleton(RandomClient);
|
||||
services.AddSingleton(redis);
|
||||
|
||||
|
|
122
Geekbot.net/Storage/checkEmPics
Normal file
122
Geekbot.net/Storage/checkEmPics
Normal file
|
@ -0,0 +1,122 @@
|
|||
http://s19.postimg.org/pcq2kwzoj/4cb.png
|
||||
http://s19.postimg.org/cvetk0f4z/5_Dim_Dy6p.jpg
|
||||
http://s19.postimg.org/5hzfl1v37/1310151998600.jpg
|
||||
http://s19.postimg.org/53y3lgazn/1324181141954.jpg
|
||||
http://s19.postimg.org/724rjg3hf/1392512742365.png
|
||||
http://s19.postimg.org/3rgejkdk3/1393501296733.png
|
||||
http://s19.postimg.org/a6ffg8k9v/1401667341503.jpg
|
||||
http://s19.postimg.org/qiph5yylf/1419231572452.jpg
|
||||
http://s19.postimg.org/fqwi4m8ir/1427600681401.png
|
||||
http://s19.postimg.org/4c00zzw6b/1447813628974.png
|
||||
http://s19.postimg.org/uuio8puw3/b5_3q_ycaaavxtf.jpg
|
||||
http://s19.postimg.org/bghu913fn/check_em_by_boyboy99100_d57xp3y.png
|
||||
http://s19.postimg.org/s1pgooujn/l_Hkppjs.jpg
|
||||
http://s19.postimg.org/m08itft0j/checkem.jpg
|
||||
https://old.postimg.org/image/6vx33rb1b/
|
||||
https://old.postimg.org/image/wxiaz1mov/
|
||||
https://old.postimg.org/image/azqfizx27/
|
||||
https://old.postimg.org/image/6iy2kbiu7/
|
||||
https://old.postimg.org/image/k8slt45y7/
|
||||
https://old.postimg.org/image/t7ruxmplr/
|
||||
https://old.postimg.org/image/ssbzqvean/
|
||||
https://old.postimg.org/image/kbchfy9lr/
|
||||
https://old.postimg.org/image/dl0lk9btr/
|
||||
https://old.postimg.org/image/e5k80oufz/
|
||||
https://old.postimg.org/image/er005baqn/
|
||||
https://old.postimg.org/image/bfk2uzcin/
|
||||
https://old.postimg.org/image/556fp0jkv/
|
||||
https://old.postimg.org/image/i0efbryu7/
|
||||
https://old.postimg.org/image/943n7u87z/
|
||||
https://old.postimg.org/image/xn5op5cm7/
|
||||
https://old.postimg.org/image/3l5p4d0kf/
|
||||
https://old.postimg.org/image/5boq5ui3j/
|
||||
https://old.postimg.org/image/ru082bqcf/
|
||||
https://old.postimg.org/image/ytea1oqan/
|
||||
https://old.postimg.org/image/vu7dekgtb/
|
||||
https://old.postimg.org/image/hl7qwi2an/
|
||||
https://old.postimg.org/image/5aescfg9r/
|
||||
https://old.postimg.org/image/9gzmrrfvj/
|
||||
https://old.postimg.org/image/50bv6tr1b/
|
||||
https://old.postimg.org/image/afkl7silb/
|
||||
https://old.postimg.org/image/nrdsgzllr/
|
||||
https://old.postimg.org/image/s32e5zsin/
|
||||
https://old.postimg.org/image/5sej60v8f/
|
||||
https://old.postimg.org/image/lgfqctau7/
|
||||
https://old.postimg.org/image/tn7q4e0wv/
|
||||
https://old.postimg.org/image/8612arz1b/
|
||||
https://old.postimg.org/image/w5tf52mn3/
|
||||
https://old.postimg.org/image/zdxwi48wv/
|
||||
https://old.postimg.org/image/lphwghd0f/
|
||||
https://old.postimg.org/image/uzu0k0nq7/
|
||||
https://old.postimg.org/image/3vqzsxjbz/
|
||||
https://old.postimg.org/image/5d7uqqyov/
|
||||
https://old.postimg.org/image/dntnyku8v/
|
||||
https://old.postimg.org/image/dsxf891jz/
|
||||
https://old.postimg.org/image/3nyrioizj/
|
||||
https://old.postimg.org/image/6zx2bzaqn/
|
||||
https://old.postimg.org/image/wu6v1raqn/
|
||||
https://old.postimg.org/image/hb9f4n2fz/
|
||||
https://old.postimg.org/image/p7yhqm3a7/
|
||||
https://old.postimg.org/image/oelvxzx9b/
|
||||
https://old.postimg.org/image/vcq03xvdr/
|
||||
https://old.postimg.org/image/b08t1yqlb/
|
||||
https://old.postimg.org/image/6yrpwayan/
|
||||
https://old.postimg.org/image/btleukwm7/
|
||||
https://old.postimg.org/image/62ztuldzz/
|
||||
https://old.postimg.org/image/w3iq9pxr3/
|
||||
https://old.postimg.org/image/byp6493xb/
|
||||
https://old.postimg.org/image/xp2lf9xcv/
|
||||
https://old.postimg.org/image/j9p9u49pb/
|
||||
https://old.postimg.org/image/hvxmytafz/
|
||||
https://old.postimg.org/image/5eqzbnfa7/
|
||||
https://old.postimg.org/image/do2uq290f/
|
||||
https://old.postimg.org/image/54o261q1r/
|
||||
https://old.postimg.org/image/94qm4jr4v/
|
||||
https://old.postimg.org/image/lee88y0pr/
|
||||
https://old.postimg.org/image/bncb58cv3/
|
||||
https://old.postimg.org/image/5246j7me7/
|
||||
https://old.postimg.org/image/4uby8ym1r/
|
||||
https://old.postimg.org/image/qn996tj4v/
|
||||
https://old.postimg.org/image/c1dn4twyn/
|
||||
https://old.postimg.org/image/6rd9ra23j/
|
||||
https://lehcark14.files.wordpress.com/2008/08/botan16.jpg
|
||||
http://i.imgur.com/p9vALew.jpg
|
||||
http://i.imgur.com/4a9l2Rm.png
|
||||
http://i.imgur.com/RNtixMQ.jpg
|
||||
https://pbs.twimg.com/media/Cro9aIGUEAAkXCP.jpg
|
||||
http://s16.postimg.org/empvloimd/Check_em_Guts.png
|
||||
https://s18.postimg.io/qgbhe7u09/1424491645996.gif
|
||||
http://s19.postimg.org/hhemlt7xf/3eb.jpg
|
||||
http://s19.postimg.org/cwsg6vo83/8aa.png
|
||||
http://s19.postimg.org/rh9j1pj6r/28mohl4.png
|
||||
http://s19.postimg.org/zba4n3qzn/86d.jpg
|
||||
http://s19.postimg.org/cb3hart5v/2016_09_16_08_58_45.png
|
||||
http://s19.postimg.org/m9ofx92lf/bb1.jpg
|
||||
http://s19.postimg.org/maydqo4f7/e8b.jpg
|
||||
http://s19.postimg.org/yqzoy5n4z/fbe.png
|
||||
http://s19.postimg.org/xd822unvn/giphy.gif
|
||||
http://s19.postimg.org/c4udlf9er/l_TU3eup.jpg
|
||||
https://66.media.tumblr.com/cc893a0ee40d73d083da3df4bdaf45cc/tumblr_mx8psiFduG1t1g1k8o1_500.gif
|
||||
http://i.imgur.com/swbXHSy.gif
|
||||
http://img1.reactor.cc/pics/post/full/Anime-Touhou-Project-Yakumo-Yukari-%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D1%8F-1303807.jpeg
|
||||
http://i.imgur.com/ftGLHE0.png
|
||||
http://i.imgur.com/JELDhKQ.png
|
||||
http://imgur.com/yBJound
|
||||
http://i.imgur.com/f7gAVPJ.png
|
||||
http://i.imgur.com/HxWyo2Z.jpg
|
||||
http://i.imgur.com/8Eb9CxQ.png
|
||||
http://i.imgur.com/kOECcjz.png
|
||||
http://i.imgur.com/MJLu7oJ.jpg
|
||||
http://i.imgur.com/itG3rPM.jpg
|
||||
http://i.imgur.com/G83Go9t.jpg
|
||||
http://i.imgur.com/jI2dBnU.jpg
|
||||
http://i.imgur.com/FtALzg0.jpg
|
||||
http://i.imgur.com/GwZpJEv.gif
|
||||
http://i.imgur.com/TYGRD3B.gif
|
||||
http://i.imgur.com/P6TxLS3.png
|
||||
http://i.imgur.com/phTVTdn.jpg
|
||||
http://i.imgur.com/thhR6UE.jpg
|
||||
http://i.imgur.com/KbROufx.jpg
|
||||
http://i.imgur.com/sQqWbcm.jpg
|
||||
http://i.imgur.com/YYpis53.png
|
||||
http://i.imgur.com/kwaRd54.gif
|
Loading…
Reference in a new issue