mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added an option to match by colors in Auto Respond bot.
Added an option to match by colors in Auto Respond bot.
This commit is contained in:
commit
c945a33f8f
6 changed files with 37 additions and 24 deletions
|
|
@ -12,6 +12,7 @@ namespace MinecraftClient.ChatBots
|
|||
class AutoRespond : ChatBot
|
||||
{
|
||||
private string matchesFile;
|
||||
private bool matchColors;
|
||||
private List<RespondRule> respondRules;
|
||||
private enum MessageType { Public, Private, Other };
|
||||
|
||||
|
|
@ -19,9 +20,10 @@ namespace MinecraftClient.ChatBots
|
|||
/// Create a new AutoRespond bot
|
||||
/// </summary>
|
||||
/// <param name="matchesFile">INI File to load matches from</param>
|
||||
public AutoRespond(string matchesFile)
|
||||
public AutoRespond(string matchesFile, bool matchColors)
|
||||
{
|
||||
this.matchesFile = matchesFile;
|
||||
this.matchColors = matchColors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -262,6 +264,7 @@ namespace MinecraftClient.ChatBots
|
|||
public override void GetText(string text)
|
||||
{
|
||||
//Remove colour codes
|
||||
if (!this.matchColors)
|
||||
text = GetVerbatim(text);
|
||||
|
||||
//Get Message type
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ namespace MinecraftClient
|
|||
if (Settings.AutoRelog_Enabled) { BotLoad(new ChatBots.AutoRelog(Settings.AutoRelog_Delay_Min, Settings.AutoRelog_Delay_Max, Settings.AutoRelog_Retries)); }
|
||||
if (Settings.ScriptScheduler_Enabled) { BotLoad(new ChatBots.ScriptScheduler(Settings.ExpandVars(Settings.ScriptScheduler_TasksFile))); }
|
||||
if (Settings.RemoteCtrl_Enabled) { BotLoad(new ChatBots.RemoteControl()); }
|
||||
if (Settings.AutoRespond_Enabled) { BotLoad(new ChatBots.AutoRespond(Settings.AutoRespond_Matches)); }
|
||||
if (Settings.AutoRespond_Enabled) { BotLoad(new ChatBots.AutoRespond(Settings.AutoRespond_Matches, Settings.AutoRespond_MatchColors)); }
|
||||
if (Settings.AutoAttack_Enabled) { BotLoad(new ChatBots.AutoAttack(Settings.AutoAttack_Mode, Settings.AutoAttack_Priority, Settings.AutoAttack_OverrideAttackSpeed, Settings.AutoAttack_CooldownSeconds, Settings.AutoAttack_Interaction)); }
|
||||
if (Settings.AutoFishing_Enabled) { BotLoad(new ChatBots.AutoFishing()); }
|
||||
if (Settings.AutoEat_Enabled) { BotLoad(new ChatBots.AutoEat(Settings.AutoEat_hungerThreshold)); }
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ tpaccepteveryone=false
|
|||
# /!\ This bot may get spammy depending on your rules, although the global messagecooldown setting can help you avoiding accidental spam
|
||||
enabled=false
|
||||
matchesfile=matches.ini
|
||||
matchcolors=false # Do not remove colors from text (Note: Your matches will have to include color codes (ones using the § character) in order to work)
|
||||
|
||||
[AutoAttack]
|
||||
# Automatically attack hostile mobs around you
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ namespace MinecraftClient
|
|||
//Auto Respond
|
||||
public static bool AutoRespond_Enabled = false;
|
||||
public static string AutoRespond_Matches = "matches.ini";
|
||||
public static bool AutoRespond_MatchColors = false;
|
||||
|
||||
//Auto Attack
|
||||
public static bool AutoAttack_Enabled = false;
|
||||
|
|
@ -697,6 +698,7 @@ namespace MinecraftClient
|
|||
{
|
||||
case "enabled": AutoRespond_Enabled = str2bool(argValue); return true;
|
||||
case "matchesfile": AutoRespond_Matches = argValue; return true;
|
||||
case "matchcolors": AutoRespond_MatchColors = str2bool(argValue); return true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,5 +63,12 @@ match=hello
|
|||
action=send hello!
|
||||
cooldown=60
|
||||
|
||||
# Example of matching colored text when "matchcolors" is set to "true"
|
||||
# §a stands for green text
|
||||
# List of all color codes: https://minecraft.tools/en/color-code.php
|
||||
[Match]
|
||||
match=§ahello
|
||||
action=send Hello back!
|
||||
|
||||
# Enjoy!
|
||||
# - ORelio
|
||||
Loading…
Add table
Add a link
Reference in a new issue