2018-01-18 22:51:29 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Discord;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using Geekbot.net.Lib;
|
2018-05-03 00:56:06 +02:00
|
|
|
|
using Geekbot.net.Lib.ErrorHandling;
|
2018-01-19 23:46:11 +01:00
|
|
|
|
using StackExchange.Redis;
|
|
|
|
|
|
2018-05-03 00:56:06 +02:00
|
|
|
|
namespace Geekbot.net.Commands.Randomness
|
2018-01-18 22:51:29 +01:00
|
|
|
|
{
|
|
|
|
|
public class Slap : ModuleBase
|
|
|
|
|
{
|
|
|
|
|
private readonly IErrorHandler _errorHandler;
|
2018-01-19 23:46:11 +01:00
|
|
|
|
private readonly IDatabase _redis;
|
2018-01-18 22:51:29 +01:00
|
|
|
|
|
2018-02-14 23:01:28 +01:00
|
|
|
|
public Slap(IErrorHandler errorHandler, IDatabase redis)
|
2018-01-18 22:51:29 +01:00
|
|
|
|
{
|
|
|
|
|
_errorHandler = errorHandler;
|
2018-01-19 23:46:11 +01:00
|
|
|
|
_redis = redis;
|
2018-01-18 22:51:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Command("slap", RunMode = RunMode.Async)]
|
|
|
|
|
[Remarks(CommandCategories.Fun)]
|
|
|
|
|
[Summary("slap someone")]
|
|
|
|
|
public async Task Slapper([Summary("@user")] IUser user)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-01-19 23:46:11 +01:00
|
|
|
|
if (user.Id == Context.User.Id)
|
|
|
|
|
{
|
|
|
|
|
await ReplyAsync("Why would you slap yourself?");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-30 23:44:19 +02:00
|
|
|
|
var things = new List<string>
|
2018-01-18 22:51:29 +01:00
|
|
|
|
{
|
|
|
|
|
"thing",
|
2018-01-19 23:46:11 +01:00
|
|
|
|
"rubber chicken",
|
2018-01-18 22:51:29 +01:00
|
|
|
|
"leek stick",
|
|
|
|
|
"large trout",
|
|
|
|
|
"flat hand",
|
|
|
|
|
"strip of bacon",
|
|
|
|
|
"feather",
|
2018-01-18 23:40:38 +01:00
|
|
|
|
"piece of pizza",
|
|
|
|
|
"moldy banana",
|
|
|
|
|
"sharp retort",
|
|
|
|
|
"printed version of wikipedia",
|
|
|
|
|
"panda paw",
|
|
|
|
|
"spiked sledgehammer",
|
|
|
|
|
"monstertruck",
|
|
|
|
|
"dirty toilet brush",
|
|
|
|
|
"sleeping seagull",
|
2018-01-19 23:46:11 +01:00
|
|
|
|
"sunflower",
|
|
|
|
|
"mousepad",
|
|
|
|
|
"lolipop",
|
2018-02-16 08:36:26 +01:00
|
|
|
|
"bottle of rum",
|
|
|
|
|
"cheese slice",
|
|
|
|
|
"critical 1",
|
|
|
|
|
"natural 20",
|
|
|
|
|
"mjölnir (aka mewmew)",
|
|
|
|
|
"kamehameha",
|
|
|
|
|
"copy of Twilight",
|
|
|
|
|
"med pack (get ready for the end boss)",
|
|
|
|
|
"derp",
|
|
|
|
|
"condom (used)",
|
|
|
|
|
"gremlin fed after midnight",
|
|
|
|
|
"wet baguette",
|
|
|
|
|
"exploding kitten",
|
|
|
|
|
"shiny piece of shit",
|
|
|
|
|
"mismatched pair of socks",
|
|
|
|
|
"horcrux",
|
|
|
|
|
"tuna",
|
|
|
|
|
"suggestion",
|
|
|
|
|
"teapot",
|
|
|
|
|
"candle",
|
|
|
|
|
"dictionary",
|
|
|
|
|
"powerless banhammer"
|
2018-01-18 22:51:29 +01:00
|
|
|
|
};
|
2018-01-19 23:46:11 +01:00
|
|
|
|
|
|
|
|
|
_redis.HashIncrement($"{Context.Guild.Id}:SlapsRecieved", user.Id.ToString());
|
|
|
|
|
_redis.HashIncrement($"{Context.Guild.Id}:SlapsGiven", Context.User.Id.ToString());
|
|
|
|
|
|
2018-02-14 23:01:28 +01:00
|
|
|
|
await ReplyAsync($"{Context.User.Username} slapped {user.Username} with a {things[new Random().Next(things.Count - 1)]}");
|
2018-01-18 22:51:29 +01:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
_errorHandler.HandleCommandException(e, Context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|