Browse Source

Added new modules.

Fixed some minor bugs.
Revamped UI to allow viewing of multiple servers/channels.
tags/3.0.0
Teknikode 4 years ago
parent
commit
3aacb21720

+ 148
- 0
Combot.Servers.Release.config View File

@@ -0,0 +1,148 @@
[
{
"Name": "Rizon",
"Nicknames": [
"Combot",
"Combot_V3"
],
"Realname": "Combot",
"Username": "Combot",
"Password": "24121exe",
"Email": "admin@teknik.io",
"Owners": [
"Uncled1023"
],
"ChannelBlacklist": [
"#/g/iggle",
"#/g/tv",
"#supbro",
"#/fit/",
"#/x/files",
"#tuppers",
"#/g/hetto",
"#code"
],
"NickBlacklist": [
"KugelBlitz",
"ChanStat",
"NiNi",
"Kug|Pi",
"LoremIpsum",
"IRCBot",
"t4w|pi",
"Gurren",
"GEEEECraft",
"_KugelBlitz_",
"LoremIpsum",
"Kasuto",
"Kasuto|1",
"Tombot",
"Merzbot",
"bane",
"deskbot",
"spoonbot",
"Janice",
"STumbles",
"lykbot",
"beelzaboot"
],
"Hosts": [
{
"Host": "irc.rizon.net",
"Port": 6667
}
],
"Channels": [
{
"Name": "#/g/technology",
"Key": ""
},
{
"Name": "#tech-mod",
"Key": ""
},
{
"Name": "#/g/bots",
"Key": ""
},
{
"Name": "#toehoef",
"Key": ""
},
{
"Name": "#bots",
"Key": ""
},
{
"Name": "#Technocracy",
"Key": ""
},
{
"Name": "#Teknik",
"Key": ""
},
{
"Name": "#/g/entlemen",
"Key": ""
},
{
"Name": "#kitties",
"Key": ""
},
{
"Name": "#minimalrice",
"Key": ""
},
{
"Name": "#pentest",
"Key": ""
},
{
"Name": "#riceshop",
"Key": ""
},
{
"Name": "#/g/programming",
"Key": ""
},
{
"Name": "#jakarta",
"Key": ""
},
{
"Name": "#/g/trivia",
"Key": ""
},
{
"Name": "#tech",
"Key": ""
},
{
"Name": "#rice",
"Key": ""
},
{
"Name": "#india.suna",
"Key": ""
},
{
"Name": "#wheat",
"Key": ""
}
],
"Database": {
"Server": "192.168.11.40",
"Port": 3306,
"Database": "Combot",
"Username": "Combot",
"Password": "24121exe"
},
"ModuleLocation": "Modules",
"AutoConnect": true,
"AutoRegister": false,
"CommandPrefix": ".",
"JoinDelay": 100,
"MaxMessageLength": 400,
"MessageSendDelay": 100
}
]

+ 24
- 3
Combot.sln View File

@@ -9,6 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interface", "Interface\Inte
{D469C717-7625-40F1-966D-3C9DD00F5B9C} = {D469C717-7625-40F1-966D-3C9DD00F5B9C}
{EBAC601C-652C-466A-B4F0-94495F4C8E49} = {EBAC601C-652C-466A-B4F0-94495F4C8E49}
{289A0E25-F669-4E00-9DB9-0C5AE51E2BCC} = {289A0E25-F669-4E00-9DB9-0C5AE51E2BCC}
{9ADA4844-4566-4C2E-8649-3D87E2F76563} = {9ADA4844-4566-4C2E-8649-3D87E2F76563}
{72CCA645-3E1D-4355-9BDE-5C1884BCB6FC} = {72CCA645-3E1D-4355-9BDE-5C1884BCB6FC}
{1A544D51-1041-4A9A-B1ED-E738735DF52E} = {1A544D51-1041-4A9A-B1ED-E738735DF52E}
{2AD43A57-CDFF-4098-AC09-82159744C6E4} = {2AD43A57-CDFF-4098-AC09-82159744C6E4}
@@ -16,7 +17,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interface", "Interface\Inte
{18369F84-BD20-4946-B3D6-F2152148B2B4} = {18369F84-BD20-4946-B3D6-F2152148B2B4}
{60902085-CEF9-4C38-96F4-644F4574681F} = {60902085-CEF9-4C38-96F4-644F4574681F}
{6FEDA88B-70F0-4E7B-9079-C5530247F8AB} = {6FEDA88B-70F0-4E7B-9079-C5530247F8AB}
{909F6291-F0F5-4452-A4CA-BEF96916C01D} = {909F6291-F0F5-4452-A4CA-BEF96916C01D}
{A4D79B92-8D54-46BA-94AD-31CEA23E5688} = {A4D79B92-8D54-46BA-94AD-31CEA23E5688}
{2434E995-592F-4EE2-B321-033B7493F93E} = {2434E995-592F-4EE2-B321-033B7493F93E}
{516ECE98-0D6D-4713-AEDA-EDF47FFAA80B} = {516ECE98-0D6D-4713-AEDA-EDF47FFAA80B}
{EFAC8BA8-AF57-4D9C-9F00-1758FCC2F22E} = {EFAC8BA8-AF57-4D9C-9F00-1758FCC2F22E}
EndProjectSection
@@ -61,6 +64,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logging", "Modules\Logging\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Introductions", "Modules\Introductions\Introductions.csproj", "{6FEDA88B-70F0-4E7B-9079-C5530247F8AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quotes", "Modules\Quotes\Quotes.csproj", "{9ADA4844-4566-4C2E-8649-3D87E2F76563}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seen", "Modules\Seen\Seen.csproj", "{909F6291-F0F5-4452-A4CA-BEF96916C01D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Messaging", "Modules\Messaging\Messaging.csproj", "{2434E995-592F-4EE2-B321-033B7493F93E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -135,6 +144,18 @@ Global
{6FEDA88B-70F0-4E7B-9079-C5530247F8AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FEDA88B-70F0-4E7B-9079-C5530247F8AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FEDA88B-70F0-4E7B-9079-C5530247F8AB}.Release|Any CPU.Build.0 = Release|Any CPU
{9ADA4844-4566-4C2E-8649-3D87E2F76563}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9ADA4844-4566-4C2E-8649-3D87E2F76563}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9ADA4844-4566-4C2E-8649-3D87E2F76563}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9ADA4844-4566-4C2E-8649-3D87E2F76563}.Release|Any CPU.Build.0 = Release|Any CPU
{909F6291-F0F5-4452-A4CA-BEF96916C01D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{909F6291-F0F5-4452-A4CA-BEF96916C01D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{909F6291-F0F5-4452-A4CA-BEF96916C01D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{909F6291-F0F5-4452-A4CA-BEF96916C01D}.Release|Any CPU.Build.0 = Release|Any CPU
{2434E995-592F-4EE2-B321-033B7493F93E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2434E995-592F-4EE2-B321-033B7493F93E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2434E995-592F-4EE2-B321-033B7493F93E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2434E995-592F-4EE2-B321-033B7493F93E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -154,8 +175,8 @@ Global
{516ECE98-0D6D-4713-AEDA-EDF47FFAA80B} = {D157677E-4D33-4156-B55E-E21C4B5A3024}
{289A0E25-F669-4E00-9DB9-0C5AE51E2BCC} = {D157677E-4D33-4156-B55E-E21C4B5A3024}
{6FEDA88B-70F0-4E7B-9079-C5530247F8AB} = {D157677E-4D33-4156-B55E-E21C4B5A3024}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
{9ADA4844-4566-4C2E-8649-3D87E2F76563} = {D157677E-4D33-4156-B55E-E21C4B5A3024}
{909F6291-F0F5-4452-A4CA-BEF96916C01D} = {D157677E-4D33-4156-B55E-E21C4B5A3024}
{2434E995-592F-4EE2-B321-033B7493F93E} = {D157677E-4D33-4156-B55E-E21C4B5A3024}
EndGlobalSection
EndGlobal

+ 5
- 0
Combot/Bot.cs View File

@@ -211,6 +211,11 @@ namespace Combot
return hasAccess;
}

public void ExecuteCommand(string message, string location, MessageType type)
{
ParseCommandMessage(DateTime.Now, message, new Nick { Nickname = IRC.Nickname }, location, type);
}

private void HandleConnectEvent()
{
Connected = true;

+ 21
- 5
Combot/Modules/Module.cs View File

@@ -72,7 +72,7 @@ namespace Combot.Modules
{
nickAccessTypes.Add(Bot.PrivilegeModeMapping[privilege]);
}
if (Bot.ServerConfig.Owners.Contains(command.Nick.Nickname) && command.Nick.Modes.Contains(UserMode.r))
if ((Bot.ServerConfig.Owners.Contains(command.Nick.Nickname) && command.Nick.Modes.Contains(UserMode.r)) || command.Nick.Nickname == Bot.IRC.Nickname)
{
nickAccessTypes.Add(AccessType.Owner);
}
@@ -247,8 +247,9 @@ namespace Combot.Modules
{
Database database = new Database(Bot.ServerConfig.Database);
string search = "SELECT * FROM `channels` WHERE " +
"`name` = {0}";
List<Dictionary<string, object>> results = database.Query(search, new object[] { channel });
"`server_id` = (SELECT `id` FROM `servers` WHERE `name` = {0}) AND " +
"`name` = {1}";
List<Dictionary<string, object>> results = database.Query(search, new object[] { Bot.ServerConfig.Name, channel });

if (!results.Any())
{
@@ -263,8 +264,9 @@ namespace Combot.Modules
{
Database database = new Database(Bot.ServerConfig.Database);
string search = "SELECT * FROM `nicks` WHERE " +
"`nickname` = {0}";
List<Dictionary<string, object>> results = database.Query(search, new object[] { nickname });
"`server_id` = (SELECT `id` FROM `servers` WHERE `name` = {0}) AND " +
"`nickname` = {1}";
List<Dictionary<string, object>> results = database.Query(search, new object[] { Bot.ServerConfig.Name, nickname });

if (!results.Any())
{
@@ -274,5 +276,19 @@ namespace Combot.Modules
database.Execute(insert, new object[] { Bot.ServerConfig.Name, nickname });
}
}

public string GetNickname(int id)
{
Database database = new Database(Bot.ServerConfig.Database);
string search = "SELECT `nickname` FROM `nicks` " +
"WHERE `id` = {0}";
List<Dictionary<string, object>> results = database.Query(search, new object[] { id });
string nickname = string.Empty;
if (results.Any())
{
nickname = results.First()["nickname"].ToString();
}
return nickname;
}
}
}

+ 6
- 1
IRCServices/IRC.cs View File

@@ -342,7 +342,12 @@ namespace Combot.IRCServices
}
else
{
nick.Modes.Add((UserMode)Enum.Parse(typeof(UserMode), modeArr[i].ToString()));
UserMode foundMode;
bool valid = Enum.TryParse(modeArr[i].ToString(), false, out foundMode);
if (valid)
{
nick.Modes.Add(foundMode);
}
}
}
if (!nickFound)

+ 36
- 44
IRCServices/SendCommand.cs View File

@@ -21,34 +21,30 @@ namespace Combot.IRCServices
if (sinceLastMessage.TotalMilliseconds < MessageSendDelay)
{
Thread.Sleep((int) sinceLastMessage.TotalMilliseconds);
SendPrivateMessage(recipient, message);
}
else
LastMessageSend = DateTime.Now;
if (message.Length > MaxMessageLength)
{
LastMessageSend = DateTime.Now;
if (message.Length > MaxMessageLength)
List<string> splitMessage = message.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries).ToList();
string subMessage = string.Empty;
string nextMessage = string.Empty;
for (int i = 0; i < splitMessage.Count; i++)
{
List<string> splitMessage = message.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries).ToList();
string subMessage = string.Empty;
string nextMessage = string.Empty;
for (int i = 0; i < splitMessage.Count; i++)
int wordLength = splitMessage[i].Length + 1;
int totalLength = subMessage.Length;
if (totalLength + wordLength > MaxMessageLength)
{
int wordLength = splitMessage[i].Length + 1;
int totalLength = subMessage.Length;
if (totalLength + wordLength > MaxMessageLength)
{
nextMessage = string.Join(" ", splitMessage.GetRange(i, splitMessage.Count - i));
break;
}
subMessage = string.Join(" ", subMessage, splitMessage[i]);
nextMessage = string.Join(" ", splitMessage.GetRange(i, splitMessage.Count - i));
break;
}
SendTCPMessage(string.Format("PRIVMSG {0} :{1}", recipient, subMessage));
SendPrivateMessage(recipient, nextMessage);
}
else
{
SendTCPMessage(string.Format("PRIVMSG {0} :{1}", recipient, message));
subMessage = string.Join(" ", subMessage, splitMessage[i]);
}
SendTCPMessage(string.Format("PRIVMSG {0} :{1}", recipient, subMessage));
SendPrivateMessage(recipient, nextMessage);
}
else
{
SendTCPMessage(string.Format("PRIVMSG {0} :{1}", recipient, message));
}
}

@@ -73,34 +69,30 @@ namespace Combot.IRCServices
if (sinceLastMessage.TotalMilliseconds < MessageSendDelay)
{
Thread.Sleep((int) sinceLastMessage.TotalMilliseconds);
SendNotice(recipient, message);
}
else
LastMessageSend = DateTime.Now;
if (message.Length > MaxMessageLength)
{
LastMessageSend = DateTime.Now;
if (message.Length > MaxMessageLength)
List<string> splitMessage = message.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries).ToList();
string subMessage = string.Empty;
string nextMessage = string.Empty;
for (int i = 0; i < splitMessage.Count; i++)
{
List<string> splitMessage = message.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
string subMessage = string.Empty;
string nextMessage = string.Empty;
for (int i = 0; i < splitMessage.Count; i++)
int wordLength = splitMessage[i].Length + 1;
int totalLength = subMessage.Length;
if (totalLength + wordLength > MaxMessageLength)
{
int wordLength = splitMessage[i].Length + 1;
int totalLength = subMessage.Length;
if (totalLength + wordLength > MaxMessageLength)
{
nextMessage = string.Join(" ", splitMessage.GetRange(i, splitMessage.Count - i));
break;
}
subMessage = string.Join(" ", subMessage, splitMessage[i]);
nextMessage = string.Join(" ", splitMessage.GetRange(i, splitMessage.Count - i));
break;
}
SendTCPMessage(string.Format("NOTICE {0} :{1}", recipient, subMessage));
SendNotice(recipient, nextMessage);
}
else
{
SendTCPMessage(string.Format("NOTICE {0} :{1}", recipient, message));
subMessage = string.Join(" ", subMessage, splitMessage[i]);
}
SendTCPMessage(string.Format("NOTICE {0} :{1}", recipient, subMessage));
SendNotice(recipient, nextMessage);
}
else
{
SendTCPMessage(string.Format("NOTICE {0} :{1}", recipient, message));
}
}


+ 23
- 0
Interface/BufferInfo.cs View File

@@ -0,0 +1,23 @@
using System.Collections.Generic;

namespace Interface
{
public class BufferInfo
{
public string Server { get; set; }
public string Location { get; set; }
public List<string> Buffer { get; set; }

public BufferInfo()
{
SetDefaults();
}

public void SetDefaults()
{
Server = string.Empty;
Location = string.Empty;
Buffer = new List<string>();
}
}
}

+ 1
- 0
Interface/Interface.csproj View File

@@ -69,6 +69,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="BufferInfo.cs" />
<Compile Include="ViewModels\MainViewModel.cs" />
<Compile Include="ViewModels\ViewModelBase.cs" />
<Page Include="MainWindow.xaml">

+ 21
- 4
Interface/MainWindow.xaml View File

@@ -3,9 +3,26 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Interface"
xmlns:prop="clr-namespace:Interface.Properties"
Title="{Binding ApplicationTitle, Mode=TwoWay}" Height="350" Width="525">
<Grid>
<Button x:Name="ToggleConnectionButton" Content="{Binding ToggleConnectionText}" HorizontalAlignment="Left" Margin="10,0,0,10" Width="156" Command="{Binding ToggleConnection}" Height="33" VerticalAlignment="Bottom"/>
<TextBox x:Name="BufferWindow" Margin="10,10,10,48" TextWrapping="Wrap" Text="{Binding CurrentBuffer, Mode=TwoWay}"/>
xmlns:view="clr-namespace:Interface.ViewModels"
Title="{Binding ApplicationTitle, Mode=TwoWay}" Height="372" Width="850" ResizeMode="CanResizeWithGrip">
<Grid Margin="0,0,0,2">
<Button x:Name="ToggleConnectionButton" Content="{Binding ToggleConnectionText}" Margin="10,0,0,10" Command="{Binding ToggleConnection}" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="100"/>

<ComboBox x:Name="ServerListBox" ItemsSource="{Binding ServerList, Mode=TwoWay}" SelectedItem="{Binding SelectedServer, Mode=TwoWay}" Height="25" Margin="0,10,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="114"/>
<ListBox x:Name="LocationListBox" ItemsSource="{Binding LocationList, Mode=TwoWay}" SelectedItem="{Binding SelectedLocation, Mode=TwoWay}" HorizontalAlignment="Right" Margin="0,40,10,38" Width="114"/>
<TextBox x:Name="InputBox" Text="{Binding InputBoxText, UpdateSourceTrigger=PropertyChanged}" Margin="115,0,129,10" TextWrapping="Wrap" Height="23" VerticalAlignment="Bottom" AcceptsReturn="True">
<TextBox.InputBindings>
<KeyBinding Command="{Binding SubmitText}" Key="Enter"/>
</TextBox.InputBindings>
</TextBox>
<Button x:Name="SubmitButton" Content="Submit" Command="{Binding SubmitText}" Margin="0,0,10,10" HorizontalAlignment="Right" Width="114" Height="23" VerticalAlignment="Bottom"/>

<RichTextBox x:Name="BufferWindow" Margin="10,10,129,38" VerticalScrollBarVisibility="Auto" IsReadOnly="True">
<FlowDocument>
<Paragraph>
<Run Text="{Binding CurrentBuffer, Mode=TwoWay}"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>

+ 264
- 42
Interface/ViewModels/MainViewModel.cs View File

@@ -1,13 +1,16 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Runtime.Remoting.Channels;
using System.Windows.Documents;
using Combot;
using Combot.IRCServices.Messaging;
using Combot.Configurations;
using Combot.Modules;

namespace Interface.ViewModels
{
@@ -19,103 +22,231 @@ namespace Interface.ViewModels
public string ApplicationTitle { get; set; }

private string _CurrentBuffer = string.Empty;
public string CurrentBuffer { get { return _CurrentBuffer; } set { _CurrentBuffer = value; OnPropertyChanged("CurrentBuffer"); } }

public string CurrentBuffer
{
get { return _CurrentBuffer; }
set
{
_CurrentBuffer = value;
OnPropertyChanged("CurrentBuffer");
}
}

private bool _Connected = false;
public bool Connected { get { return _Connected; } set { _Connected = value; if (_Connected) { ToggleConnectionText = "Disconnect"; } else { ToggleConnectionText = "Connect"; } OnPropertyChanged("Connected"); } }

public bool Connected
{
get { return _Connected; }
set
{
_Connected = value;
if (_Connected)
{
ToggleConnectionText = "Disconnect";
}
else
{
ToggleConnectionText = "Connect";
}
OnPropertyChanged("Connected");
}
}

private string _ToggleConnectionText = "Connect";
public string ToggleConnectionText { get { return _ToggleConnectionText; } set { _ToggleConnectionText = value; OnPropertyChanged("ToggleConnectionText"); } }

public string ToggleConnectionText
{
get { return _ToggleConnectionText; }
set
{
_ToggleConnectionText = value;
OnPropertyChanged("ToggleConnectionText");
}
}

private string _InputBoxText;

public string InputBoxText
{
get { return _InputBoxText; }
set
{
_InputBoxText = value;
OnPropertyChanged("InputBoxText");
}
}

private string _SelectedServer;
public string SelectedServer
{
get { return _SelectedServer; }
set
{
_SelectedServer = value;
OnPropertyChanged("SelectedServer");
ChangeServer();
ChangeBuffer();
}
}

private string _SelectedLocation;

public string SelectedLocation
{
get { return _SelectedLocation; }
set
{
_SelectedLocation = value;
OnPropertyChanged("SelectedLocation");
ChangeBuffer();
}
}

private ObservableCollection<string> _ServerList;

public ObservableCollection<string> ServerList
{
get { return _ServerList; }
set
{
if (_ServerList != value)
{
_ServerList = value;
OnPropertyChanged("ServerList");
}
}
}

private ObservableCollection<string> _LocationList;

public ObservableCollection<string> LocationList
{
get { return _LocationList; }
set
{
if (_LocationList != value)
{
_LocationList = value;
OnPropertyChanged("LocationList");
}
}
}

public DelegateCommand ToggleConnection { get; private set; }
public DelegateCommand SubmitText { get; set; }

private List<BufferInfo> BufferList = new List<BufferInfo>();

public MainViewModel()
{
ApplicationTitle = "Combot";
Config.LoadServers();
ServerList = new ObservableCollection<string>();
LocationList = new ObservableCollection<string>();

foreach (ServerConfig server in Config.Servers)
{
ServerList.Add(server.Name);
Bot Combot = new Bot(server);
/*
Combot.IRC.Message.ErrorMessageEvent += ErrorMessageHandler;
Combot.IRC.Message.ServerReplyEvent += ServerReplyHandler;
Combot.IRC.Message.ChannelMessageReceivedEvent += ChannelMessageReceivedHandler;
Combot.IRC.Message.ChannelNoticeReceivedEvent += ChannelNoticeReceivedHandler;
Combot.IRC.Message.PrivateMessageReceivedEvent += PrivateMessageReceivedHandler;
Combot.IRC.Message.PrivateNoticeReceivedEvent += PrivateNoticeReceivedHandler;
*/
Combot.IRC.Message.RawMessageEvent += RawMessageHandler;

Combot.IRC.ConnectEvent += ConnectHandler;
Combot.IRC.DisconnectEvent += DisconnectHandler;
Combot.IRC.TCPErrorEvent += TCPErrorHandler;

Combot.IRC.Message.ErrorMessageEvent += (sender, e) => ErrorMessageHandler(sender, e, server.Name);
Combot.IRC.Message.ServerReplyEvent += (sender, e) => ServerReplyHandler(sender, e, server.Name);
Combot.IRC.Message.ChannelMessageReceivedEvent += (sender, e) => ChannelMessageReceivedHandler(sender, e, server.Name);
Combot.IRC.Message.ChannelNoticeReceivedEvent += (sender, e) => ChannelNoticeReceivedHandler(sender, e, server.Name);
Combot.IRC.Message.PrivateMessageReceivedEvent += (sender, e) => PrivateMessageReceivedHandler(sender, e, server.Name);
Combot.IRC.Message.PrivateNoticeReceivedEvent += (sender, e) => PrivateNoticeReceivedHandler(sender, e, server.Name);
//Combot.IRC.Message.RawMessageEvent += RawMessageHandler;

Combot.IRC.Message.JoinChannelEvent += (sender, e) => JoinEventHandler(sender, e, server.Name);

Combot.IRC.ConnectEvent += () => ConnectHandler(server.Name);
Combot.IRC.DisconnectEvent += () => DisconnectHandler(server.Name);
Combot.IRC.TCPErrorEvent += e => TCPErrorHandler(e, server.Name);

CombotSessions.Add(Combot);
SelectedServer = server.Name;

if (server.AutoConnect)
{
Combot.Connect();
}
}

ToggleConnection = new DelegateCommand(ExecuteToggleConnection, CanToggleConnection);
SubmitText = new DelegateCommand(ExecuteSubmitText, CanSubmitText);
}

private void JoinEventHandler(object sender, JoinChannelInfo info, string server)
{
AddToBuffer(server, info.Channel, string.Format("{0} has joined {1}.", info.Nick.Nickname, info.Channel));
}

private void RawMessageHandler(object sender, string message)
{
CurrentBuffer += message + Environment.NewLine;
//CurrentBuffer += message + Environment.NewLine;
}

private void TCPErrorHandler(Combot.IRCServices.TCP.TCPError error)
private void TCPErrorHandler(Combot.IRCServices.TCP.TCPError error, string server)
{
CurrentBuffer += string.Format("[{0}] {1}", error.Code.ToString(), error.Message) + Environment.NewLine;
AddToBuffer(server, null, string.Format("[{0}] {1}", error.Code.ToString(), error.Message));
}

private void ServerReplyHandler(object sender, IReply reply)
private void ServerReplyHandler(object sender, IReply reply, string server)
{
CurrentBuffer += reply.Message + Environment.NewLine;
AddToBuffer(server, null, reply.Message);
}

private void ErrorMessageHandler(object sender, ErrorMessage message)
private void ErrorMessageHandler(object sender, ErrorMessage message, string server)
{
CurrentBuffer += message.Message + Environment.NewLine;
AddToBuffer(server, null, message.Message);
}

private void ChannelMessageReceivedHandler(object sender, ChannelMessage message)
private void ChannelMessageReceivedHandler(object sender, ChannelMessage message, string server)
{
CurrentBuffer += message.Message + Environment.NewLine;
AddToBuffer(server, message.Channel, message.Message);
}

private void ChannelNoticeReceivedHandler(object sender, ChannelNotice message)
private void ChannelNoticeReceivedHandler(object sender, ChannelNotice message, string server)
{
CurrentBuffer += message.Message + Environment.NewLine;
AddToBuffer(server, message.Channel, message.Message);
}

private void PrivateMessageReceivedHandler(object sender, PrivateMessage message)
private void PrivateMessageReceivedHandler(object sender, PrivateMessage message, string server)
{
CurrentBuffer += message.Message + Environment.NewLine;
AddToBuffer(server, message.Sender.Nickname, message.Message);
}

private void PrivateNoticeReceivedHandler(object sender, PrivateNotice message)
private void PrivateNoticeReceivedHandler(object sender, PrivateNotice message, string server)
{
CurrentBuffer += message.Message + Environment.NewLine;
AddToBuffer(server, message.Sender.Nickname, message.Message);
}

private void ConnectHandler()
private void ConnectHandler(string server)
{
Connected = true;
if (server == SelectedServer)
{
Connected = true;
}
}

private void DisconnectHandler()
private void DisconnectHandler(string server)
{
Connected = false;
if (server == SelectedServer)
{
Connected = false;
}
}

private void ExecuteToggleConnection()
{
if (_Connected)
{
Disconnect();
Disconnect(SelectedServer);
}
else
{
Connect();
Connect(SelectedServer);
}
}

@@ -124,14 +255,105 @@ namespace Interface.ViewModels
return true;
}

private void Connect()
private void ExecuteSubmitText()
{
if (SelectedLocation != " --Server-- ")
{
Bot botInstance = CombotSessions.Find(bot => bot.ServerConfig.Name == SelectedServer);
if (botInstance != null && botInstance.Connected)
{
string message = InputBoxText;
if (InputBoxText.StartsWith("/"))
{
MessageType type = MessageType.Query;
if (SelectedLocation.StartsWith("#") || SelectedLocation.StartsWith("&"))
{
type = MessageType.Channel;
}
message = message.Remove(0, 1);
message = string.Join("", botInstance.ServerConfig.CommandPrefix, message);
botInstance.ExecuteCommand(message, SelectedLocation, type);
}
else
{
botInstance.IRC.SendPrivateMessage(SelectedLocation, message);
}
InputBoxText = string.Empty;
}
}
}

private bool CanSubmitText()
{
return true;
}

private void Connect(string server)
{
CombotSessions.Find(bot => bot.ServerConfig.Name == server).Connect();
}

private void Disconnect(string server)
{
CombotSessions.Find(bot => bot.ServerConfig.Name == server).Disconnect();
}

private void AddToBuffer(string server, string location, string message)
{
if (location == null)
{
location = " --Server-- ";
}
if (!BufferList.Exists(buf => buf.Server == server && buf.Location == location))
{
BufferInfo newBuffer = new BufferInfo();
newBuffer.Server = server;
newBuffer.Location = location;
BufferList.Add(newBuffer);
}
if (SelectedServer == server && !LocationList.Contains(location))
{
App.Current.Dispatcher.Invoke((Action) (() => LocationList.Add(location)));
}
BufferInfo buffer = BufferList.Find(buf => buf.Server == server && buf.Location == location);
if (buffer.Buffer.Count >= 1000)
{
buffer.Buffer.RemoveAt(0);
}
buffer.Buffer.Add(message);
ChangeBuffer();
}

private void ChangeServer()
{
CombotSessions.ForEach(Combot => Combot.Connect());
App.Current.Dispatcher.Invoke((Action)(() => LocationList.Clear()));
for (int i = 0; i < BufferList.Count; i++)
{
if (BufferList[i].Server == SelectedServer)
{
App.Current.Dispatcher.Invoke((Action)(() => LocationList.Add(BufferList[i].Location)));
}
}
if (LocationList.Any())
{
SelectedLocation = LocationList.First();
}
}

private void Disconnect()
private void ChangeBuffer()
{
CombotSessions.ForEach(Combot => Combot.Disconnect());
if (SelectedServer != null && SelectedLocation != null)
{
if (!BufferList.Exists(buf => buf.Server == SelectedServer && buf.Location == SelectedLocation))
{
BufferInfo newBuffer = new BufferInfo();
newBuffer.Server = SelectedServer;
newBuffer.Location = SelectedLocation;
BufferList.Add(newBuffer);
}
CurrentBuffer = string.Join(Environment.NewLine, BufferList.Find(buf => buf.Server == SelectedServer && buf.Location == SelectedLocation).Buffer);
Connected = CombotSessions.Find(bot => bot.ServerConfig.Name == SelectedServer).Connected;
}
}
}
}

+ 30
- 23
Modules/Help/Help.cs View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;

namespace Combot.Modules.Plugins
{
@@ -30,7 +31,7 @@ namespace Combot.Modules.Plugins
private void SendFullHelp(string recipient, List<AccessType> access)
{
Bot.IRC.SendNotice(recipient, string.Format("You have the following commands available to use. " +
"To use them either type \u0002{1}\u001Fcommand trigger\u000F into a channel, send a private message by typing \u0002/msg {0} \u001Fcommand trigger\u000F, or send a notice by typing \u0002/notice {0} \u001Fcommand trigger\u000F. ",
"To use them either type \u0002{1}\u001Fcommand trigger\u001F\u0002 into a channel, send a private message by typing \u0002/msg {0} \u001Fcommand trigger\u001F\u0002, or send a notice by typing \u0002/notice {0} \u001Fcommand trigger\u001F\u0002. ",
Bot.IRC.Nickname, Bot.ServerConfig.CommandPrefix));
Bot.IRC.SendNotice(recipient, "\u200B");
List<string> commandList = new List<string>();
@@ -44,9 +45,9 @@ namespace Combot.Modules.Plugins
}
});
}
Bot.IRC.SendNotice(recipient, string.Format("\u0002{0}\u000F", string.Join("\u000F, \u0002", commandList)));
Bot.IRC.SendNotice(recipient, string.Format("\u0002{0}\u0002", string.Join("\u0002, \u0002", commandList)));
Bot.IRC.SendNotice(recipient, "\u200B");
Bot.IRC.SendNotice(recipient, string.Format("For more information on a specific command, including viewing the triggers, type \u0002{0}help \u001Fcommand\u000F.", Bot.ServerConfig.CommandPrefix));
Bot.IRC.SendNotice(recipient, string.Format("For more information on a specific command, including viewing the triggers, type \u0002{0}help \u001Fcommand\u001F\u0002.", Bot.ServerConfig.CommandPrefix));
}

private void SendCommandHelp(CommandMessage command)
@@ -60,7 +61,7 @@ namespace Combot.Modules.Plugins
{
if (foundCommand.AllowedAccess.Exists(allowed => command.Access.Contains(allowed)))
{
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("Help information for \u0002{0}\u000F", foundCommand.Name));
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("Help information for \u0002{0}\u0002", foundCommand.Name));
if (foundCommand.Description != string.Empty)
{
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("{0}", foundCommand.Description));
@@ -75,32 +76,45 @@ namespace Combot.Modules.Plugins
switch (messageType)
{
case MessageType.Channel:
messageSyntax = "\u0002/msg \u001Fchannel\u000F";
messageSyntax = "\u0002/msg \u001Fchannel\u001F\u0002";
break;
case MessageType.Query:
messageSyntax = string.Format("\u0002/msg {0}\u000F", Bot.IRC.Nickname);
messageSyntax = string.Format("\u0002/msg {0}\u0002", Bot.IRC.Nickname);
break;
case MessageType.Notice:
messageSyntax = string.Format("\u0002/notice {0}\u000F", Bot.IRC.Nickname);
messageSyntax = string.Format("\u0002/notice {0}\u0002", Bot.IRC.Nickname);
break;
}
List<CommandArgument> validArguments = foundCommand.Arguments.FindAll(arg => arg.MessageTypes.Contains(messageType));
string argHelp = string.Empty;
if (validArguments.Count > 0)
{
argHelp = string.Format(" \u0002{0}\u000F", string.Join(" ", validArguments.Select(arg =>
argHelp = string.Format(" \u0002{0}\u0002", string.Join(" ", validArguments.Select(arg =>
{
string argString = string.Empty;
if (arg.DependentArguments.Count > 0)
{
argString = "(";
}
if (arg.Required)
{
return "\u001F" + arg.Name + "\u000F\u0002";
argString += "\u001F" + arg.Name + "\u001F";
}
return "[\u001F" + arg.Name + "\u000F\u0002]";
else
{
argString += "[\u001F" + arg.Name + "\u001F]";
}
if (arg.DependentArguments.Count > 0)
{
argString += string.Format("\u0002:When {0}\u0002)", string.Join(" or ", arg.DependentArguments.Select(dep => { return string.Format("\u0002\u001F{0}\u001F\u0002=\u0002{1}\u0002", dep.Name, string.Join(",", dep.Values)); })));
}
return argString;
})));
}
if (foundCommand.Triggers.Any())
{
string triggerString = (foundCommand.Triggers.Count > 1) ? string.Format("({0})", string.Join("|", foundCommand.Triggers)) : foundCommand.Triggers.First();
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("Syntax: {0} {1}\u0002{2}\u000F{3}", messageSyntax, Bot.ServerConfig.CommandPrefix, triggerString, argHelp));
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("Syntax: {0} {1}\u0002{2}\u0002{3}", messageSyntax, Bot.ServerConfig.CommandPrefix, triggerString, argHelp));
}

// Display argument help
@@ -113,17 +127,10 @@ namespace Combot.Modules.Plugins
{
commandDesc = string.Format(" - {0}", arg.Description);
}
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("\t\t\u0002{0}\u000F{1}", arg.Name, commandDesc));
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("\t\t\u0002{0}\u0002{1}", arg.Name, commandDesc));
if (arg.AllowedValues.Count > 0)
{
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("\t\t\t\tAllowed Values: \u0002{0}\u000F", string.Join(", ", arg.AllowedValues)));
}
if (arg.DependentArguments.Count > 0)
{
foreach (CommandArgument.DependentArgumentInfo dependentArgument in arg.DependentArguments)
{
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("\t\t\t\tOnly used when \u0002{0}\u000F is \u0002{1}\u000F.", dependentArgument.Name, string.Join(", or ", dependentArgument.Values)));
}
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("\t\t\t\tAllowed Values: \u0002{0}\u0002", string.Join(", ", arg.AllowedValues)));
}
});
}
@@ -131,17 +138,17 @@ namespace Combot.Modules.Plugins
}
else
{
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("You do not have access to view help on \u0002{0}\u000F.", helpCommand));
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("You do not have access to view help on \u0002{0}\u0002.", helpCommand));
}
}
else
{
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("The command \u0002{0}\u000F does not exist.", helpCommand));
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("The command \u0002{0}\u0002 does not exist.", helpCommand));
}
}
else
{
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("The command \u0002{0}\u000F does not exist.", helpCommand));
Bot.IRC.SendNotice(command.Nick.Nickname, string.Format("The command \u0002{0}\u0002 does not exist.", helpCommand));
}
}
}

+ 248
- 14
Modules/Introductions/Introductions.cs View File

@@ -27,10 +27,13 @@ namespace Combot.Modules.Plugins
AddIntroduction(command);
break;
case "edit":
EditIntroduction(command);
break;
case "delete":
DeleteIntroduction(command);
break;
case "view":
ViewIntroduction(command);
break;
}
break;
@@ -39,36 +42,46 @@ namespace Combot.Modules.Plugins

private void HandleJoinEvent(object sender, JoinChannelInfo info)
{
List<Dictionary<string, object>> results = GetIntroductionList(info.Channel, info.Nick.Nickname);
if (results.Any())
{
Random randNum = new Random();
int index = randNum.Next(results.Count - 1);
Dictionary<string, object> intro = results[index];
Bot.IRC.SendPrivateMessage(info.Channel, string.Format("\u200B{0}", intro["message"]));
}
}

private void AddIntroduction(CommandMessage command)
{
string channel = command.Arguments.ContainsKey("Channel") ? command.Arguments["Channel"] : command.Location;
Database database = new Database(Bot.ServerConfig.Database);

// Check to see if they have reached the max number of introductions
string search = "SELECT `introductions`.`id` FROM `introductions` INNER JOIN `nicks` " +
"ON `introductions`.`nick_id` = `nicks`.`id` " +
"INNER JOIN `channels` " +
"ON `introductions`.`channel_id` = `channels`.`id` " +
"INNER JOIN `servers` " +
"ON `nicks`.`server_id` = `servers`.`id` " +
"WHERE `servers`.`name` = {0} AND `channels`.`name` = {1} AND `nicks`.`nickname` = {2}";
List<Dictionary<string, object>> results = database.Query(search, new object[] { Bot.ServerConfig.Name, channel, command.Nick.Nickname });
List<Dictionary<string, object>> results = GetIntroductionList(channel, command.Nick.Nickname);

if (results.Count < Convert.ToInt32(GetOptionValue("Max Introductions")))
{

AddChannel(channel);
AddNick(command.Nick.Nickname);
Database database = new Database(Bot.ServerConfig.Database);
string query = "INSERT INTO `introductions` SET " +
"`server_id` = (SELECT `id` FROM `servers` WHERE `name` = {0}), " +
"`channel_id` = (SELECT `channels`.`id` FROM `channels` INNER JOIN `servers` ON `servers`.`id` = `channels`.`server_id` WHERE `servers`.`name` = {1} && `channels`.`name` = {2}), " +
"`nick_id` = (SELECT `nicks`.`id` FROM `nicks` INNER JOIN `servers` ON `servers`.`id` = `nicks`.`server_id` WHERE `servers`.`name` = {3} && `nickname` = {4}), " +
"`message` = {5}, " +
"`date_added` = {6}";
database.Execute(query, new object[] {Bot.ServerConfig.Name, Bot.ServerConfig.Name, channel, Bot.ServerConfig.Name, command.Nick.Nickname, command.Arguments["Message"], command.TimeStamp});
database.Execute(query, new object[] { Bot.ServerConfig.Name, Bot.ServerConfig.Name, channel, Bot.ServerConfig.Name, command.Nick.Nickname, command.Arguments["Message"], command.TimeStamp });
string introMessage = string.Format("Added introduction. You now have \u0002{0}\u0002 introductions set.", results.Count + 1);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, introMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, introMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, introMessage);
break;
}
}
else
{
@@ -87,5 +100,226 @@ namespace Combot.Modules.Plugins
}
}
}

private void EditIntroduction(CommandMessage command)
{
string channel = command.Arguments.ContainsKey("Channel") ? command.Arguments["Channel"] : command.Location;
List<Dictionary<string, object>> results = GetIntroductionList(channel, command.Nick.Nickname);
int num = 0;
if (int.TryParse(command.Arguments["ID"], out num))
{
if (results.Count >= num)
{
int id = Convert.ToInt32(results[num - 1]["id"]);
Database database = new Database(Bot.ServerConfig.Database);
string query = "UPDATE `introductions` SET " +
"`message` = {0} " +
"WHERE `id` = {1}";
database.Execute(query, new object[] { command.Arguments["Message"], id });
string introMessage = string.Format("Introduction #\u0002{0}\u0002 is now: {1}", num, command.Arguments["Message"]);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, introMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, introMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, introMessage);
break;
}
}
else
{
string invalid = "Invalid introduction ID.";
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, invalid);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, invalid);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, invalid);
break;
}
}
}
else
{
string invalid = "Invalid introduction ID.";
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, invalid);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, invalid);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, invalid);
break;
}
}
}

private void DeleteIntroduction(CommandMessage command)
{
string channel = command.Arguments.ContainsKey("Channel") ? command.Arguments["Channel"] : command.Location;
List<Dictionary<string, object>> results = GetIntroductionList(channel, command.Nick.Nickname);
int num = 0;
if (int.TryParse(command.Arguments["ID"], out num))
{
if (results.Count >= num)
{
int id = Convert.ToInt32(results[num - 1]["id"]);
Database database = new Database(Bot.ServerConfig.Database);
string query = "DELETE FROM `introductions` " +
"WHERE `id` = {0}";
database.Execute(query, new object[] { id });
string introMessage = string.Format("Introduction #\u0002{0}\u0002 has been deleted.", num);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, introMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, introMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, introMessage);
break;
}
}
else
{
string invalid = "Invalid introduction ID.";
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, invalid);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, invalid);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, invalid);
break;
}
}
}
else
{
string invalid = "Invalid introduction ID.";
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, invalid);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, invalid);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, invalid);
break;
}
}
}

private void ViewIntroduction(CommandMessage command)
{
string channel = command.Arguments.ContainsKey("Channel") ? command.Arguments["Channel"] : command.Location;
List<Dictionary<string, object>> results = GetIntroductionList(channel, command.Nick.Nickname);
int num = 0;
if (command.Arguments.ContainsKey("ID"))
{
if (int.TryParse(command.Arguments["ID"], out num))
{
if (results.Count >= num)
{
string introMessage = string.Format("Introduction #\u0002{0}\u0002: {1}", num, results[num - 1]["message"]);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, introMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, introMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, introMessage);
break;
}
}
else
{
string invalid = "Invalid introduction ID.";
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, invalid);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, invalid);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, invalid);
break;
}
}
}
else
{
string invalid = "Invalid introduction ID.";
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, invalid);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, invalid);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, invalid);
break;
}
}
}
else
{
for (int i = 0; i < results.Count; i++)
{
string introMessage = string.Format("Introduction #\u0002{0}\u0002: {1}", i + 1, results[i]["message"]);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendNotice(command.Nick.Nickname, introMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, introMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, introMessage);
break;
}
}
}
}

private List<Dictionary<string, object>> GetIntroductionList(string channel, string nickname)
{
Database database = new Database(Bot.ServerConfig.Database);
// Check to see if they have reached the max number of introductions
string search = "SELECT `introductions`.`id`, `introductions`.`message` FROM `introductions` INNER JOIN `nicks` " +
"ON `introductions`.`nick_id` = `nicks`.`id` " +
"INNER JOIN `channels` " +
"ON `introductions`.`channel_id` = `channels`.`id` " +
"INNER JOIN `servers` " +
"ON `nicks`.`server_id` = `servers`.`id` " +
"WHERE `servers`.`name` = {0} AND `channels`.`name` = {1} AND `nicks`.`nickname` = {2}";
return database.Query(search, new object[] { Bot.ServerConfig.Name, channel, nickname });
}
}
}

+ 6
- 0
Modules/Introductions/Module.config View File

@@ -108,6 +108,12 @@
2
],
"AllowedAccess": [
0,
1,
2,
3,
4,
5,
6
],
"ShowHelp": true,

+ 4
- 4
Modules/Logging/Logging.cs View File

@@ -26,6 +26,7 @@ namespace Combot.Modules.Plugins

private void LogChannelMessage(object sender, ChannelMessage message)
{
AddChannel(message.Channel);
AddNick(message.Sender.Nickname);
Database database = new Database(Bot.ServerConfig.Database);
string query = "INSERT INTO `channelmessages` SET " +
@@ -51,10 +52,7 @@ namespace Combot.Modules.Plugins

private void LogChannelJoin(object sender, JoinChannelInfo info)
{
if (info.Nick.Nickname == Bot.IRC.Nickname)
{
AddChannel(info.Channel);
}
AddChannel(info.Channel);
AddNick(info.Nick.Nickname);
Database database = new Database(Bot.ServerConfig.Database);
string query = "INSERT INTO `channeljoins` SET " +
@@ -67,6 +65,7 @@ namespace Combot.Modules.Plugins

private void LogChannelPart(object sender, PartChannelInfo info)
{
AddChannel(info.Channel);
AddNick(info.Nick.Nickname);
Database database = new Database(Bot.ServerConfig.Database);
string query = "INSERT INTO `channelparts` SET " +
@@ -79,6 +78,7 @@ namespace Combot.Modules.Plugins

private void LogChannelKick(object sender, KickInfo info)
{
AddChannel(info.Channel);
AddNick(info.Nick.Nickname);
AddNick(info.KickedNick.Nickname);
Database database = new Database(Bot.ServerConfig.Database);

+ 1
- 0
Modules/Logging/Logging.csproj View File

@@ -56,6 +56,7 @@
<ItemGroup>
<None Include="Module.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

+ 161
- 0
Modules/Messaging/Messaging.cs View File

@@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Combot.Databases;
using Combot.IRCServices.Messaging;

namespace Combot.Modules.Plugins
{
public class Messaging : Module
{
public override void Initialize()
{
Bot.CommandReceivedEvent += HandleCommandEvent;
Bot.IRC.Message.ChannelMessageReceivedEvent += HandleChannelMessage;
Bot.IRC.Message.PrivateMessageReceivedEvent += HandlePrivateMessage;
Bot.IRC.Message.ChannelNoticeReceivedEvent += HandleChannelNotice;
Bot.IRC.Message.PrivateNoticeReceivedEvent += HandlePrivateNotice;
}

public override void ParseCommand(CommandMessage command)
{
Command foundCommand = Commands.Find(c => c.Triggers.Contains(command.Command));
switch (foundCommand.Name)
{
case "Message":
AddMessage(command);
break;
case "Anonymous Message":
AddMessage(command, true);
break;
}
}

private void HandleChannelMessage(object sender, ChannelMessage message)
{
CheckMessages(message.Sender.Nickname);
}

private void HandlePrivateMessage(object sender, PrivateMessage message)
{
CheckMessages(message.Sender.Nickname);
}

private void HandleChannelNotice(object sender, ChannelNotice message)
{
CheckMessages(message.Sender.Nickname);
}

private void HandlePrivateNotice(object sender, PrivateNotice message)
{
CheckMessages(message.Sender.Nickname);
}

private void AddMessage(CommandMessage command, bool anonymous = false)
{
List<Dictionary<string, object>> currentMessages = GetSentMessages(command.Arguments["Nickname"]);
int numMessages = currentMessages.Select(msg => GetNickname((int) msg["nick_id"]) == command.Nick.Nickname).Count();
if (numMessages < GetOptionValue("Max Messages"))
{
AddNick(command.Nick.Nickname);
AddNick(command.Arguments["Nickname"]);
Database database = new Database(Bot.ServerConfig.Database);
string query = "INSERT INTO `messages` SET " +
"`server_id` = (SELECT `id` FROM `servers` WHERE `name` = {0}), " +
"`nick_id` = (SELECT `nicks`.`id` FROM `nicks` INNER JOIN `servers` ON `servers`.`id` = `nicks`.`server_id` WHERE `servers`.`name` = {1} && `nickname` = {2}), " +
"`sender_nick_id` = (SELECT `nicks`.`id` FROM `nicks` INNER JOIN `servers` ON `servers`.`id` = `nicks`.`server_id` WHERE `servers`.`name` = {3} && `nickname` = {4}), " +
"`message` = {5}, " +
"`anonymous` = {6}, " +
"`date_posted` = {7}";
database.Execute(query, new object[] { Bot.ServerConfig.Name, Bot.ServerConfig.Name, command.Arguments["Nickname"], Bot.ServerConfig.Name, command.Nick.Nickname, command.Arguments["Message"], anonymous, command.TimeStamp });
string message = string.Format("I will send your message to \u0002{0}\u0002 as soon as I see them.", command.Arguments["Nickname"]);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, message);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, message);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, message);
break;
}
}
else
{
string maxMessage = string.Format("You already have sent the maximum number of messages to \u0002{0}\u0002. Wait until they have read their messages before sending another.");
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, maxMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, maxMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, maxMessage);
break;
}
}
}

private void CheckMessages(string nickname)
{
List<Dictionary<string, object>> receivedMessages = GetReceivedMessages(nickname);
if (receivedMessages.Any())
{
for (int i = 0; i < receivedMessages.Count; i++)
{
DateTime dateSent = (DateTime)receivedMessages[i]["date_posted"];
string message = receivedMessages[i]["message"].ToString();
if ((bool) receivedMessages[i]["anonymous"])
{
Bot.IRC.SendPrivateMessage(nickname, string.Format("An anonymous sender has left you a message on \u0002{0}\u0002", dateSent.ToString("MMMM d, yyyy h:mm:ss tt")));
Bot.IRC.SendPrivateMessage(nickname, string.Format("\"{0}\"", message));
}
else
{
string sentNick = GetNickname((int) receivedMessages[i]["sender_nick_id"]);
Bot.IRC.SendPrivateMessage(nickname, string.Format("\u0002{0}\u0002 has left you a message on \u0002{1}\u0002", sentNick, dateSent.ToString("MMMM d, yyyy h:mm:ss tt")));
Bot.IRC.SendPrivateMessage(nickname, string.Format("\"{0}\"", message));
Bot.IRC.SendPrivateMessage(nickname, string.Format("If you would like to reply to them, please type \u0002{0}{1} {2} \u001FMessage\u001F\u0002", Bot.ServerConfig.CommandPrefix, Commands.Find(cmd => cmd.Name == "Message").Triggers.First(), sentNick));
}
DeleteMessage((int) receivedMessages[i]["id"]);
}
}
}

private List<Dictionary<string, object>> GetSentMessages(string nick)
{
Database database = new Database(Bot.ServerConfig.Database);
string search = "SELECT `messages`.`message`, `messages`.`nick_id`, `messages`.`date_posted`, `messages`.`anonymous` FROM `messages` " +
"INNER JOIN `nicks` " +
"ON `messages`.`sender_nick_id` = `nicks`.`id` " +
"INNER JOIN `servers` " +
"ON `messages`.`server_id` = `servers`.`id` " +
"WHERE `servers`.`name` = {0} AND `nicks`.`nickname` = {1}";
return database.Query(search, new object[] { Bot.ServerConfig.Name, nick });
}

private List<Dictionary<string, object>> GetReceivedMessages(string nick)
{
Database database = new Database(Bot.ServerConfig.Database);
string search = "SELECT `messages`.`id`, `messages`.`message`, `messages`.`sender_nick_id`, `messages`.`date_posted`, `messages`.`anonymous` FROM `messages` " +
"INNER JOIN `nicks` " +
"ON `messages`.`nick_id` = `nicks`.`id` " +
"INNER JOIN `servers` " +
"ON `messages`.`server_id` = `servers`.`id` " +
"WHERE `servers`.`name` = {0} AND `nicks`.`nickname` = {1}";
return database.Query(search, new object[] { Bot.ServerConfig.Name, nick });
}

private void DeleteMessage(int messageId)
{
Database database = new Database(Bot.ServerConfig.Database);
string query = "DELETE FROM `messages` " +
"WHERE `id` = {0}";
database.Execute(query, new object[] { messageId });
}
}
}

+ 74
- 0
Modules/Messaging/Messaging.csproj View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2434E995-592F-4EE2-B321-033B7493F93E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Messaging</RootNamespace>
<AssemblyName>Messaging</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Bin\Modules\Messaging\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Bin\Modules\Messaging\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Messaging.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Combot\Combot.csproj">
<Project>{23e4c371-16e4-4fac-8b11-44288399bb55}</Project>
<Name>Combot</Name>
</ProjectReference>
<ProjectReference Include="..\..\IRCServices\IRCServices.csproj">
<Project>{65fcbf1c-8c9e-4688-becc-185d9030899f}</Project>
<Name>IRCServices</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Module.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>mkdir "$(SolutionDir)Bin\Interface\$(ConfigurationName)\Modules\$(TargetName)"
copy /Y "$(TargetPath)" "$(SolutionDir)Bin\Interface\$(ConfigurationName)\Modules\$(TargetName)"
copy /Y "$(TargetDir)Module.config" "$(SolutionDir)Bin\Interface\$(ConfigurationName)\Modules\$(TargetName)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

+ 67
- 0
Modules/Messaging/Module.config View File

@@ -0,0 +1,67 @@
{
"Name": "Messaging",
"ClassName": "Messaging",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Commands": [
{
"Name": "Message",
"Description": "Sends a message to a nick the next time they are seen active.",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Triggers": [
"msg",
"message"
],
"Arguments": [
{
"Name": "Nickname",
"Description": "The nickname you want to send a message to.",
"AllowedValues": [],
"MessageTypes": [
0,
1,
2
],
"Required": true
},
{
"Name": "Message",
"Description": "The message you want to send.",
"AllowedValues": [],
"MessageTypes": [
0,
1,
2
],
"Required": true
}
],
"AllowedMessageTypes": [
0,
1,
2
],
"AllowedAccess": [
0,
1,
2,
3,
4,
5,
6
],
"ShowHelp": true,
"SpamCheck": true
}
],
"Options": [
{
"Name": "Max Messages",
"Description": "The maximum number of messages a nick can receive from another nick at a time.",
"Value": 3
}
]
}

+ 36
- 0
Modules/Messaging/Properties/AssemblyInfo.cs View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Messaging Module")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Teknik")]
[assembly: AssemblyProduct("Combot")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5c350b8e-5820-4034-9d67-49d2ddbfcc6f")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 60
- 0
Modules/Quotes/Module.config View File

@@ -0,0 +1,60 @@
{
"Name": "Quotes",
"ClassName": "Quotes",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Commands": [
{
"Name": "Quote",
"Description": "View a random quote from a channel or nick.",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Triggers": [
"quote"
],
"Arguments": [
{
"Name": "Channel",
"Description": "The channel you want to modify the intro on.",
"AllowedValues": [],
"DependentArguments": [],
"MessageTypes": [
1,
2
],
"Required": true
},
{
"Name": "Nickname",
"Description": "The nickname you want to view a quote of.",
"AllowedValues": [],
"MessageTypes": [
0,
1,
2
],
"Required": false
}
],
"AllowedMessageTypes": [
0,
1,
2
],
"AllowedAccess": [
0,
1,
2,
3,
4,
5,
6
],
"ShowHelp": true,
"SpamCheck": true
}
],
"Options": []
}

+ 36
- 0
Modules/Quotes/Properties/AssemblyInfo.cs View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Quotes Module")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Teknik")]
[assembly: AssemblyProduct("Combot")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5c350b8e-5820-4034-9d67-49d2ddbfcc6f")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 122
- 0
Modules/Quotes/Quotes.cs View File

@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Combot.Databases;

namespace Combot.Modules.Plugins
{
public class Quotes : Module
{
public override void Initialize()
{
Bot.CommandReceivedEvent += HandleCommandEvent;
}

public override void ParseCommand(CommandMessage command)
{
Command foundCommand = Commands.Find(c => c.Triggers.Contains(command.Command));
switch (foundCommand.Name)
{
case "Quote":
GetQuote(command);
break;
}
}

private void GetQuote(CommandMessage command)
{
string channel = command.Arguments.ContainsKey("Channel") ? command.Arguments["Channel"] : command.Location;
List<Dictionary<string, object>> results = new List<Dictionary<string, object>>();
if (command.Arguments.ContainsKey("Nickname"))
{
results = GetQuoteList(channel, command.Arguments["Nickname"]);
}
else
{
results = GetQuoteList(channel);
}
if (results.Any())
{
Random randNum = new Random();
int index = randNum.Next(results.Count - 1);
Dictionary<string, object> quote = results[index];
string quoteMessage = string.Format("[{0}] {1}", quote["nickname"], quote["message"]);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, quoteMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, quoteMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, quoteMessage);
break;
}
}
else
{
if (command.Arguments.ContainsKey("Nickname"))
{
string quoteMessage = string.Format("There are no quotes for \u0002{0}\u0002", command.Arguments["Nickname"]);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, quoteMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, quoteMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, quoteMessage);
break;
}
}
else
{
string quoteMessage = string.Format("There are no quotes for \u0002{0}\u0002.", channel);
switch (command.MessageType)
{
case MessageType.Channel:
Bot.IRC.SendPrivateMessage(command.Location, quoteMessage);
break;
case MessageType.Query:
Bot.IRC.SendPrivateMessage(command.Nick.Nickname, quoteMessage);
break;
case MessageType.Notice:
Bot.IRC.SendNotice(command.Nick.Nickname, quoteMessage);
break;
}
}
}
}

private List<Dictionary<string, object>> GetQuoteList(string channel)
{
Database database = new Database(Bot.ServerConfig.Database);
string search = "SELECT `channelmessages`.`message`, `nicks`.`nickname` FROM `channelmessages` " +
"INNER JOIN `nicks` " +
"ON `channelmessages`.`nick_id` = `nicks`.`id` " +
"INNER JOIN `channels` " +
"ON `channelmessages`.`channel_id` = `channels`.`id` " +
"INNER JOIN `servers` " +
"ON `channelmessages`.`server_id` = `servers`.`id` " +
"WHERE `servers`.`name` = {0} AND `channels`.`name` = {1}";
return database.Query(search, new object[] { Bot.ServerConfig.Name, channel });
}

private List<Dictionary<string, object>> GetQuoteList(string channel, string nickname)
{
Database database = new Database(Bot.ServerConfig.Database);
string search = "SELECT `channelmessages`.`message`, `nicks`.`nickname` FROM `channelmessages` " +
"INNER JOIN `nicks` " +
"ON `channelmessages`.`nick_id` = `nicks`.`id` " +
"INNER JOIN `channels` " +
"ON `channelmessages`.`channel_id` = `channels`.`id` " +
"INNER JOIN `servers` " +
"ON `channelmessages`.`server_id` = `servers`.`id` " +
"WHERE `servers`.`name` = {0} AND `channels`.`name` = {1} AND `nicks`.`nickname` = {2}";
return database.Query(search, new object[] { Bot.ServerConfig.Name, channel, nickname });
}
}
}

+ 74
- 0
Modules/Quotes/Quotes.csproj View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9ADA4844-4566-4C2E-8649-3D87E2F76563}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Quotes</RootNamespace>
<AssemblyName>Quotes</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Bin\Modules\Quotes\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Bin\Modules\Quotes\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Quotes.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Combot\Combot.csproj">
<Project>{23e4c371-16e4-4fac-8b11-44288399bb55}</Project>
<Name>Combot</Name>
</ProjectReference>
<ProjectReference Include="..\..\IRCServices\IRCServices.csproj">
<Project>{65fcbf1c-8c9e-4688-becc-185d9030899f}</Project>
<Name>IRCServices</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Module.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>mkdir "$(SolutionDir)Bin\Interface\$(ConfigurationName)\Modules\$(TargetName)"
copy /Y "$(TargetPath)" "$(SolutionDir)Bin\Interface\$(ConfigurationName)\Modules\$(TargetName)"
copy /Y "$(TargetDir)Module.config" "$(SolutionDir)Bin\Interface\$(ConfigurationName)\Modules\$(TargetName)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

+ 49
- 0
Modules/Seen/Module.config View File

@@ -0,0 +1,49 @@
{
"Name": "Seen",
"ClassName": "Seen",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Commands": [
{
"Name": "Seen",
"Description": "Displays the last seen action of a nick.",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Triggers": [
"seen"
],
"Arguments": [
{
"Name": "Nickname",
"Description": "The nickname you want to view the information on.",
"AllowedValues": [],
"MessageTypes": [
0,
1,
2
],
"Required": true
}
],
"AllowedMessageTypes": [
0,
1,
2
],
"AllowedAccess": [
0,
1,
2,
3,
4,
5,
6
],
"ShowHelp": true,
"SpamCheck": true
}
],
"Options": []
}

+ 36
- 0
Modules/Seen/Properties/AssemblyInfo.cs View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.