-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPart.cs
44 lines (36 loc) · 906 Bytes
/
Part.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
using MikuBot.Commands;
using MikuBot.Modules;
namespace MikuBot.ExtraPlugins
{
public class Part : MsgCommandModuleBase
{
public override string CommandDescription
{
get { return "Makes the bot leave a channel."; }
}
public override string UsageHelp
{
get { return "part [<channel>]"; }
}
public override void HandleCommand(MsgCommand msg, IBotContext bot)
{
if (!CheckCall(msg, bot))
return;
if (msg.BotCommand.Params.Count == 0 && !msg.ReceiverIsChannel)
{
bot.Writer.Msg(msg.ChannelOrSenderNick, "Channel must be specified");
return;
}
var channel = msg.BotCommand.Params.Count > 0 ? new IrcName(msg.BotCommand.Params[0]) : msg.Receiver;
bot.ChannelManager.Part(channel);
}
public override BotUserLevel MinUserLevel
{
get { return BotUserLevel.Manager; }
}
public override string Name
{
get { return "Part"; }
}
}
}