mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
AutoRespond tests and fixes
- Automatically add [BotName] tags to log lines - Fix case handling and actionPrivate used for public messages - Add a sample file for basic and regex matches
This commit is contained in:
parent
3ce91188c7
commit
a6b3bf0481
6 changed files with 53 additions and 12 deletions
|
|
@ -12,7 +12,6 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
private string matchesFile;
|
||||
private List<RespondRule> respondRules;
|
||||
private static string header = "[AutoRespond] ";
|
||||
|
||||
/// <summary>
|
||||
/// Create a new AutoRespond bot
|
||||
|
|
@ -84,7 +83,7 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
else if (!String.IsNullOrEmpty(match))
|
||||
{
|
||||
if (message.Contains(match))
|
||||
if (message.ToLower().Contains(match.ToLower()))
|
||||
{
|
||||
return (privateMsg
|
||||
? actionPrivate
|
||||
|
|
@ -137,7 +136,7 @@ namespace MinecraftClient.ChatBots
|
|||
case "regex": matchRegex = new Regex(argValue); break;
|
||||
case "match": matchString = argValue; break;
|
||||
case "action": matchAction = argValue; break;
|
||||
case "actionprivate": matchAction = argValue; break;
|
||||
case "actionprivate": matchActionPrivate = argValue; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -182,7 +181,7 @@ namespace MinecraftClient.ChatBots
|
|||
public override void GetText(string text)
|
||||
{
|
||||
//Remove colour codes
|
||||
text = GetVerbatim(text).ToLower();
|
||||
text = GetVerbatim(text);
|
||||
|
||||
//Check if this is a valid message
|
||||
string sender = "", message = "";
|
||||
|
|
@ -200,10 +199,10 @@ namespace MinecraftClient.ChatBots
|
|||
if (toPerform != null)
|
||||
{
|
||||
string response = null;
|
||||
LogToConsole(header + toPerform);
|
||||
LogToConsole(toPerform);
|
||||
PerformInternalCommand(toPerform, ref response);
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
LogToConsole(header + response);
|
||||
LogToConsole(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue