1
0
Fork 0
vrobot3 is a chat bot for IRC and Discord.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.2 KiB

6 years ago
//-----------------------------------------------------------------------------
//
// Copyright © 2016 Project Golan
//
// See "LICENSE" for more information.
//
//-----------------------------------------------------------------------------
//
// Admin commands module.
// %kill, %msg, %action
//
//-----------------------------------------------------------------------------
using System;
using System.Linq;
namespace ProjectGolan.Vrobot3.Modules
{
//
// Mod_Admin
//
public class Mod_Admin : IBotModule
{
//
// Mod_Admin constructor
//
6 years ago
public Mod_Admin(Bot bot) :
base(bot)
6 years ago
{
commands["kill"] = new BotCommandStructure{
cmd = cmdKill,
flags = BotCommandFlags.AdminOnly,
help = "Kills all bot instances.\n" +
"Syntax: %kill"
};
commands["msg"] = new BotCommandStructure{
cmd = cmdMsg,
flags = BotCommandFlags.AdminOnly,
help = "Sends a message.\n" +
"Syntax: %msg channel, msg\n" +
"Example: %msg #general, ur all dumb"
};
commands["action"] = new BotCommandStructure{
cmd = cmdAction,
flags = BotCommandFlags.AdminOnly,
help = "Sends an action.\n" +
"Syntax: %action channel, msg\n" +
"Example: %action #general, explodes violently"
};
}
//
// cmdKill
//
public void cmdKill(User usr, Channel channel, String msg)
{
Console.WriteLine("{0}: Killing all instances.", bot.info.serverName);
Program.Instance.end();
}
//
// cmdMsg
//
public void cmdMsg(User usr, Channel channel, String msg)
{
6 years ago
var args = Utils.GetArguments(msg, commands["msg"].help, 2, 2);
6 years ago
bot.message(ulong.Parse(args[0]), args[1].Trim());
}
//
// cmdAction
//
public void cmdAction(User usr, Channel channel, String msg)
{
6 years ago
var args = Utils.GetArguments(msg, commands["action"].help, 2, 2);
6 years ago
bot.action(ulong.Parse(args[0]), args[1].Trim());
}
}
}