Browse Source

Fixed module load and unload not being called (duplicate commands).

Fixed errors with Seen module.
tags/3.0.2
Teknikode 4 years ago
parent
commit
0559185d72
3 changed files with 76 additions and 61 deletions
  1. 31
    11
      Modules/Owner Control/Module.config
  2. 42
    47
      Modules/Owner Control/Owner_Control.cs
  3. 3
    3
      Modules/Seen/Seen.cs

+ 31
- 11
Modules/Owner Control/Module.config View File

@@ -442,32 +442,52 @@
"SpamCheck": true
},
{
"Name": "Modules",
"Description": "Loads or Unloads the specified module.",
"Name": "Load Module",
"Description": "Loads the specified module.",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Triggers": [
"module"
"load"
],
"Arguments": [
{
"Name": "Action",
"Description": "The action you want to perform on the module.",
"AllowedValues": [
"Load",
"Unload"
],
"Name": "Module",
"Description": "The module you want to load.",
"AllowedValues": [],
"DependentArguments": [],
"MessageTypes": [
0,
1,
2
],
"Required": true
},
}
],
"AllowedMessageTypes": [
0,
1,
2
],
"AllowedAccess": [
6
],
"ShowHelp": true,
"SpamCheck": true
},
{
"Name": "Unload Module",
"Description": "Unloads the specified module.",
"Enabled": true,
"ChannelBlacklist": [],
"NickBlacklist": [],
"Triggers": [
"unload"
],
"Arguments": [
{
"Name": "Module",
"Description": "The module you want to perform the action on.",
"Description": "The module you want to unload.",
"AllowedValues": [],
"DependentArguments": [],
"MessageTypes": [

+ 42
- 47
Modules/Owner Control/Owner_Control.cs View File

@@ -152,54 +152,49 @@ namespace Combot.Modules.Plugins
break;
}
break;
case "Modules":
string moduleType = command.Arguments["Action"].ToString();
string moduleName = command.Arguments["Module"].ToString();
switch (moduleType.ToLower())
case "Load Module":
string loadModuleName = command.Arguments["Module"].ToString();
if (!Bot.Modules.Exists(mod => mod.Name.ToLower() == loadModuleName.ToLower()))
{
case "load":
if (!Bot.Modules.Exists(mod => mod.Name.ToLower() == moduleName.ToLower()))
{
string modulePath = Path.Combine(Bot.ServerConfig.ModuleLocation, moduleName);
bool loaded = Bot.LoadModule(modulePath);
if (loaded)
{
string moduleMessage = string.Format("\u0002{0}\u000F has been loaded.", moduleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
else
{
string moduleMessage = string.Format("\u0002{0}\u000F was unable to be loaded.", moduleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
}
else
{
string moduleInvalid = string.Format("\u0002{0}\u000F is already loaded.", moduleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleInvalid);
}
break;
case "unload":
if (Bot.Modules.Exists(mod => mod.Name.ToLower() == moduleName.ToLower()))
{
bool unloaded = Bot.UnloadModule(moduleName);
if (unloaded)
{
string moduleMessage = string.Format("\u0002{0}\u000F has been unloaded.", moduleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
else
{
string moduleMessage = string.Format("\u0002{0}\u000F was unable to be unloaded.", moduleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
}
else
{
string moduleInvalid = string.Format("\u0002{0}\u000F is not loaded.", moduleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleInvalid);
}
break;
string modulePath = Path.Combine(Bot.ServerConfig.ModuleLocation, loadModuleName);
bool loaded = Bot.LoadModule(modulePath);
if (loaded)
{
string moduleMessage = string.Format("\u0002{0}\u000F has been loaded.", loadModuleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
else
{
string moduleMessage = string.Format("\u0002{0}\u000F was unable to be loaded.", loadModuleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
}
else
{
string moduleInvalid = string.Format("\u0002{0}\u000F is already loaded.", loadModuleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleInvalid);
}
break;
case "Unload Module":
string unloadModuleName = command.Arguments["Module"].ToString();
if (Bot.Modules.Exists(mod => mod.Name.ToLower() == unloadModuleName.ToLower()))
{
bool unloaded = Bot.UnloadModule(unloadModuleName);
if (unloaded)
{
string moduleMessage = string.Format("\u0002{0}\u000F has been unloaded.", unloadModuleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
else
{
string moduleMessage = string.Format("\u0002{0}\u000F was unable to be unloaded.", unloadModuleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleMessage);
}
}
else
{
string moduleInvalid = string.Format("\u0002{0}\u000F is not loaded.", unloadModuleName);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, moduleInvalid);
}
break;
case "Update":

+ 3
- 3
Modules/Seen/Seen.cs View File

@@ -45,21 +45,21 @@ namespace Combot.Modules.Plugins
{
DateTime partTime = (DateTime)partList.First()["date_added"];
TimeSpan difference = DateTime.Now.Subtract(partTime);
string message = string.Format("I last saw \u0002{0}\u0002 {1} ago leaving \u0002{2}\u0002.", command.Arguments["Nickname"], ConvertToDifference(difference), channelList.First()["name"]);
string message = string.Format("I last saw \u0002{0}\u0002 {1} ago leaving \u0002{2}\u0002.", command.Arguments["Nickname"], ConvertToDifference(difference), partList.First()["name"]);
lastSeenList.Add(new Dictionary<DateTime, string>() { { partTime, message } });
}
if (joinList.Any())
{
DateTime joinTime = (DateTime)joinList.First()["date_added"];
TimeSpan difference = DateTime.Now.Subtract(joinTime);
string message = string.Format("I last saw \u0002{0}\u0002 {1} ago joining \u0002{2}\u0002.", command.Arguments["Nickname"], ConvertToDifference(difference), channelList.First()["name"]);
string message = string.Format("I last saw \u0002{0}\u0002 {1} ago joining \u0002{2}\u0002.", command.Arguments["Nickname"], ConvertToDifference(difference), joinList.First()["name"]);
lastSeenList.Add(new Dictionary<DateTime, string>() { { joinTime, message } });
}
if (kickList.Any())
{
DateTime kickTime = (DateTime)kickList.First()["date_added"];
TimeSpan difference = DateTime.Now.Subtract(kickTime);
string message = string.Format("I last saw \u0002{0}\u0002 {1} ago being kicked from \u0002{2}\u0002 with the reason: {3}", command.Arguments["Nickname"], ConvertToDifference(difference), channelList.First()["name"], kickList.First()["message"]);
string message = string.Format("I last saw \u0002{0}\u0002 {1} ago being kicked from \u0002{2}\u0002 with the reason: {3}", command.Arguments["Nickname"], ConvertToDifference(difference), kickList.First()["name"], kickList.First()["reason"]);
lastSeenList.Add(new Dictionary<DateTime, string>() { { kickTime, message } });
}
if (quitList.Any())

Loading…
Cancel
Save