-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGive.cs
66 lines (53 loc) · 1.29 KB
/
Give.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System.Linq;
using MikuBot.Commands;
using MikuBot.Modules;
namespace MikuBot.ExtraPlugins
{
public class Give : MsgCommandModuleBase
{
private readonly string[] reflectList = new[] {
"stab", "concussion", "laceration", "injury", "bash", "knife", "bruise"
};
public override int BotCommandParamCount
{
get { return 2; }
}
public override int CooldownChannelMs
{
get { return 5000; }
}
public override int CooldownUserMs
{
get { return 60000; }
}
public override string CommandDescription
{
get { return "Give a present!"; }
}
/*
public override BotUserLevel MinUserLevel {
get { return BotUserLevel.Identified; }
}*/
public override string Name
{
get { return "Give"; }
}
public override string UsageHelp
{
get { return "give <whom> <something>"; }
}
public override void HandleCommand(MsgCommand chat, IBotContext bot)
{
if (!CheckCall(chat, bot))
return;
var cmdParser = new CmdReader(chat.Text);
cmdParser.ReadNext();
var target = cmdParser.ReadNext();
var commandWord = cmdParser.ReadToEnd();
if (reflectList.Any(commandWord.Contains))
target = chat.Sender.Nick.ToString();
var reply = chat.Reply(bot.Writer);
reply.Action(string.Format("gives {0} {1}", target, commandWord));
}
}
}