-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathYesNo.cs
60 lines (48 loc) · 1.3 KB
/
YesNo.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
using System;
using System.Collections.Specialized;
using MikuBot.Commands;
using MikuBot.Modules;
namespace MikuBot.ExtraPlugins
{
public class YesNo : MsgCommandModuleBase
{
private readonly StringCollection positive = new StringCollection {
"Yes", "Definitely", "Affirmative", "Most certainly", "Yeah, sure"
};
private readonly StringCollection negative = new StringCollection {
"No", "Nope", "Definitely not", "Negative", "I don't think so"
};
public override void HandleCommand(MsgCommand msg, IBotContext bot)
{
if (!CheckCall(msg, bot))
return;
var reply = msg.Reply(bot.Writer);
if (msg.ParamCollection.Count < 1 || !msg.BotCommand.CommandString.EndsWith("?"))
{
reply.Msg("Please ask a question!");
return;
}
reply.Msg(new Random().Next(2) == 0 ? BotHelper.ChooseRandom(positive) : BotHelper.ChooseRandom(negative));
}
public override string CommandDescription
{
get { return "Responds to a question with either a positive or negative answer."; }
}
public override int CooldownChannelMs
{
get { return 3000; }
}
public override int CooldownUserMs
{
get { return 10000; }
}
public override string Name
{
get { return "YesNo"; }
}
public override string UsageHelp
{
get { return "yesno <question>"; }
}
}
}