@@ -117,7 +117,11 @@ | |||
<Install>false</Install> | |||
</BootstrapperPackage> | |||
</ItemGroup> | |||
<ItemGroup /> | |||
<ItemGroup> | |||
<Content Include="Modules\CreateTable.sql"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<Import Project="..\packages\GitVersionTask.2.0.1\Build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.2.0.1\Build\GitVersionTask.targets')" /> | |||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
@@ -0,0 +1,48 @@ | |||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- Table structure for table `servers` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `servers` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`Name` varchar(50) NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `channels` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `channels` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`requester_id` varchar(50) NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `nicks` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `nicks` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`nickname` varchar(50) NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `nickinfo` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `nickinfo` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`nick_id` int(11) NOT NULL, | |||
`username` varchar(50) NULL, | |||
`realname` varchar(50) NULL, | |||
`host` varchar(100) NULL, | |||
`date_added` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |
@@ -45,6 +45,8 @@ namespace Combot.Modules | |||
public Module() | |||
{ | |||
InitializeTable(); | |||
SetDefaults(); | |||
ConfigRWLock = new ReaderWriterLockSlim(); | |||
ConfigFileRWLock = new ReaderWriterLockSlim(); | |||
@@ -54,6 +56,16 @@ namespace Combot.Modules | |||
JsonSettings.Formatting = Formatting.Indented; | |||
} | |||
private void InitializeTable() | |||
{ | |||
string sqlPath = Path.Combine(Directory.GetCurrentDirectory(), "CreateTable.sql"); | |||
if (File.Exists(sqlPath)) | |||
{ | |||
string query = File.ReadAllText(sqlPath); | |||
Bot.Database.Execute(query); | |||
} | |||
} | |||
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. |
@@ -60,6 +60,11 @@ | |||
</None> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="CreateTable.sql"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<PropertyGroup> | |||
<PostBuildEvent>md "$(SolutionDir)$(ConfigurationName)\Modules\$(TargetName)" |
@@ -2,6 +2,7 @@ | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using Combot.Databases; | |||
using System.IO; | |||
namespace Combot.Modules.Plugins | |||
{ | |||
@@ -9,9 +10,21 @@ namespace Combot.Modules.Plugins | |||
{ | |||
public override void Initialize() | |||
{ | |||
InitializeTable(); | |||
Bot.CommandReceivedEvent += HandleCommandEvent; | |||
} | |||
private void InitializeTable() | |||
{ | |||
string sqlPath = Path.Combine(Directory.GetCurrentDirectory(), ConfigPath, "CreateTable.sql"); | |||
if (File.Exists(sqlPath)) | |||
{ | |||
string query = File.ReadAllText(sqlPath); | |||
Bot.Database.Execute(query); | |||
} | |||
} | |||
public override void ParseCommand(CommandMessage command) | |||
{ | |||
string channel = command.Arguments.ContainsKey("Channel") ? command.Arguments["Channel"] : command.Location; |
@@ -0,0 +1,15 @@ | |||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- Table structure for table `channelrules` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `channelrules` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`rule` text NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |
@@ -0,0 +1,20 @@ | |||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- Table structure for table `customcommands` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `customcommands` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`type` varchar(200) NOT NULL DEFAULT 'response', | |||
`permission` varchar(200) NOT NULL DEFAULT 'all', | |||
`channels` varchar(200) NOT NULL, | |||
`nicknames` varchar(200) NOT NULL, | |||
`trigger` varchar(200) NOT NULL, | |||
`response` text NOT NULL, | |||
`date_added` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |
@@ -59,6 +59,11 @@ | |||
</None> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="CreateTable.sql"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<PropertyGroup> | |||
<PostBuildEvent>md "$(SolutionDir)$(ConfigurationName)\Modules\$(TargetName)" |
@@ -5,6 +5,7 @@ using System.Linq; | |||
using System.Text.RegularExpressions; | |||
using Combot.IRCServices; | |||
using Combot.IRCServices.Messaging; | |||
using System.IO; | |||
namespace Combot.Modules.Plugins | |||
{ | |||
@@ -12,6 +13,8 @@ namespace Combot.Modules.Plugins | |||
{ | |||
public override void Initialize() | |||
{ | |||
InitializeTable(); | |||
Bot.CommandReceivedEvent += HandleCommandEvent; | |||
Bot.IRC.Message.ChannelMessageReceivedEvent += HandleChannelMessage; | |||
Bot.IRC.Message.PrivateMessageReceivedEvent += HandlePrivateMessage; | |||
@@ -19,6 +22,16 @@ namespace Combot.Modules.Plugins | |||
Bot.IRC.Message.PrivateNoticeReceivedEvent += HandlePrivateNotice; | |||
} | |||
private void InitializeTable() | |||
{ | |||
string sqlPath = Path.Combine(Directory.GetCurrentDirectory(), ConfigPath, "CreateTable.sql"); | |||
if (File.Exists(sqlPath)) | |||
{ | |||
string query = File.ReadAllText(sqlPath); | |||
Bot.Database.Execute(query); | |||
} | |||
} | |||
public override void ParseCommand(CommandMessage command) | |||
{ | |||
Command foundCommand = Commands.Find(c => c.Triggers.Contains(command.Command)); |
@@ -0,0 +1,16 @@ | |||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- Table structure for table `introductions` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `introductions` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`message` text NOT NULL, | |||
`date_posted` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |
@@ -3,6 +3,7 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using Combot.Databases; | |||
using Combot.IRCServices.Messaging; | |||
using System.IO; | |||
namespace Combot.Modules.Plugins | |||
{ | |||
@@ -10,10 +11,22 @@ namespace Combot.Modules.Plugins | |||
{ | |||
public override void Initialize() | |||
{ | |||
InitializeTable(); | |||
Bot.CommandReceivedEvent += HandleCommandEvent; | |||
Bot.IRC.Message.JoinChannelEvent += HandleJoinEvent; | |||
} | |||
private void InitializeTable() | |||
{ | |||
string sqlPath = Path.Combine(Directory.GetCurrentDirectory(), ConfigPath, "CreateTable.sql"); | |||
if (File.Exists(sqlPath)) | |||
{ | |||
string query = File.ReadAllText(sqlPath); | |||
Bot.Database.Execute(query); | |||
} | |||
} | |||
public override void ParseCommand(CommandMessage command) | |||
{ | |||
Command foundCommand = Commands.Find(c => c.Triggers.Contains(command.Command)); |
@@ -93,6 +93,11 @@ | |||
<Install>false</Install> | |||
</BootstrapperPackage> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="CreateTable.sql"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<PropertyGroup> | |||
<PostBuildEvent>md "$(SolutionDir)$(ConfigurationName)\Modules\$(TargetName)" |
@@ -0,0 +1,97 @@ | |||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- Table structure for table `channelinvites` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `channelinvites` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`requester_id` int(11) NOT NULL, | |||
`recipient_id` int(11) NOT NULL, | |||
`date_invited` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `channeljoins` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `channeljoins` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `channelkicks` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `channelkicks` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`kicked_nick_id` int(11) NOT NULL, | |||
`reason` varchar(500) NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `channelparts` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `channelparts` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `channelparts` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `quits` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`message` text NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `channelmessages` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `channelmessages` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`message` text NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; | |||
-- | |||
-- Table structure for table `privatemessages` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `privatemessages` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`message` text NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |
@@ -20,6 +20,8 @@ namespace Combot.Modules.Plugins | |||
public override void Initialize() | |||
{ | |||
InitializeTable(); | |||
logLock = new ReaderWriterLockSlim(); | |||
Bot.IRC.ConnectEvent += AddServer; | |||
@@ -37,6 +39,16 @@ namespace Combot.Modules.Plugins | |||
Bot.IRC.Message.NickChangeEvent += LogNickChange; | |||
} | |||
private void InitializeTable() | |||
{ | |||
string sqlPath = Path.Combine(Directory.GetCurrentDirectory(), ConfigPath, "CreateTable.sql"); | |||
if (File.Exists(sqlPath)) | |||
{ | |||
string query = File.ReadAllText(sqlPath); | |||
Bot.Database.Execute(query); | |||
} | |||
} | |||
private void LogChannelMessage(object sender, ChannelMessage message) | |||
{ | |||
if (!ChannelBlacklist.Contains(message.Channel) |
@@ -61,6 +61,11 @@ | |||
</None> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="CreateTable.sql"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<PropertyGroup> | |||
<PostBuildEvent>md "$(SolutionDir)$(ConfigurationName)\Modules\$(TargetName)" |
@@ -0,0 +1,17 @@ | |||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- Table structure for table `messages` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `messages` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`sender_nick_id` int(11) NOT NULL, | |||
`message` text NOT NULL, | |||
`anonymous` tinyint(1) NOT NULL, | |||
`date_posted` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |
@@ -4,6 +4,7 @@ using System.Linq; | |||
using Combot.Databases; | |||
using Combot.IRCServices; | |||
using Combot.IRCServices.Messaging; | |||
using System.IO; | |||
namespace Combot.Modules.Plugins | |||
{ | |||
@@ -11,6 +12,8 @@ namespace Combot.Modules.Plugins | |||
{ | |||
public override void Initialize() | |||
{ | |||
InitializeTable(); | |||
Bot.CommandReceivedEvent += HandleCommandEvent; | |||
Bot.IRC.Message.ChannelMessageReceivedEvent += HandleChannelMessage; | |||
Bot.IRC.Message.PrivateMessageReceivedEvent += HandlePrivateMessage; | |||
@@ -18,6 +21,16 @@ namespace Combot.Modules.Plugins | |||
Bot.IRC.Message.PrivateNoticeReceivedEvent += HandlePrivateNotice; | |||
} | |||
private void InitializeTable() | |||
{ | |||
string sqlPath = Path.Combine(Directory.GetCurrentDirectory(), ConfigPath, "CreateTable.sql"); | |||
if (File.Exists(sqlPath)) | |||
{ | |||
string query = File.ReadAllText(sqlPath); | |||
Bot.Database.Execute(query); | |||
} | |||
} | |||
public override void ParseCommand(CommandMessage command) | |||
{ | |||
Command foundCommand = Commands.Find(c => c.Triggers.Contains(command.Command)); |
@@ -93,6 +93,11 @@ | |||
<Install>false</Install> | |||
</BootstrapperPackage> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="CreateTable.sql"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<PropertyGroup> | |||
<PostBuildEvent>md "$(SolutionDir)$(ConfigurationName)\Modules\$(TargetName)" |
@@ -0,0 +1,18 @@ | |||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- Table structure for table `relays` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `relays` ( | |||
`id` int(11) NOT NULL AUTO_INCREMENT, | |||
`server_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`source` varchar(500) NOT NULL, | |||
`target` varchar(500) NOT NULL, | |||
`type` int(11) NOT NULL, | |||
`modes` varchar(250) NOT NULL, | |||
`date_added` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |
@@ -4,6 +4,7 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using Combot.IRCServices.Messaging; | |||
using Combot.IRCServices.Commanding; | |||
using System.IO; | |||
namespace Combot.Modules.Plugins | |||
{ | |||
@@ -11,6 +12,8 @@ namespace Combot.Modules.Plugins | |||
{ | |||
public override void Initialize() | |||
{ | |||
InitializeTable(); | |||
Bot.CommandReceivedEvent += HandleCommandEvent; | |||
// Incoming Messages | |||
@@ -45,6 +48,16 @@ namespace Combot.Modules.Plugins | |||
//Bot.IRC.Command.NickCommandEvent += RelayNickCommand; | |||
} | |||
private void InitializeTable() | |||
{ | |||
string sqlPath = Path.Combine(Directory.GetCurrentDirectory(), ConfigPath, "CreateTable.sql"); | |||
if (File.Exists(sqlPath)) | |||
{ | |||
string query = File.ReadAllText(sqlPath); | |||
Bot.Database.Execute(query); | |||
} | |||
} | |||
public override void ParseCommand(CommandMessage command) | |||
{ | |||
Command foundCommand = Commands.Find(c => c.Triggers.Contains(command.Command)); |
@@ -61,6 +61,11 @@ | |||
</None> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="CreateTable.sql"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<PropertyGroup> | |||
<PostBuildEvent>md "$(SolutionDir)$(ConfigurationName)\Modules\$(TargetName)" |
@@ -2,13 +2,7 @@ | |||
SET time_zone = "+00:00"; | |||
-- | |||
-- | |||
-- | |||
-- Table structure for table `seen` | |||
-- | |||
CREATE TABLE IF NOT EXISTS `seen` ( | |||
@@ -16,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `seen` ( | |||
`server_id` int(11) NOT NULL, | |||
`channel_id` int(11) NOT NULL, | |||
`nick_id` int(11) NOT NULL, | |||
`message` varchar(500) CHARACTER SET utf8mb4 NOT NULL, | |||
`message` varchar(500) NOT NULL, | |||
`date_seen` datetime NOT NULL, | |||
PRIMARY KEY (`id`) | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=25212 ; | |||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=0 ; |