diff --git a/CLI/WikiMake/wikimake.cs b/CLI/WikiMake/wikimake.cs
index e0be6fb..f4be9e1 100644
--- a/CLI/WikiMake/wikimake.cs
+++ b/CLI/WikiMake/wikimake.cs
@@ -125,14 +125,13 @@ namespace BetterSecondBot.WikiMake
string[] arg_hints = shared_interface.GetCommandArgHints(c);
if(area == "Core")
{
- string example_call = "Example: [[COMMAND]]";
- string preaddon = "|||";
+ StringBuilder ExampleCall = new StringBuilder();
+ ExampleCall.Append("Example: [[COMMAND]]");
+ ExampleCall.Append("|||");
string addon = "";
while (loop < minargs)
{
- example_call += preaddon;
- example_call += addon;
- preaddon = "";
+ ExampleCall.Append(addon);
addon = "~#~";
string hint_value = "";
if (arg_hints.Length > loop)
@@ -148,16 +147,16 @@ namespace BetterSecondBot.WikiMake
}
if (hint_value != "")
{
- example_call += hint_value;
+ ExampleCall.Append(hint_value);
}
else
{
- example_call += "Not sure";
+ ExampleCall.Append("?");
ConsoleLog.Debug("[WikiMake] " + area + " Command " + c + " missing some required hint values");
}
loop++;
}
- sb.Append(example_call);
+ sb.Append(ExampleCall.ToString());
sb.Append("
");
}
sb.Append("[[HELP]]");
diff --git a/Core/Commands/Group/getGroupList.cs b/Core/Commands/Group/getGroupList.cs
index 97321c4..91b9c47 100644
--- a/Core/Commands/Group/getGroupList.cs
+++ b/Core/Commands/Group/getGroupList.cs
@@ -10,17 +10,17 @@ namespace BSB.Commands.Group
public override string Helpfile { get { return "Returns a csv of known groups NAME=UUID,NAME=UUID... "; } }
protected override string RunFunction()
{
- string reply = "";
+ StringBuilder reply = new StringBuilder();
string addon = "";
foreach (KeyValuePair groupdata in bot.MyGroups)
{
- reply += addon;
- reply += groupdata.Value.Name;
- reply += "=";
- reply += groupdata.Key;
+ reply.Append(addon);
addon = ",";
+ reply.Append(groupdata.Value.Name);
+ reply.Append("=");
+ reply.Append(groupdata.Key);
}
- return reply;
+ return reply.ToString();
}
}
}
diff --git a/Core/Commands/Group/getGroupRoles.cs b/Core/Commands/Group/getGroupRoles.cs
index c585f2b..9f70da8 100644
--- a/Core/Commands/Group/getGroupRoles.cs
+++ b/Core/Commands/Group/getGroupRoles.cs
@@ -8,7 +8,6 @@ namespace BSB.Commands.Group
public class GetGroupRoles : CoreGroupCommand_SmartReply_Group
{
public override string Helpfile { get { return "Returns group=UUID@@@rolename=UUID,rolename=UUID ... "; } }
-
public override bool CallFunction(string[] args)
{
if (base.CallFunction(args) == true)
@@ -42,20 +41,23 @@ namespace BSB.Commands.Group
public override void Callback(string[] args, EventArgs e)
{
GroupRolesDataReplyEventArgs rolesData = (GroupRolesDataReplyEventArgs)e;
- string reply = "group=" + args[1] + "@@@";
+ StringBuilder reply = new StringBuilder();
+ reply.Append("group=");
+ reply.Append(args[1]);
+ reply.Append("@@@");
string addon = "";
foreach(KeyValuePair data in rolesData.Roles)
{
if (data.Key != UUID.Zero)
{
- reply += addon;
- reply += data.Value.Name;
- reply += "=";
- reply += data.Key.ToString();
+ reply.Append(addon);
addon = ",";
+ reply.Append(data.Value.Name);
+ reply.Append("=");
+ reply.Append(data.Key.ToString());
}
}
- bot.GetCommandsInterface.SmartCommandReply(args[0], reply, CommandName);
+ bot.GetCommandsInterface.SmartCommandReply(args[0], reply.ToString(), CommandName);
base.Callback(args, e);
}
}
diff --git a/Core/Commands/Group/groupchatListAllUnreadGroups.cs b/Core/Commands/Group/groupchatListAllUnreadGroups.cs
index e01cfcb..0692c63 100644
--- a/Core/Commands/Group/groupchatListAllUnreadGroups.cs
+++ b/Core/Commands/Group/groupchatListAllUnreadGroups.cs
@@ -11,15 +11,15 @@ namespace BSB.Commands.Group
protected override string RunFunction()
{
- string reply = "";
+ StringBuilder reply = new StringBuilder();
string addon = "";
foreach (UUID group in bot.UnreadGroupchatGroups())
{
- reply += addon;
- reply += group;
+ reply.Append(addon);
addon = ",";
+ reply.Append(group);
}
- return reply;
+ return reply.ToString();
}
}
}
diff --git a/Core/Static/Inventory.cs b/Core/Static/Inventory.cs
index be5f11e..de03970 100644
--- a/Core/Static/Inventory.cs
+++ b/Core/Static/Inventory.cs
@@ -88,13 +88,13 @@ namespace BSB.Static
}
public static string Spaces(int counter)
{
- string reply = "";
+ StringBuilder reply = new StringBuilder();
while (counter > 0)
{
- reply += " ";
+ reply.Append(" ");
counter--;
}
- return reply;
+ return reply.ToString();
}
}
}
diff --git a/Core/bottypes/DiscordBot.cs b/Core/bottypes/DiscordBot.cs
index 4adcc0d..efd9f1d 100644
--- a/Core/bottypes/DiscordBot.cs
+++ b/Core/bottypes/DiscordBot.cs
@@ -368,32 +368,29 @@ namespace BSB.bottypes
{
await CleanDiscordChannel(Chan, 0, true);
}
+ StringBuilder output = new StringBuilder();
if (Chan.Name == "interface")
{
if (message.Content.StartsWith("!"))
{
if (message.Content == "!commands")
{
- string reply = "";
int counter = 0;
string addon = "";
foreach(string a in CommandsInterface.GetCommandsList())
{
- reply += addon;
- reply += a;
+ output.Append(addon);
+ addon = " , ";
+ output.Append(a);
counter++;
if (counter == 5)
{
- reply += "\n";
+ output.Append("\n");
addon = "";
counter = 0;
}
- else
- {
- addon = " , ";
- }
}
- _ = SendMessageToChannelAsync("interface", reply, "bot", UUID.Zero, myconfig.userName, "bot");
+ _ = SendMessageToChannelAsync("interface", output.ToString(), "bot", UUID.Zero, myconfig.userName, "bot");
}
else if (message.Content.StartsWith("!help") == true)
{
@@ -401,18 +398,33 @@ namespace BSB.bottypes
if (bits.Length == 2)
{
string command = bits[1].ToLowerInvariant();
+
if (CommandsInterface.GetCommandsList().Contains(command) == true)
{
- _ = SendMessageToChannelAsync("interface", "\n=========================\nCommand: " + command + "\n" +
- "Workspace: " + CommandsInterface.GetCommandWorkspace(command) + "\n" +
- "Min args: " + CommandsInterface.GetCommandArgs(command).ToString() + "\n" +
- "Arg types" + String.Join(",", CommandsInterface.GetCommandArgTypes(command)) + "\n" +
- "\n" +
- "About: " + CommandsInterface.GetCommandHelp(command) + "", "bot", UUID.Zero, myconfig.userName, "bot");
+
+ output.Append("\n=========================\nCommand:");
+ output.Append(command);
+ output.Append("\n");
+ output.Append("Workspace: ");
+ output.Append(CommandsInterface.GetCommandWorkspace(command));
+ output.Append("\n");
+ output.Append("Min args: ");
+ output.Append(CommandsInterface.GetCommandArgs(command).ToString());
+ output.Append("\n");
+ output.Append("Arg types: ");
+ output.Append(String.Join(",", CommandsInterface.GetCommandArgTypes(command)));
+ output.Append("\n");
+ output.Append("\n");
+ output.Append("About: ");
+ output.Append(CommandsInterface.GetCommandHelp(command));
+ _ = SendMessageToChannelAsync("interface",output.ToString(), "bot", UUID.Zero, myconfig.userName, "bot");
}
else
{
- _ = SendMessageToChannelAsync("interface", "Unable to find command: " + command + " please use !commands for a full list", "bot", UUID.Zero, myconfig.userName, "bot");
+ output.Append("Unable to find command: ");
+ output.Append(command);
+ output.Append(" please use !commands for a full list");
+ _ = SendMessageToChannelAsync("interface", output.ToString(), "bot", UUID.Zero, myconfig.userName, "bot");
}
}
else
@@ -422,7 +434,9 @@ namespace BSB.bottypes
}
else if (message.Content != "!clear")
{
- _ = SendMessageToChannelAsync("interface", "Unknown request: " + message.Content + "", "bot", UUID.Zero, myconfig.userName, "bot");
+ output.Append("Unknown request: ");
+ output.Append(message.Content);
+ _ = SendMessageToChannelAsync("interface",output.ToString(), "bot", UUID.Zero, myconfig.userName, "bot");
}
}
else
@@ -431,19 +445,21 @@ namespace BSB.bottypes
string command = bits[0].ToLowerInvariant();
if (CommandsInterface.GetCommandsList().Contains(command) == true)
{
- bool status = false;
if (bits.Length == 2)
{
- status = CommandsInterface.Call(command, bits[1],UUID.Zero);
+ _ = CommandsInterface.Call(command, bits[1],UUID.Zero);
}
else
{
- status = CommandsInterface.Call(command);
+ _ = CommandsInterface.Call(command);
}
}
else
{
- _ = SendMessageToChannelAsync("interface", "Unable to find command: " + command + " please use !commands for a full list", "bot", UUID.Zero, myconfig.userName, "bot");
+ output.Append("Unable to find command: ");
+ output.Append(command);
+ output.Append(" please use !commands for a full list");
+ _ = SendMessageToChannelAsync("interface", output.ToString(), "bot", UUID.Zero, myconfig.userName, "bot");
}
}
}