wiki make updates

This commit is contained in:
Madpeterz 2021-02-09 19:12:35 +00:00
parent 4856298691
commit ced3a54bdb
6 changed files with 19 additions and 14 deletions

View file

@ -36,7 +36,7 @@ namespace BetterSecondBotShared.API
} }
return null; return null;
} }
protected virtual void LoadCommandsList() protected virtual void LoadCommandsList(bool wikimode)
{ {
foreach (var com in GetAPICommandClasses()) foreach (var com in GetAPICommandClasses())
{ {
@ -47,7 +47,12 @@ namespace BetterSecondBotShared.API
API_interface D = (API_interface)Activator.CreateInstance(com); API_interface D = (API_interface)Activator.CreateInstance(com);
if (D != null) if (D != null)
{ {
if (subtype_map.ContainsKey(D.CommandNameLower) == false) string name = D.CommandNameLower;
if(wikimode == true)
{
name = D.CommandName;
}
if (subtype_map.ContainsKey(name) == false)
{ {
string worknamespace = com.Namespace; string worknamespace = com.Namespace;
worknamespace = worknamespace.Replace("BSB.Commands.", ""); worknamespace = worknamespace.Replace("BSB.Commands.", "");
@ -57,8 +62,8 @@ namespace BetterSecondBotShared.API
worknamespace = worknamespace.Replace("BetterSecondBot.HttpServer.Control.", ""); worknamespace = worknamespace.Replace("BetterSecondBot.HttpServer.Control.", "");
worknamespace = worknamespace.Replace("BetterSecondBot.HttpServer.control.", ""); worknamespace = worknamespace.Replace("BetterSecondBot.HttpServer.control.", "");
worknamespace = worknamespace.Replace("CMD_", ""); worknamespace = worknamespace.Replace("CMD_", "");
subtype_map.Add(D.CommandNameLower, D.GetType()); subtype_map.Add(name, D.GetType());
subtype_workspace_map.Add(D.CommandNameLower, worknamespace); subtype_workspace_map.Add(name, worknamespace);
} }
else else
{ {
@ -102,7 +107,7 @@ namespace BetterSecondBotShared.API
{ {
if (subtype_map.Count() == 0) if (subtype_map.Count() == 0)
{ {
LoadCommandsList(); LoadCommandsList(false);
} }
return subtype_map.ContainsKey(command); return subtype_map.ContainsKey(command);
} }

View file

@ -289,12 +289,12 @@ namespace BetterSecondBot.WikiMake
InterfaceWiki("JSON", defaultJson); InterfaceWiki("JSON", defaultJson);
// CMD // CMD
BSB.Commands.CoreCommandsInterface cmd = new BSB.Commands.CoreCommandsInterface(null); BSB.Commands.CoreCommandsInterface cmd = new BSB.Commands.CoreCommandsInterface(null,true);
api_reports.Add("Core", new KeyValuePair<int, string>(cmd.ApiCommandsCount, "Good")); api_reports.Add("Core", new KeyValuePair<int, string>(cmd.ApiCommandsCount, "Good"));
InterfaceWiki("Core", cmd, true); InterfaceWiki("Core", cmd, true);
// RLVapi // RLVapi
BSB.RLV.RLVcontrol RLVapi = new BSB.RLV.RLVcontrol(null); BSB.RLV.RLVcontrol RLVapi = new BSB.RLV.RLVcontrol(null,true);
api_reports.Add("RLVapi", new KeyValuePair<int, string>(RLVapi.ApiCommandsCount, "Limited")); api_reports.Add("RLVapi", new KeyValuePair<int, string>(RLVapi.ApiCommandsCount, "Limited"));
InterfaceWiki("RLVapi", RLVapi, true); InterfaceWiki("RLVapi", RLVapi, true);

View file

@ -125,11 +125,11 @@ namespace BSB.Commands
} }
} }
public CoreCommandsInterface(CommandsBot linktobot) public CoreCommandsInterface(CommandsBot linktobot, bool wikimode)
{ {
bot = linktobot; bot = linktobot;
API_type = typeof(CoreCommand); API_type = typeof(CoreCommand);
LoadCommandsList(); LoadCommandsList(wikimode);
} }
protected HttpClient HTTPclient = new HttpClient(); protected HttpClient HTTPclient = new HttpClient();

View file

@ -21,11 +21,11 @@ namespace BSB.RLV
last_caller_uuid = callerUUID; last_caller_uuid = callerUUID;
} }
public RLVcontrol(RLVbot linktobot) public RLVcontrol(RLVbot linktobot, bool wikimode)
{ {
bot = linktobot; bot = linktobot;
API_type = typeof(RLV_command); API_type = typeof(RLV_command);
LoadCommandsList(); LoadCommandsList(wikimode);
} }
protected List<string> suppress_warning = new List<string>(); protected List<string> suppress_warning = new List<string>();

View file

@ -14,7 +14,7 @@ namespace BSB.bottypes
{ {
protected CommandsBot() protected CommandsBot()
{ {
CommandsInterface = new Commands.CoreCommandsInterface(this); CommandsInterface = new Commands.CoreCommandsInterface(this,false);
} }
protected List<string> CommandHistory = new List<string>(); protected List<string> CommandHistory = new List<string>();
@ -194,7 +194,7 @@ namespace BSB.bottypes
{ {
if (reconnect == false) if (reconnect == false)
{ {
CommandsInterface = new Commands.CoreCommandsInterface(this); CommandsInterface = new Commands.CoreCommandsInterface(this,false);
} }
Client.Self.RequestBalance(); Client.Self.RequestBalance();
base.AfterBotLoginHandler(); base.AfterBotLoginHandler();

View file

@ -21,7 +21,7 @@ namespace BSB.bottypes
if (myconfig.Setting_AllowRLV == true) if (myconfig.Setting_AllowRLV == true)
{ {
Info("RLV: Enabled"); Info("RLV: Enabled");
RLVinterface = new RLV.RLVcontrol(this); RLVinterface = new RLV.RLVcontrol(this,false);
} }
} }
} }