Add !slap
This commit is contained in:
parent
0adb4b99f2
commit
2db4db2451
1 changed files with 46 additions and 0 deletions
46
Geekbot.net/Commands/Slap.cs
Normal file
46
Geekbot.net/Commands/Slap.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
namespace Geekbot.net.Commands
|
||||
{
|
||||
public class Slap : ModuleBase
|
||||
{
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly Random _random;
|
||||
|
||||
public Slap(IErrorHandler errorHandler, Random random)
|
||||
{
|
||||
_errorHandler = errorHandler;
|
||||
_random = random;
|
||||
}
|
||||
|
||||
[Command("slap", RunMode = RunMode.Async)]
|
||||
[Remarks(CommandCategories.Fun)]
|
||||
[Summary("slap someone")]
|
||||
public async Task Slapper([Summary("@user")] IUser user)
|
||||
{
|
||||
try
|
||||
{
|
||||
var things = new List<string>()
|
||||
{
|
||||
"thing",
|
||||
"rubber duck",
|
||||
"leek stick",
|
||||
"large trout",
|
||||
"flat hand",
|
||||
"strip of bacon",
|
||||
"feather",
|
||||
"piece of pizza"
|
||||
};
|
||||
await ReplyAsync($"{Context.User.Username} slapped {user.Username} with a {things[_random.Next(things.Count - 1)]}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_errorHandler.HandleCommandException(e, Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue