Browse Source

Added Command parsing to main Bot class.

Added command passing and access restriction to modules.
Renamed send commands to be friendlier.
tags/3.0.0
Teknikode 4 years ago
parent
commit
4fcff398e1

+ 13
- 0
Combot/AccessType.cs View File

@@ -0,0 +1,13 @@
namespace Combot
{
public enum AccessType
{
User,
Voice,
HalfOperator,
Operator,
SuperOperator,
Founder,
Owner
}
}

+ 37
- 10
Combot/Bot.cs View File

@@ -20,6 +20,7 @@ namespace Combot
public ServerConfig ServerConfig;
public IRC IRC;
public bool Connected = false;
public static Dictionary<PrivilegeMode, AccessType> AccessTypeMapping = new Dictionary<PrivilegeMode, AccessType>() { { PrivilegeMode.v, AccessType.Voice }, { PrivilegeMode.h, AccessType.HalfOperator }, { PrivilegeMode.o, AccessType.Operator }, { PrivilegeMode.a, AccessType.SuperOperator }, { PrivilegeMode.q, AccessType.Founder } };

private List<Module> _Modules;

@@ -115,7 +116,7 @@ namespace Combot
{
foreach (ChannelConfig channel in ServerConfig.Channels)
{
IRC.IRCSendJoin(channel.Name, channel.Key);
IRC.SendJoin(channel.Name, channel.Key);
}
}
}
@@ -126,14 +127,31 @@ namespace Combot
// The message was a command
if (e.Message.StartsWith(ServerConfig.CommandPrefix))
{
string[] msgArgs = e.Message.Split(new char[] {' '}, 2, StringSplitOptions.RemoveEmptyEntries);
string command = msgArgs[0].Remove(0, ServerConfig.CommandPrefix.Length);
List<string> argsOnly = msgArgs.ToList();
argsOnly.RemoveAt(0);
if (_Modules.Exists(module => module.Commands.Exists(cmd => cmd.Triggers.Contains(command)) && module.Loaded))
if (!ServerConfig.ChannelBlacklist.Contains(e.Channel)
&& !ServerConfig.NickBlacklist.Contains(e.Sender.Nickname)
)
{
ParseCommandMessage(e.TimeStamp, e.Message, e.Sender, e.Channel, LocationType.Channel);
}
}
}

private void ParseCommandMessage(DateTime timestamp, string message, Nick sender, string location, LocationType locationType)
{
// Extract command and arguments
string[] msgArgs = message.Split(new[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
string command = msgArgs[0].Remove(0, ServerConfig.CommandPrefix.Length);
List<string> argsOnly = msgArgs.ToList();
argsOnly.RemoveAt(0);

Module module = _Modules.Find(mod => mod.Commands.Exists(c => c.Triggers.Contains(command)) && mod.Loaded);
if (module != null)
{
Command cmd = module.Commands.Find(c => c.Triggers.Contains(command));
if (cmd != null)
{
CommandMessage newCommand = new CommandMessage();
newCommand.Nick.Copy(e.Sender);
newCommand.Nick.Copy(sender);
IRC.Channels.ForEach(channel => channel.Nicks.ForEach(nick =>
{
if (nick.Nickname == newCommand.Nick.Nickname)
@@ -141,10 +159,19 @@ namespace Combot
newCommand.Nick.AddPrivileges(nick.Privileges);
}
}));
newCommand.TimeStamp = e.TimeStamp;
newCommand.ModuleName =_Modules.Find(module => module.Commands.Exists(cmd => cmd.Triggers.Contains(command)) && module.Loaded).Name;
newCommand.TimeStamp = timestamp;
newCommand.Location = location;
newCommand.LocationType = locationType;
newCommand.Command = command;
newCommand.Arguments.AddRange(argsOnly);
if (argsOnly.Count > 0)
{
string[] argSplit = argsOnly.First()
.Split(new[] {' '}, cmd.Arguments.Count + 1, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < cmd.Arguments.Count; i++)
{
newCommand.Arguments.Add(argSplit[i]);
}
}

if (CommandReceivedEvent != null)
{

+ 2
- 1
Combot/Combot.csproj View File

@@ -11,6 +11,7 @@
<AssemblyName>Combot</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -23,7 +24,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@@ -58,6 +58,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AccessType.cs" />
<Compile Include="Bot.cs" />
<Compile Include="Modules\Command.cs" />
<Compile Include="Configurations\ChannelConfig.cs" />

+ 3
- 34
Combot/Configurations/ChannelConfig.cs View File

@@ -8,44 +8,13 @@ namespace Combot.Configurations
{
public class ChannelConfig
{
public string Name { get; set; }
public string Key { get; set; }

public ChannelConfig()
{
Name = string.Empty;
Key = string.Empty;
}

private string _Name;
public string Name
{
get
{
return _Name;
}

set
{
if (_Name != value)
{
_Name = value;
}
}
}

private string _Key;
public string Key
{
get
{
return _Key;
}

set
{
if (_Key != value)
{
_Key = value;
}
}
}
}
}

+ 16
- 153
Combot/Configurations/ServerConfig.cs View File

@@ -11,6 +11,18 @@ namespace Combot.Configurations
public class ServerConfig
{
public event Action ModifyEvent;
public string Name { get; set; }
public bool AutoConnect { get; set; }
public string CommandPrefix { get; set; }
public string Nickname { get; set; }
public string Realname { get; set; }
public string Username { get; set; }
public List<string> Owners { get; set; }
public List<string> ChannelBlacklist { get; set; }
public List<string> NickBlacklist { get; set; }
public List<HostConfig> Hosts { get; set; }
public List<ChannelConfig> Channels { get; set; }
public List<Module> Modules { get; set; }

public ServerConfig()
{
@@ -19,8 +31,12 @@ namespace Combot.Configurations

public void SetDefaults()
{
Name = string.Empty;
AutoConnect = false;
CommandPrefix = string.Empty;
Owners = new List<string>();
ChannelBlacklist = new List<string>();
NickBlacklist = new List<string>();
Channels = new List<ChannelConfig>();
Modules = new List<Module>();
Hosts = new List<HostConfig>();
@@ -36,158 +52,5 @@ namespace Combot.Configurations
ModifyEvent();
}
}

private string _Name;
public string Name
{
get
{
return _Name;
}

set
{
if (_Name != value)
{
_Name = value;
}
}
}

private string _Nickname;
public string Nickname
{
get
{
return _Nickname;
}

set
{
if (_Nickname != value)
{
_Nickname = value;
}
}
}

private string _Username;
public string Username
{
get
{
return _Username;
}

set
{
if (_Username != value)
{
_Username = value;
}
}
}

private string _Realname;
public string Realname
{
get
{
return _Realname;
}

set
{
if (_Realname != value)
{
_Realname = value;
}
}
}

private string _CommandPrefix;
public string CommandPrefix
{
get
{
return _CommandPrefix;
}

set
{
if (_CommandPrefix != value)
{
_CommandPrefix = value;
}
}
}

private bool _AutoConnect;
public bool AutoConnect
{
get
{
return _AutoConnect;
}

set
{
if (_AutoConnect != value)
{
_AutoConnect = value;
}
}
}

private List<HostConfig> _Hosts;
public List<HostConfig> Hosts
{
get
{
return _Hosts;
}

set
{
if (_Hosts != value)
{
_Hosts = value;
}
}
}

private List<ChannelConfig> _Channels;
public List<ChannelConfig> Channels
{
get
{
return _Channels;
}

set
{
if (_Channels != value)
{
_Channels = value;
}
}
}

private List<Module> _Modules;
public List<Module> Modules
{
get
{
return _Modules;
}

set
{
if (_Modules != value)
{
_Modules = value;
}
}
}
}
}

+ 8
- 1
Combot/Modules/Command.cs View File

@@ -6,10 +6,11 @@ namespace Combot.Modules
{
public string Name { get; set; }
public string Description { get; set; }
public List<string> Triggers { get; set; }
public List<string> ChannelBlacklist { get; set; }
public List<string> NickBlacklist { get; set; }
public List<string> Triggers { get; set; }
public List<CommandArgument> Arguments { get; set; }
public List<AccessType> AllowedAccess { get; set; }
public bool ShowHelp { get; set; }
public bool SpamCheck { get; set; }

@@ -31,6 +32,7 @@ namespace Combot.Modules
ChannelBlacklist = new List<string>();
NickBlacklist = new List<string>();
Arguments = new List<CommandArgument>();
AllowedAccess = new List<AccessType>();
ShowHelp = true;
SpamCheck = true;
}
@@ -61,6 +63,11 @@ namespace Combot.Modules
newArg.Copy(arg);
Arguments.Add(newArg);
}
AllowedAccess = new List<AccessType>();
foreach (AccessType accessType in command.AllowedAccess)
{
AllowedAccess.Add(accessType);
}
ShowHelp = command.ShowHelp;
SpamCheck = command.SpamCheck;
}

+ 11
- 2
Combot/Modules/CommandMessage.cs View File

@@ -6,19 +6,28 @@ namespace Combot.Modules
{
public class CommandMessage
{
public string Location { get; set; }
public LocationType LocationType { get; set; }
public Nick Nick { get; set; }
public DateTime TimeStamp { get; set; }
public string ModuleName { get; set; }
public string Command { get; set; }
public List<string> Arguments { get; set; }

public CommandMessage()
{
Location = string.Empty;
LocationType = LocationType.Channel;
Nick = new Nick();
TimeStamp = DateTime.Now;
ModuleName = string.Empty;
Command = string.Empty;
Arguments = new List<string>();
}
}

public enum LocationType
{
Channel,
Query,
Notice
}
}

+ 47
- 1
Combot/Modules/Module.cs View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using Combot.IRCServices;

namespace Combot.Modules
{
@@ -12,6 +13,8 @@ namespace Combot.Modules
public string Name { get; set; }
public string ClassName { get; set; }
public bool Enabled { get; set; }
public List<string> ChannelBlacklist { get; set; }
public List<string> NickBlacklist { get; set; }
public List<Command> Commands { get; set; }
public List<Option> Options { get; set; }

@@ -28,15 +31,48 @@ namespace Combot.Modules
SetDefaults();
}

public void HandleCommandEvent(CommandMessage command)
{
// Check to make sure the command exists, the nick or channel isn't on a blacklist, and the module is loaded.
if (Loaded
&& !ChannelBlacklist.Contains(command.Location)
&& !NickBlacklist.Contains(command.Nick.Nickname)
&& Commands.Exists(c => c.Triggers.Contains(command.Command)
&& !c.ChannelBlacklist.Contains(command.Location)
&& !c.NickBlacklist.Contains(command.Nick.Nickname)
)
)
{
// Figure out access of the nick
Command cmd = Commands.Find(c => c.Triggers.Contains(command.Command));
List<AccessType> nickAccessTypes = new List<AccessType>() { AccessType.User };
foreach (PrivilegeMode privilege in command.Nick.Privileges)
{
nickAccessTypes.Add(Bot.AccessTypeMapping[privilege]);
}
if (Bot.ServerConfig.Owners.Contains(command.Nick.Nickname) && command.Nick.Identified)
{
nickAccessTypes.Add(AccessType.Owner);
}
// If they have the correct access for the command, send it
if (cmd.AllowedAccess.Exists(access => nickAccessTypes.Contains(access)))
{
ParseCommand(command);
}
}
}

virtual public void Initialize() { }

virtual public void HandleCommandEvent(CommandMessage command) { }
virtual public void ParseCommand(CommandMessage command) { }

public void SetDefaults()
{
Name = string.Empty;
ClassName = string.Empty;
Enabled = false;
ChannelBlacklist = new List<string>();
NickBlacklist = new List<string>();
Loaded = false;
Commands = new List<Command>();
Options = new List<Option>();
@@ -47,6 +83,16 @@ namespace Combot.Modules
Name = module.Name;
ClassName = module.ClassName;
Enabled = module.Enabled;
ChannelBlacklist = new List<string>();
foreach (string channel in module.ChannelBlacklist)
{
ChannelBlacklist.Add(channel);
}
NickBlacklist = new List<string>();
foreach (string nick in module.NickBlacklist)
{
NickBlacklist.Add(nick);
}
Commands = new List<Command>();
foreach (Command command in module.Commands)
{

+ 89
- 6
Combot/Modules/ModuleClasses/PingMe.cs View File

@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Combot.IRCServices;
using Combot.IRCServices.Messaging;

@@ -7,23 +9,104 @@ namespace Combot.Modules.ModuleClasses
{
public class PingMe : Module
{
private List<Dictionary<Nick, DateTime>> pingList;
private List<PingItem> pingList;
private ReaderWriterLockSlim listLock;
public override void Initialize()
{
pingList = new List<Dictionary<Nick, DateTime>>();
Bot.IRC.Message.CTCPMessageRecievedEvent += HandlePingResponse;
listLock = new ReaderWriterLockSlim();
pingList = new List<PingItem>();
Bot.IRC.Message.CTCPNoticeRecievedEvent += HandlePingResponse;
Bot.CommandReceivedEvent += HandleCommandEvent;
}

public override void HandleCommandEvent(CommandMessage command)
public override void ParseCommand(CommandMessage command)
{

if (Commands.Find(cmd => cmd.Name == "Ping Me").Triggers.Contains(command.Command))
{
int epoch = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
PingItem tmpItem = new PingItem();
tmpItem.Nick = command.Nick.Nickname;
tmpItem.Location = command.Location;
tmpItem.LocationType = command.LocationType;
tmpItem.Timestamp = DateTime.Now;
listLock.EnterWriteLock();
if (pingList.Exists(item => item.Nick == command.Nick.Nickname))
{
pingList.RemoveAll(item => item.Nick == command.Nick.Nickname);
}
pingList.Add(tmpItem);
listLock.ExitWriteLock();
Bot.IRC.SendCTCP(command.Nick.Nickname, "PING", epoch.ToString());
}
}

private void HandlePingResponse(object sender, CTCPMessage e)
{
if (e.Command == "PING")
{
listLock.EnterReadLock();
PingItem pingItem = pingList.Find(item => item.Nick == e.Sender.Nickname);
listLock.ExitReadLock();
if (pingItem != null)
{
DateTime curTime = DateTime.Now;
DateTime prevTime = pingItem.Timestamp;
TimeSpan difTime = curTime.Subtract(prevTime);
string timeString = string.Empty;
if (difTime.Days > 0)
{
timeString += difTime.Days.ToString() + " Days, ";
}
if (difTime.Hours > 0)
{
timeString += difTime.Hours.ToString() + " Hours, ";
}
if (difTime.Minutes > 0)
{
timeString += difTime.Minutes.ToString() + " Minutes, ";
}
if (difTime.Seconds > 0)
{
timeString += difTime.Seconds.ToString() + " Seconds, ";
}
if (difTime.Milliseconds > 0)
{
timeString += difTime.Milliseconds.ToString() + " Milliseconds";
}
switch (pingItem.LocationType)
{
case LocationType.Channel:
Bot.IRC.SendPrivateMessage(pingItem.Location, string.Format("{0}, your ping is {1}", pingItem.Nick, timeString));
break;
case LocationType.Notice:
Bot.IRC.SendNotice(pingItem.Nick, string.Format("Your ping is {0}", timeString));
break;
case LocationType.Query:
Bot.IRC.SendPrivateMessage(pingItem.Nick, string.Format("Your ping is {0}", timeString));
break;
}
listLock.EnterWriteLock();
pingList.RemoveAll(item => item.Nick == pingItem.Nick);
listLock.ExitWriteLock();
}
}
}

private class PingItem
{
public string Nick { get; set; }
public string Location { get; set; }
public LocationType LocationType { get; set; }
public DateTime Timestamp { get; set; }

public PingItem()
{
Nick = string.Empty;
Location = string.Empty;
LocationType = LocationType.Channel;
Timestamp = DateTime.Now;
}
}
}
}

+ 4
- 4
IRCServices/IRC.cs View File

@@ -110,8 +110,8 @@ namespace Combot.IRCServices
public void Login(string serverName, Nick nick)
{
Nickname = nick.Nickname;
IRCSendNick(nick.Nickname);
IRCSendUser(nick.Username, nick.Host, serverName, nick.Realname);
SendNick(nick.Nickname);
SendUser(nick.Username, nick.Host, serverName, nick.Realname);
}

private void ReadTCPMessages()
@@ -173,7 +173,7 @@ namespace Combot.IRCServices
/// <param name="e"></param>
private void HandlePing(object sender, PingInfo e)
{
IRCSendPong(e.Message);
SendPong(e.Message);
}

private void HandleReply(object sender, IReply e)
@@ -399,7 +399,7 @@ namespace Combot.IRCServices
}
newChannel.Nicks.Add(e.Nick);
Channels.Add(newChannel);
IRCSendWho(newChannel.Name);
SendWho(newChannel.Name);
}
ChannelRWLock.ExitWriteLock();
}

+ 96
- 67
IRCServices/IRCSend.cs View File

@@ -14,12 +14,12 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="nick"></param>
/// <param name="message"></param>
public void IRCSendPrivMessage(string recipient, string message)
public void SendPrivateMessage(string recipient, string message)
{
SendTCPMessage(string.Format("PRIVMSG {0} :{1}", recipient, message));
}

public void IRCSendPrivMessage(List<string> recipients, string message)
public void SendPrivateMessage(List<string> recipients, string message)
{
string recipient_list = string.Empty;
foreach (string recipient in recipients)
@@ -35,12 +35,12 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="nick"></param>
/// <param name="message"></param>
public void IRCSendNotice(string recipient, string message)
public void SendNotice(string recipient, string message)
{
SendTCPMessage(string.Format("NOTICE {0} :{1}", recipient, message));
}

public void IRCSendNotice(List<string> recipients, string message)
public void SendNotice(List<string> recipients, string message)
{
string recipient_list = string.Empty;
foreach (string recipient in recipients)
@@ -51,11 +51,40 @@ namespace Combot.IRCServices
SendTCPMessage(string.Format("NOTICE {0} :{1}", recipient_list.TrimEnd(','), message));
}

/// <summary>
/// Sends a CTCP command and optional message to a nick or channel
/// </summary>
/// <param name="recipient"></param>
/// <param name="command"></param>
/// <param name="message"></param>
public void SendCTCP(string recipient, string command, string message = "")
{
if (message != string.Empty)
{
message = " " + message;
}
SendTCPMessage(string.Format("PRIVMSG {0} :\u0001{1}{2}\u0001", recipient, command, message));
}

public void SendCTCP(List<string> recipients, string command, string message)
{
string recipient_list = string.Empty;
foreach (string recipient in recipients)
{
recipient_list += recipient + ",";
}
if (message != string.Empty)
{
message = " " + message;
}
SendTCPMessage(string.Format("PRIVMSG {0} :\u0001{1}{2}\u0001", recipient_list.TrimEnd(','), command, message));
}

/// <summary>
/// Sends the connection password
/// </summary>
/// <param name="password"></param>
public void IRCSendPassword(string password)
public void SendPassword(string password)
{
SendTCPMessage(string.Format("PASSWORD {0}", password));
}
@@ -64,7 +93,7 @@ namespace Combot.IRCServices
/// Sends a Nick command to set the nickname
/// </summary>
/// <param name="nick"></param>
public void IRCSendNick(string nick)
public void SendNick(string nick)
{
SendTCPMessage(string.Format("NICK {0}", nick));
}
@@ -73,7 +102,7 @@ namespace Combot.IRCServices
/// Sends the User command to set a user
/// </summary>
/// <param name="user"></param>
public void IRCSendUser(string username, string hostname, string servername, string realname)
public void SendUser(string username, string hostname, string servername, string realname)
{
SendTCPMessage(string.Format("USER {0} {1} {2} :{3}", username, hostname, servername, realname));
}
@@ -83,7 +112,7 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="username"></param>
/// <param name="password"></param>
public void IRCSendOper(string username, string password)
public void SendOper(string username, string password)
{
SendTCPMessage(string.Format("OPER {0} {1}", username, password));
}
@@ -92,12 +121,12 @@ namespace Combot.IRCServices
/// Sends a Quit command to end the client session
/// </summary>
/// <param name="message"></param>
public void IRCSendQuit()
public void SendQuit()
{
SendTCPMessage("QUIT");
}

public void IRCSendQuit(string message)
public void SendQuit(string message)
{
SendTCPMessage(string.Format("QUIT :{0}", message));
}
@@ -106,14 +135,14 @@ namespace Combot.IRCServices
/// Sends a Join command to join a channel
/// </summary>
/// <param name="channel"></param>
public void IRCSendJoin(string channel, string key = "")
public void SendJoin(string channel, string key = "")
{
string message = string.Empty;
message = (key != string.Empty) ? string.Format("{0}; {1}", channel, key) : channel;
SendTCPMessage(string.Format("JOIN {0}", message));
}

public void IRCSendJoin(List<string> channels, List<string> keys)
public void SendJoin(List<string> channels, List<string> keys)
{
string message = string.Empty;
string channel_string = string.Empty;
@@ -141,12 +170,12 @@ namespace Combot.IRCServices
/// Sends a Part command to leave a channel
/// </summary>
/// <param name="channel"></param>
public void IRCSendPart(string channel)
public void SendPart(string channel)
{
SendTCPMessage(string.Format("PART {0}", channel));
}

public void IRCSendPart(List<string> channels)
public void SendPart(List<string> channels)
{
string channel_list = string.Empty;
foreach (string channel in channels)
@@ -163,30 +192,30 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="channel"></param>
/// <param name="mode"></param>
public void IRCSendMode(string channel, ChannelModeInfo modeInfo)
public void SendMode(string channel, ChannelModeInfo modeInfo)
{
string mode_set = modeInfo.Set ? "+" : "-";
SendTCPMessage(string.Format("MODE {0} {1} {2}", channel, mode_set + modeInfo.Mode.ToString(), modeInfo.Parameter));
}

public void IRCSendMode(string channel, List<ChannelModeInfo> modeInfos)
public void SendMode(string channel, List<ChannelModeInfo> modeInfos)
{
foreach (ChannelModeInfo modeInfo in modeInfos)
{
IRCSendMode(channel, modeInfo);
SendMode(channel, modeInfo);
}
}
public void IRCSendMode(string nick, UserModeInfo modeInfo)
public void SendMode(string nick, UserModeInfo modeInfo)
{
string mode_set = modeInfo.Set ? "+" : "-";
SendTCPMessage(string.Format("MODE {0} {1}", nick, mode_set + modeInfo.Mode.ToString()));
}

public void IRCSendMode(string nick, List<UserModeInfo> modeInfos)
public void SendMode(string nick, List<UserModeInfo> modeInfos)
{
foreach (UserModeInfo modeInfo in modeInfos)
{
IRCSendMode(nick, modeInfo);
SendMode(nick, modeInfo);
}
}

@@ -194,12 +223,12 @@ namespace Combot.IRCServices
/// Sends a Topic command to change the channels topic or view the current one
/// </summary>
/// <param name="channel"></param>
public void IRCSendTopic(string channel)
public void SendTopic(string channel)
{
SendTCPMessage(string.Format("TOPIC {0}", channel));
}

public void IRCSendTopic(string channel, string topic)
public void SendTopic(string channel, string topic)
{
SendTCPMessage(string.Format("TOPIC {0} :{1}", channel, topic));
}
@@ -207,17 +236,17 @@ namespace Combot.IRCServices
/// <summary>
/// Sends a Names command to get a list of visible users
/// </summary>
public void IRCSendNames()
public void SendNames()
{
SendTCPMessage("NAMES");
}

public void IRCSendNames(string channel)
public void SendNames(string channel)
{
SendTCPMessage(string.Format("NAMES {0}", channel));
}

public void IRCSendNames(List<string> channels)
public void SendNames(List<string> channels)
{
string channel_list = string.Empty;
foreach (string channel in channels)
@@ -230,17 +259,17 @@ namespace Combot.IRCServices
/// <summary>
/// Sends a List command to get the topic of channels
/// </summary>
public void IRCSendList()
public void SendList()
{
SendTCPMessage("LIST");
}

public void IRCSendList(string channel)
public void SendList(string channel)
{
SendTCPMessage(string.Format("LIST {0}", channel));
}

public void IRCSendList(List<string> channels)
public void SendList(List<string> channels)
{
string channel_list = string.Empty;
foreach (string channel in channels)
@@ -255,7 +284,7 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="channel"></param>
/// <param name="nick"></param>
public void IRCSendInvite(string channel, string nick)
public void SendInvite(string channel, string nick)
{
SendTCPMessage(string.Format("INVITE {0} {1}", nick, channel));
}
@@ -265,12 +294,12 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="channel"></param>
/// <param name="nick"></param>
public void IRCSendKick(string channel, string nick)
public void SendKick(string channel, string nick)
{
SendTCPMessage(string.Format("KICK {0} {1}", channel, nick));
}

public void IRCSendKick(string channel, string nick, string reason)
public void SendKick(string channel, string nick, string reason)
{
SendTCPMessage(string.Format("KICK {0} {1} :{2}", channel, nick, reason));
}
@@ -279,7 +308,7 @@ namespace Combot.IRCServices
/// Sends a Version command to the server to get a Version reply
/// </summary>
/// <param name="server"></param>
public void IRCSendVersion(string server)
public void SendVersion(string server)
{
SendTCPMessage(string.Format("VERSION {0}", server));
}
@@ -288,12 +317,12 @@ namespace Combot.IRCServices
/// Sends a Stats command to view Server information and statistics
/// </summary>
/// <param name="stat"></param>
public void IRCSendStats(ServerStat stat)
public void SendStats(ServerStat stat)
{
SendTCPMessage(string.Format("STATS {0}", stat.ToString()));
}

public void IRCSendStats(ServerStat stat, string parameter)
public void SendStats(ServerStat stat, string parameter)
{
SendTCPMessage(string.Format("STATS {0} {1}", stat.ToString(), parameter));
}
@@ -302,12 +331,12 @@ namespace Combot.IRCServices
/// Sends a Links command to list all servers matching a mask
/// </summary>
/// <param name="mask"></param>
public void IRCSendLinks(string mask)
public void SendLinks(string mask)
{
SendTCPMessage(string.Format("LINKS {0}", mask));
}

public void IRCSendLinks(string server, string mask)
public void SendLinks(string server, string mask)
{
SendTCPMessage(string.Format("LINKS {0} {1}", mask, server));
}
@@ -315,12 +344,12 @@ namespace Combot.IRCServices
/// <summary>
/// Sends a Time command to query the local server time
/// </summary>
public void IRCSendTime()
public void SendTime()
{
SendTCPMessage("TIME");
}

public void IRCSendTime(string server)
public void SendTime(string server)
{
SendTCPMessage(string.Format("TIME {0}", server));
}
@@ -329,12 +358,12 @@ namespace Combot.IRCServices
/// Senda a Connect command to have the server try to connect to another server
/// </summary>
/// <param name="server"></param>
public void IRCSendConnect(string server)
public void SendConnect(string server)
{
SendTCPMessage(string.Format("CONNECT {0}", server));
}

public void IRCSendConnect(string server, string originator, int port)
public void SendConnect(string server, string originator, int port)
{
SendTCPMessage(string.Format("CONNECT {0} {1} {2}", originator, port, server));
}
@@ -343,7 +372,7 @@ namespace Combot.IRCServices
/// Sends a Trace command to find the route to the target (nick or server)
/// </summary>
/// <param name="target"></param>
public void IRCSendTrace(string target)
public void SendTrace(string target)
{
SendTCPMessage(string.Format("TRACE {0}", target));
}
@@ -351,12 +380,12 @@ namespace Combot.IRCServices
/// <summary>
/// Sends an Admin command to get the name of the server Administrator
/// </summary>
public void IRCSendAdmin()
public void SendAdmin()
{
SendTCPMessage("ADMIN");
}

public void IRCSendAdmin(string host)
public void SendAdmin(string host)
{
SendTCPMessage(string.Format("ADMIN {0}", host));
}
@@ -365,7 +394,7 @@ namespace Combot.IRCServices
/// Sends an Info command for a specific server or nick
/// </summary>
/// <param name="host"></param>
public void IRCSendInfo(string host)
public void SendInfo(string host)
{
SendTCPMessage(string.Format("INFO {0}", host));
}
@@ -373,12 +402,12 @@ namespace Combot.IRCServices
/// <summary>
/// Sends a Who command to list all public users or matching a mask
/// </summary>
public void IRCSendWho()
public void SendWho()
{
SendTCPMessage("WHO");
}

public void IRCSendWho(string host, bool ops = false)
public void SendWho(string host, bool ops = false)
{
string msg = string.Empty;
if (ops)
@@ -396,12 +425,12 @@ namespace Combot.IRCServices
/// Sends a Whois command to get info about a user
/// </summary>
/// <param name="nick"></param>
public void IRCSendWhois(string nick)
public void SendWhois(string nick)
{
SendTCPMessage(string.Format("WHOIS {0}", nick));
}

public void IRCSendWhois(string nick, string server)
public void SendWhois(string nick, string server)
{
SendTCPMessage(string.Format("WHOIS {0} {1}", server, nick));
}
@@ -410,17 +439,17 @@ namespace Combot.IRCServices
/// Sends a Whowas command to get the nick history of a user
/// </summary>
/// <param name="nick"></param>
public void IRCSendWhowas(string nick)
public void SendWhowas(string nick)
{
SendTCPMessage(string.Format("WHOIS {0}", nick));
}

public void IRCSendWhowas(string nick, int entries)
public void SendWhowas(string nick, int entries)
{
SendTCPMessage(string.Format("WHOIS {0} {1}", nick, entries));
}

public void IRCSendWhowas(string nick, int entries, string server)
public void SendWhowas(string nick, int entries, string server)
{
SendTCPMessage(string.Format("WHOIS {0} {1} {2}", nick, entries, server));
}
@@ -430,7 +459,7 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="nick"></param>
/// <param name="comment"></param>
public void IRCSendKill(string nick, string comment)
public void SendKill(string nick, string comment)
{
SendTCPMessage(string.Format("KILL {0} {1}", nick, comment));
}
@@ -439,7 +468,7 @@ namespace Combot.IRCServices
/// Sends a Ping command to the recipient
/// </summary>
/// <param name="recipient"></param>
public void IRCSendPing(string recipient)
public void SendPing(string recipient)
{
SendTCPMessage(string.Format("PING {0}", recipient));
}
@@ -449,17 +478,17 @@ namespace Combot.IRCServices
/// </summary>
/// <param name="sender"></param>
/// <param name="recipient"></param>
public void IRCSendPong()
public void SendPong()
{
SendTCPMessage("PONG");
}

public void IRCSendPong(string message)
public void SendPong(string message)
{
SendTCPMessage(string.Format("PONG {0}", message));
}

public void IRCSendPong(string sender, string recipient)
public void SendPong(string sender, string recipient)
{
SendTCPMessage(string.Format("PONG {0} {1}", sender, recipient));
}
@@ -468,7 +497,7 @@ namespace Combot.IRCServices
/// <summary>
/// Sends an Away command to unset away status
/// </summary>
public void IRCSendAway()
public void SendAway()
{
SendTCPMessage("AWAY");
}
@@ -477,7 +506,7 @@ namespace Combot.IRCServices
/// Sends an Away comand to set away status with auto-reply message
/// </summary>
/// <param name="message"></param>
public void IRCSendAway(string message)
public void SendAway(string message)
{
SendTCPMessage(string.Format("AWAY {0}", message));
}
@@ -485,7 +514,7 @@ namespace Combot.IRCServices
/// <summary>
/// Sends a Rehash command to the server to reload it's configuration file
/// </summary>
public void IRCSendRehash()
public void SendRehash()
{
SendTCPMessage("REHASH");
}
@@ -493,7 +522,7 @@ namespace Combot.IRCServices
/// <summary>
/// Sends a Restart command to the server to restart
/// </summary>
public void IRCSendRestart()
public void SendRestart()
{
SendTCPMessage("RESTART");
}
@@ -502,17 +531,17 @@ namespace Combot.IRCServices
/// Sends a Summon command to summon a nick to the server
/// </summary>
/// <param name="nick"></param>
public void IRCSendSummon()
public void SendSummon()
{
SendTCPMessage("SUMMON");
}

public void IRCSendSummon(string nick)
public void SendSummon(string nick)
{
SendTCPMessage(string.Format("SUMMON {0}", nick));
}

public void IRCSendSummon(string nick, string host)
public void SendSummon(string nick, string host)
{
SendTCPMessage(string.Format("SUMMON {0} {1}", nick, host));
}
@@ -521,7 +550,7 @@ namespace Combot.IRCServices
/// Sends a Users command to get a list of Users from a server
/// </summary>
/// <param name="server"></param>
public void IRCSendUsers(string server)
public void SendUsers(string server)
{
SendTCPMessage(string.Format("USERS {0}", server));
}
@@ -530,7 +559,7 @@ namespace Combot.IRCServices
/// Sends a Wallops command which sends a message to all connected ops
/// </summary>
/// <param name="message"></param>
public void IRCSendWallops(string message)
public void SendWallops(string message)
{
SendTCPMessage(string.Format("WALLOPS :{0}", message));
}
@@ -539,7 +568,7 @@ namespace Combot.IRCServices
/// Sends an Userhost command to up to 5 nicknames to return information about each nick
/// </summary>
/// <param name="nicks"></param>
public void IRCSendUserhost(List<string> nicks)
public void SendUserhost(List<string> nicks)
{
string message = string.Empty;
foreach (string nick in nicks)
@@ -553,7 +582,7 @@ namespace Combot.IRCServices
/// Sends an IsOn command to get a return if the nicks specified are online
/// </summary>
/// <param name="nicks"></param>
public void IRCSendIson(List<string> nicks)
public void SendIson(List<string> nicks)
{
string message = string.Empty;
foreach (string nick in nicks)

+ 6
- 1
IRCServices/Messaging/MessageTypes.cs View File

@@ -6,6 +6,11 @@ namespace Combot.IRCServices.Messaging
abstract public class IMessage : EventArgs
{
public DateTime TimeStamp { get; set; }

public IMessage()
{
TimeStamp = DateTime.Now;
}
}

abstract public class IReply : IMessage
@@ -61,7 +66,7 @@ namespace Combot.IRCServices.Messaging

public class CTCPMessage : IMessage
{
public Nick Target { get; set; }
public Nick Sender { get; set; }
public string Command { get; set; }
public string Arguments { get; set; }
}

+ 21
- 2
IRCServices/Messaging/Messages.cs View File

@@ -17,7 +17,8 @@ namespace Combot.IRCServices.Messaging
public event EventHandler<ServerNotice> ServerNoticeReceivedEvent;
public event EventHandler<ChannelNotice> ChannelNoticeReceivedEvent;
public event EventHandler<PrivateNotice> PrivateNoticeReceivedEvent;
public event EventHandler<CTCPMessage> CTCPMessageRecievedEvent;
public event EventHandler<CTCPMessage> CTCPMessageRecievedEvent;
public event EventHandler<CTCPMessage> CTCPNoticeRecievedEvent;
public event EventHandler<TopicChangeInfo> TopicChangeEvent;
public event EventHandler<ChannelModeChangeInfo> ChannelModeChangeEvent;
public event EventHandler<UserModeChangeInfo> UserModeChangeEvent;
@@ -102,7 +103,7 @@ namespace Combot.IRCServices.Messaging
{
Match ctcpMatch = CTCPRegex.Match(args);
CTCPMessage ctcpMessage = new CTCPMessage();
ctcpMessage.Target = new Nick()
ctcpMessage.Sender = new Nick()
{
Nickname = senderNick,
Realname = senderRealname,
@@ -155,6 +156,24 @@ namespace Combot.IRCServices.Messaging
break;
// The message was a notice to a channel or nick
case "NOTICE":
if (CTCPRegex.IsMatch(args))
{
Match ctcpMatch = CTCPRegex.Match(args);
CTCPMessage ctcpMessage = new CTCPMessage();
ctcpMessage.Sender = new Nick()
{
Nickname = senderNick,
Realname = senderRealname,
Host = senderHost
};
ctcpMessage.Command = ctcpMatch.Groups["Command"].Value;
ctcpMessage.Arguments = ctcpMatch.Groups["Args"].Value;

if (CTCPNoticeRecievedEvent != null)
{
CTCPNoticeRecievedEvent(this, ctcpMessage);
}
}
if (recipient.StartsWith("&") || recipient.StartsWith("#"))
{
ChannelNotice msg = new ChannelNotice();

+ 39
- 5
Interface/ViewModels/MainViewModel.cs View File

@@ -33,15 +33,28 @@ namespace Interface.ViewModels
public MainViewModel()
{
ApplicationTitle = "Combot";
Config.LoadServers();
/*
//Config.LoadServers();
ServerConfig serverConfig = new ServerConfig();
serverConfig.AutoConnect = true;
serverConfig.Channels = new List<ChannelConfig> { new ChannelConfig() { Name = "#testing", Key = string.Empty } };
serverConfig.Channels = new List<ChannelConfig>
{
new ChannelConfig()
{
Name = "#testing",
Key = string.Empty
},
new ChannelConfig()
{
Name = "#/g/technology",
Key = string.Empty
}
};
serverConfig.Name = "Rizon";
serverConfig.Nickname = "Combot_V3";
serverConfig.Realname = "Combot_Realname";
serverConfig.Username = "Combot_Username";
serverConfig.CommandPrefix = ".";
serverConfig.Hosts = new List<HostConfig> { new HostConfig() { Host = "irc.rizon.net", Port = 6667 } };
serverConfig.Modules = new List<Module>
{
@@ -50,12 +63,33 @@ namespace Interface.ViewModels
Name = "Ping Me",
ClassName = "PingMe",
Enabled = true,
Commands = new List<Command> { new Command { Name = "Ping Me", Triggers = new List<string>() {"pingme"} } }
Commands = new List<Command>
{
new Command
{
Name = "Ping Me",
Description = "Checks the time it takes for a PING to be returned from a nick.",
AllowedAccess = new List<AccessType>()
{
AccessType.User,
AccessType.Voice,
AccessType.HalfOperator,
AccessType.Operator,
AccessType.SuperOperator,
AccessType.Founder,
AccessType.Owner
},
Triggers = new List<string>()
{
"pingme"
}
}
}
}
};
Config.Servers.Add(serverConfig);
Config.SaveServers();
*/
foreach (ServerConfig server in Config.Servers)
{
Bot Combot = new Bot(server);

+ 668
- 0
readme.md View File

@@ -0,0 +1,668 @@
# About IRCBot

Created by: Chris Woodward

The IRCBot is designed to provide an all-in-one solution for those who wish to run an IRC bot easily. It includes many useful features as well as fun games. It can even be used as your personal client!

## Feature Set

* Channel Moderation
* Custom Access Levels
* Full GUI Interface
* Console Interface
* Bot API for making custom interfaces
* Owner Control Functions
* Automatic nick registration
* Ghost on Nick in Use
* Flood Protection
* 4chan thread/reply viewing and searching
* URL/file parsing
* Google Search
* Wolfram Alpha Search
* SED
* Ping Requests
* Last Seen Nick
* Channel Rules
* Weather and Forcasts
* Magic 8ball
* Pass the Hbomb game
* Fun commands
* Chat Protocol (A.L.I.C.E.)
* Channel Roll Call
* Version Checker
* Idle
* Dice Rolls
* GitHub issue submission
* Full logging support
* Custom Alarms
* Surveys

## Installation - Windows

1) Download the Release.zip from the latest release in https://github.com/uncled1023/IRCBot/releases and extract the files to a directory of your choice.<br>
2) Run IRCBot-GUI.exe or IRCBot-Console.exe

## Installation - Linux (Alpha)

1) Install mono and libgdiplus packages.<br>
2) Download the Release-Mono.zip from the latest release and extract the files to a directory of your choice.<br>
* config/servers.xml contains all the server settings for the bot. Edit the default server and add more <server></server> if you want.<br>
* config/modules.xml contains all the module config settings. It is usually a good idea to separate them into separate folders/files for each server. You specify the modules.xml file in the server config.<br>

4) Open a terminal emulator and cd it to the directory with the IRCBot-Console.exe.<br>
5) Type: `mono IRCBot-Console.exe`

* Current Limitations: Does not display any output, some functions may not work, buggy.

## Configuration

When you first start up the IRC Bot, you will need to add your details into the configuration. You can do this one of two ways: By using the configuration manager in tools, or by editing the config.xml directly in the /config/ folder. The first is preferred as to reduce the chance of messing up the configuration file.

After clicking tools->configuration, you will then be presented with the configuration manager. From here, you can Add a new server, and configure bot settings

Once you have added your server, just click "Connect" and if you entered your configuration correctly your bot will then connect to the server and channels you specified.
Adding a Server

To add a new server, click the "Add Server" button in the Configuration window. The required fields are as follows:

<table>
<tr>
<th>Property</th><th>Format</th><th>Default Value</th>
</tr>
<tr>
<td>Server Name</td><td>string</td><td></td>
</tr>
<tr>
<td>Server Address</td><td>irc.hostname.net</td><td></td>
</tr>
<tr>
<td>Port Number</td><td>int32</td><td>6667</td>
</tr>
<tr>
<td>Name</td><td>string</td><td></td>
</tr>
<tr>
<td>Nick</td><td>string</td><td></td>
</tr>
</table>

Each server has it's own settings for the Modules and Commands within the modules. You also can control the access level for each XOP level within the Op Levels Configuration tab.

## Command List

Each command has the following properties:

<table>
<tr>
<th>Property</th><th>Format</th>
</tr>
<tr>
<td>name</td><td>string</td>
</tr>
<tr>
<td>description</td><td>string</td>
</tr>
<tr>
<td>triggers</td><td>comma separated string array</td>
</tr>
<tr>
<td>syntax</td><td>string</td>
</tr>
<tr>
<td>access_level</td><td>int32</td>
</tr>
<tr>
<td>blacklist</td><td>comma separated string array</td>
</tr>
<tr>
<td>show_help</td><td>boolean</td>
</tr>
<tr>
<td>spam_check</td><td>boolean</td>
</tr>
</table>

### Fortunes

* `fortune` Displays a fortune.<br>
Usage: `fortune`

### Trivia

* `trivia` Starts a new game of trivia.<br>
Usage: `trivia`

* `stoptrivia` Stops a running game of trivia.<br>
Aliases: `strivia`<br>
Usage: `stoptrivia`

* `scores` Displays the top 10 scores.<br>
Usage: `scores`

* `score` Shows your current rank and score.<br>
Usage: `score`

### 4chan

* `4chan` Views a specific thread ID or OP number of a board, or a list of boards on 4chan.<br>
Usage: `4chan [{board}] [{(#)thread_ID|OP_index}] [{(#)reply_ID|reply_index}]`

* `next_thread` Displays the next OP on the current board.<br>
Aliases: `nt`<br>
Usage: `next_thread`

* `next_reply` Displays the next reply on the current thread.<br>
Aliases: `nr`<br>
Usage: `nr`

* `4chansearch` Searchs a specific board for a thread that contains the specified query.<br>
Aliases: `4chs`, `4cs`, `4chans`<br>
Usage: `4chansearch {board} {query}`

### Is It Up

* `isitup` Checks if the web address specified is accessible from the bot.<br>
Aliases: `isup`<br>
Usage: `isitup {url}`

### Ping Me

* `pingme` Gets the ping time between the bot and the client requesting the ping.<br>
Usage: `pingme`

### Seen

* `seen` Displays the last time the nick has been seen in the channel.<br>
Usage: `seen`

### Access

* `setaccess` Adds the specified nick to the access list with the specified level.<br>
Aliases: `addaccess`<br>
Usage: `setaccess {nick} {access_level}`

* `delaccess` Removes the specified access level from the nick.<br>
Usage: `delaccess {nick} {access_level}`

* `listaccess` Lists all the users with access on the channel and their level.<br>
Aliases: `accesslist`<br>
Usage: `listaccess`

* `getaccess` Displays the current access level of a user.<br>
Aliases: `access`<br>
Usage: `getaccess [{channel}] {nick}`

### Moderation

* `founder` Sets the nick to Owner of the chan.<br>
Usage: `founder {nick}`

* `defounder` Unsets the nick as Owner of the chan.<br>
Usage: `defounder {nick}

* `asop` Adds the nick to the Auto Super Op List.<br>
Usage: `asop {nick}`

* `deasop` Removes the nick from the Auto Super Op List.<br>
Usage: `deasop {nick}`

* `sop` Sets the nick as Super Op.<br>
Usage: `sop {nick}`

* `desop` Removes the nick as Super Op.<br>
Usage: `desop {nick}`

* `aop` Adds the nick to the Auto Op List.<br>
Usage: `aop {nick}`

* `deaop` Removes the nick from the Auto Op List.<br>
Usage: `deaop {nick}`

* `op` Sets the nick as an Op.<br>
Usage: `op {nick}`

* `deop` Removes the nick as an Op.<br>
Usage: `deop {nick}`

* `ahop` Adds the nick to the Auto HOP List.<br>
Usage: `ahop {nick}`

* `deahop` Removes the nick from the Auto HOP List.<br>
Usage: `deahop {nick}`

* `avoice` Adds the nick to the Auto Voice List.<br>
Usage: `avoice {nick}`

* `deavoice` Removes the nick from the Auto Voice List.<br>
Usage: `deavoice {nick}`

* `mode` Sets or unsets a channel mode.<br>
Usage: `mode +/-{flags}`

* `topic` Sets the channels topic.<br>
Usage: `topic {topic}`

* `invite` Invites the specified nick into the channel.<br>
Usage: `invite {nick}`

* `ak` Adds the specified nick to the auto kick list.<br>
Usage: `ak {nick} [{reason}]`

* `ab` Adds the specified nick to the auto ban list.<br>
Usage: `ab {nick} [{reason}]`

* `akb` Adds the specified nick to the auto kick-ban list.<br>
Usage: `akb {nick} [{reason}]`

* `deak` Removes the specified nick to the auto kick list.<br>
Usage: `deak {nick} [{reason}]`

* `deab` Removes the specified nick to the auto ban list.<br>
Usage: `deab {nick} [{reason}]`

* `deakb` Removes the specified nick to the auto kick-ban list.<br>
Usage: `deakb {nick} [{reason}]`

* `hop` Sets the nick as Half Op.<br>
Usage: `hop {nick}`

* `dehop` Removes the nick as Half Op.<br>
Usage: `dehop {nick}`

* `b` Bans the specified nick.<br>
Usage: `b {nick}`

* `ub` Unbans the specified nick.<br>
Usage: `ub {nick}`

* `clearban` Clears all the bans in the channel.<br>
Usage: `clearban`

* `kb` Bans and then Kicks the specified nick.<br>
Usage: `kb {nick} [{reason}]`

* `tb` Bans the specified nick for the amount of time specified.<br>
Usage: `tb {ban_time} {nick} [{reason}]`

* `tkb` Bans and then Kicks the specified nick for the amount of time specified.<br>
Usage: `tkb {ban_time} {nick} [{reason}]`

* `k` Kicks the nick from the channel.<br>
Usage: `k {nick} [{reason}]`

* `voice` Sets the nick as Voiced.<br>
Usage: `voice {nick}`

* `devoice` Removes the nick as Voiced.<br>
Usage: `devoice {nick}`

* `kme` Kicks the requesting nick from the channel.<br>
Usage: `kme`

### Owner

* `owner` Identifies the nick as the Bot's Owner.<br>
Usage: `owner {password}`

* `addowner` Adds the defined nick as an owner.<br>
Usage: `addowner {nick}`

* `delowner` Removes the defined nick from the owners list.<br>
Usage: `delowner {nick}`

* `nick` Changes the Bot's nickname to the one specified.<br>
Usage: `nick {new_nick}`

* `id` Has the Bot identify to nickserv.<br>
Usage: `id`

* `join` Tells the Bot to join the specified channel.<br>
Usage: `join {channel}`

* `part` Tells the Bot to part the channel.<br>
Usage: `part [{channel}]`

* `say` Has the Bot say the specified message to the channel.<br>
Usage: `say [{channel}] {message}`

* `action` Displays the specified message as an action in the channel.<br>
Alternate Commands: `me`<br>
Usage: `action [{channel}] {message}`

* `query` Private messages the specified nick.<br>
Usage: `query {nick} {message}`

* `quit` Quits the server instance.<br>
Usage: `quit`

* `quitall` Quits all of the connected server instances.<br>
Usage: `quitall`

* `cycle` Restarts the server instance.<br>
Usage: `cycle`

* `cycleall` Restarts all of the connected server instances.<br>
Usage: `cycleall`

* `exit` Closes the client.<br>
Usage: `restart`

* `restart` Restarts the client.<br>
Usage: `restart`

* `ignore` Adds the specified nick/chan to the ignore list.<br>
Usage: `ignore {nick|channel}`

* `unignore` Removes the specified nick/chan from the ignore list.<br>
Usage: `unignore {nick|channel}`

* `ignoremodule` Adds the specified nick/chan to a modules ignore list.<br>
Usage: `ignoremodule {module} {nick|chan}`

* `unignoremodule` Removes the specified nick/chan from a modules ignore list.<br>
Usage: `unignoremodule {module} {nick|chan}`

* `ignorecmd` Adds the specified nick/chan to a commands ignore list.<br>
Usage: `ignorecmd {command} {nick|chan}

* `unignorecmd` Removes the specified nick/chan from a commands ignore list.<br>
Usage: `unignorecmd {command} {nick|chan}`

* `blacklist` Adds the specified channel to the bot blacklist.<br>
Usage: `blacklist {channel}`

* `unblacklist` Removes the specified channel from the bot blacklist.<br>
Usage: `unblacklist {channel}`

* `update` Updates the Modules and Configurations on all server instances.<br>
Usage: `update`

* `modules` Displays the loaded modules.<br>
Usage: `modules`

* `loadmodule` Loads the specified module into the bot.<br>
Aliases: `load`, `addmodule`<br>
Usage: `loadmodule {module_class_name}`

* `delmodule` Unloads the specified module from the bot.<br>
Aliases: `unload`, `unloadmodule`<br>
Usage: `delmodule {module_class_name}`

* `addchan`Invites the bot to a specified channel.<br>
Usage: `addchan {channel}`

* `addchanlist` Adds the specified channel to the auto-join list.<br>
Usage: `addchanlist {channel}`

* `delchanlist` Removes the specified channel to the auto-join list.<br>
Usage: `delchanlist {channel}`

* `nicklist` Lists the nicks in the current channel or specified one.<br>
Aliases: `nicks`<br>
Usage: `nicklist [{channel}]`

* `channels` Lists the channels the bot is in on that server.<br>
Usage: `channels`

* `servers` Lists the servers the bot is connected to.<br>
Usage: `servers`

* `conf` Lists the bot's current configuration settings.<br>
Usage: `conf [module_config]`

* `resources` Displays the current CPU and RAM used by the bot.<br>
Usage: `resources`

* `clear` Kicks everyone from the channel except the initiator and the bot.<br>
Usage: `clear [{channel}]`

### Help

* `help` Displays the modules available to the nick. Viewing a specific module shows the commands. Viewing a specific command shows the command properties.<br>
Usage: `help [{module}] [{command}]`

### Rules

* `rules` Displays the channel rules.<br>
Usage: `rules`

* `addrule` Adds the specified rule to the end of the channel rules.<br>
Usage: `addrule {rule}`

* `delrule` Removes the specified rule from the channel rules.<br>
Usage: `delrule {rule_number}`

### Messaging

* `message` Leaves a message for the specified nick. Will be delivered once the nick joins or speaks in a channel the bot is in.<br>
Aliases: `msg`<br>
Usage: `message {nick} {message}`

* `anonmessage` Leaves a message for the specified nick without displaying the sender's nick. Will be delivered once the nick joins or speaks in a channel the bot is in.<br>
Aliases: `amsg`, `anonmsg`<br>
Usage: `anonmessage {nick} {message}`

### Intro

* `intro` Adds a personal greeting for whenever you enter the channel.<br>
Usage: `intro {greeting_1|greeting_2}`

* `introdelete` Deletes your introductions for that channel.<br>
Aliases: `delintro`, `deleteintro`<br>
Usage: `introdelete`

### Quote

* `quote` Displays a random quote from the channel. If a nick is specified, it will get a quote from that nick.<br>
Usage: `quote [{nick}]`

### Weather

* `weather` Displays the current weather conditions for the specified city.<br>
Aliases: `w`<br>
Usage: `weather {zip_code|city_name}`

* `forecast` Displays the weather forecast for the specified city.<br>
Aliases: `f`<br>
Usage: `forecast {zip_code|city_name}`

### Search

* `google` Displays the first result from Google.<br>
Aliases: `g`<br>
Usage: `google {query}`

### 8-Ball

* `8ball` Answers any yes/no question.<br>
Usage: `8ball {question}`

### HBomb

* `hbomb` Initiates a new game of pass the HBomb.<br>
Usage: `hbomb`

* `pass` Passes the HBomb to the specified nick.<br>
Usage: `pass {nick}`

* `lock_bomb` Locks the bomb to the current holder, or passes it and then locks it.<br>
Aliases: `lb`<br>
Usage: `lock_bomb [{nick}]`

* `unlock_bomb` Unlocks the bomb from the current holder.<br>
Aliases: `unlb`<br>
Usage: `unlock_bomb`

* `set_bomb` Sets the bomb holder to the specified nick.<br>
Aliases: `sb`<br>
Usage: `set_bomb {nick}`

* `detonate` Detonates the current active bomb.<br>
Usage: `detonate`

* `stop_bomb` Stops the bomb without it blowing up.<br>
Usage: `stop_bomb`

* `defuse` Cuts a wire of the HBomb. If it is the correct wire, it will defuse the bomb and kick the previous holder. If not, it will detonate.<br>
Usage: `defuse {wire_color}`

### Fun

* `love` Sends some love to the specified nick or requesting nick.<br>
Usage: `love [{nick}]`

* `hug` Sends a hug to the specified nick or requesting nick.<br>
Usage: `hug [{nick}]`

* `slap` Slaps the specified nick or requesting nick.<br>
Usage: `slap [{nick}]`

* `bots` Checks in to the channel.<br>
Usage: `bots`

* `br` Responds with HUEHUEHUE.<br>
Usage: `br`

* `net` Talks about the quality .NET Framework.<br>
Usage: `net`

### Response

* `addresponse` Adds a new response to the dictionary.<br>
Usage: `addresponse {allowed_chan}[,{allowed_chan}]:{trigger}[|{trigger}]:{response}[|[response}]`

* `delresponse` Removes the specified response from the dictionary.<br>
Usage: `delresponse {response_number}`

* `listresponse` Lists all of the responses in the dictionary.<br>
Usage: `listresponse`

### Chat

* `stopchat` Stops the bot from chatting in that channel.<br>
Usage: `stopchat`

### Poll

* `poll` Creates a poll in the channel.<br>
Usage: `poll {question}|{answer}[|{answer}...]`

* `addanswer` Adds an answer to the active poll.<br>
Usage: `addanswer {answer}`

* `delanswer` Removes the specified answer from the active poll.<br>
Usage: `delanswer {answer_number}`

* `stoppoll` Stops the active poll and displays the results.<br>
Usage: `stoppoll`

* `results` Displays the results of the current poll.<br>
Usage: `results`

* `vote` Votes for the specified answer.<br>
Usage: `vote {answer_number}`

### Roll Call

* `rollcall` Displays every nick in the channel.<br>
Usage: `rollcall [{channel}]`

### Version Response

* `ver` Sends a version request and displays the response.<br>
Usage: `ver {nick}`

### Idle

* `idle` Sets you as idle. Protects from certain games and actions.<br>
Usage: `idle`

* `deidle` Returns you from idle.<br>
Usage: `deidle`

### Roll Dice

* `roll` Rolls a specified number of dice with certain s amount of sides and displays the results.<br>
Usage: `roll [{number_of_dice}] [{number_of_sides}]`

### Wolfram Alpha

* `wa` Returns the results of your query from Wolfram Alpha.<br>
Usage: `wa {query}`

### GitHub

* `bug` Creates a new issue with a ''Bug'' label.<br>
Usage: `bug {title}[|{description}]`

* `request` Creates a new issue with a ''Issue'' label.<br>
Usage: `request {title}[|{description}]`

### About

* `about` Displays the bots current version, creator, and owners.<br>
Usage: `about`

* `source` Displays the url for the source code of IRCBot.<br>
Usage: `source`

* `uptime` Displays how long the bot has been connected to the server.<br>
Usage: `uptime`

* `runtime` Displays how long the bot program has been running.<br>
Usage: `runtime`

### Logging

* `last` Displays information of the usage of specified commands.<br>
Usage: `last [{command}] [{nick}] [{number_of_results}]`

### Alarms

* `alarm` Sets an alarm for the time specified.<br>
Usage: `alarm {time} {message or command}`

### Surveys

* `survey` Starts a survey session for the requesting nick.<br>
Usage: `survey {survey_number}`

* `surveys` Lists all available surveys, nicks who have taken the specified survey, or answers of the specified nick for the specified survey.<br>
Usage: `surveys [{survey_number}] [{nick}]`

* `nextquestion` Submits your entered text as an answer and displays the next question.<br>
Usage: `nextquestion`

* `addsurvey` Begins the add new survey wizard.<br>
Usage: `addsurvey {survey_access_level} {survey_name}`

* `delsurvey` Deletes the specified survey.<br>
Usage: `delsurvey {survey_number}`

* `finishsurvey` Finalizes the submitted survey and adds it to the list.<br>
Usage: `finishsurvey`

* `cancelsurvey` Cancels the current survey and erases the answers.<br>
Usage: `cancelsurvey`

* `addsurveyowner` Adds an owner to the specified survey.<br>
Usage: `addsurveyowner {survey_number} {new_owner}[,{new-owner}]`

* `delsurveyowner` Deletes an owner to the specified survey.<br>
Usage: `delsurveyowner {survey_number} {owner}[,{owner}]`

## Bugs/Feature Requests

Please report all bugs you find to me so I can fix them as soon as possible. Also if you have any feature requests, feel free to send them to me as well.

## Contact Info

Email: admin@teknik.io<br>
IRC: (irc.teknik.io)#IRCBot<br>
Nick: Uncled1023

## Acknowledgements

Cameron Lucas

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/uncled1023/ircbot/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Loading…
Cancel
Save