Allow restricting AutoRespond matches to bot owner

Suggestion by AppleCidar in #184
This commit is contained in:
ORelio 2016-08-21 19:50:56 +02:00
parent 881e080fd6
commit a4cc36ce05
4 changed files with 61 additions and 24 deletions

View file

@ -22,7 +22,7 @@ If Mono crashes, retry with mono-complete, not mono-runtime. Mono v4.0 to 4.2 is
Using Configuration files & Enabling bots
===========================================
Simply open the INI file with a text editor and change the values.
Simply open the INI configuration file with a text editor and change the values.
To enable a bot change the "enabled" value in the INI file from "false" to "true".
You will still be able to send and receive chat messages when a bot is loaded.
You can remove or comment some lines from the INI file to use the default values instead.
@ -34,6 +34,8 @@ You can have several INI files and drag & drop one of them over MinecraftClient.
> MinecraftClient.exe username password server
This will automatically connect you to the chosen server.
To specify a server and ask password interactively, use "" as password.
To specify offline mode with no password, use "-" as password.
> MinecraftClient.exe username password server "/mycommand"
This will automatically send "/mycommand" to the server and close.
@ -61,6 +63,7 @@ In scripts and remote control, no slash is needed to perform the command.
- send <text> : send a message or a command to the server
- respawn : Use this to respawn if you are dead (like clicking "respawn" ingame)
- log <text> : display some text in the console (useful for scripts)
- list : list players logged in to the server (uses tab list info sent by server)
- set varname=value : set a value which can be used as %varname% in further commands
- wait <time> : wait X ticks (10 ticks = ~1 second. Only for scripts)
- move : used for moving when terrain and movements feature is enabled
@ -85,18 +88,22 @@ Once you have created your files, fill the 'accountlist' and 'serverlist' fields
======================================
By default, Minecraft Console Client cannot interact with the world around you.
However for some versions of the game you can enabl the terrainandmovements settings.
Please note that this regquires much more RAM, a bit more CPU, and slightly more bandwidth.
This will allow you to properly fall on ground, pickup items and move around.
There is a C# API for reading the terrain data and moving from C# scripts.
However for some versions of the game you can enable the terrainandmovements setting.
This feature will allow you to properly fall on ground, pickup items and move around.
There is a C# API for reading terrain data around the player and moving from C# scripts.
Please note that this requires much more RAM to store all the terrain data, a bit more CPU
to process all of this, and slightly more bandwidth as locations updates are
sent back to the server in a spammy way (that's how Minecraft works).
============================
How to write a script file
============================
A script can be launched by using /script <filename> in the client
A script file can be launched by using /script <filename> in the client's command prompt.
The client will automatically look for your script in the current directory or "scripts" subfolder.
If the file extension is .txt, you may omit it and the client will still find the script
If the file extension is .txt or .cs, you may omit it and the client will still find the script.
Regarding the script file, it is a text file with one instruction per line.
Any line beginning with "#" is ignored and treated as a comment.
@ -111,11 +118,11 @@ The following read-only variables can also be used: %username%, %serverip%, %ser
If you are experienced with C#, you may also write a C# script.
That's a bit more involved, but way more powerful than regular scripts.
You can look to the provided sample C# scripts for getting started.
You can look at the provided sample C# scripts for getting started.
C# scripts can be used for creating your own ChatBot without recompiling the whole project.
These bots are embedded in a script file, which is compiled and loaded on the fly.
ChatBots can access plugin channels for communicating with your own plugin.
ChatBots can access plugin channels for communicating with some server plugins.
For knowing everything the API has to offer, you can look at CSharpRunner.cs and ChatBot.cs.
The latest version for these files can be found on the GitHub repository.
@ -126,16 +133,19 @@ The latest version for these files can be found on the GitHub repository.
If you are on a restricted network you might want to use some HTTP or SOCKS proxies.
To do so, find a proxy, enable proxying in INI file and fill in the relevant settings.
Proxy with username/password authentication are supported but have not been tested.
Proxies with username/password authentication are supported but have not been tested.
Not every proxy will work for playing Minecraft, because of port 80/443 web browsing restrictions.
However you can choose to use a proxy for login only, most proxies should work in this mode.
=============================================
Connecting to servers when ping is disabled
=============================================
On some server, the server list ping feature has been disabled, which prevents Minecraft Console Client
On some servers, the server list ping feature has been disabled, which prevents Minecraft Console Client
from pinging the server to determine the Minecraft version to use. To connect to this kind of servers,
find out which Minecraft version is running on the server, and fill in the 'mcversion' field in INI file.
This will disable the ping step while connecting, but requires you to manually provide the version to use.
Recent versions of Minecraft Console Client may also prompt you for MC version in case of ping failure.
=========================
About translation files
@ -144,7 +154,7 @@ This will disable the ping step while connecting, but requires you to manually p
When connecting to 1.6+ servers, you will need a translation file to display properly some chat messages.
These files describe how some messages should be printed depending on your preferred language.
The client will automatically load en_GB.lang from your Minecraft folder if Minecraft is installed on your
computer, or download it from Mojang's servers. You may choose another language in the config file.
computer, or download it from Mojang's servers. You may choose another language in the configuration file.
=========================
Detecting chat messages
@ -168,7 +178,7 @@ For example write Yourname in alerts and <Yourname> in alerts-exclude.txt
=========================
Write in kickmessages.txt some words, such as "Restarting" for example.
If the kick message contains one of them, you will be automatically re-connected
If the kick message contains one of them, you will automatically be re-connected.
A kick message "Connection has been lost." is generated by the console itself when connection is lost.
A kick message "Login failed." is generated the same way when it failed to login to the server.
A kick message "Failed to ping this IP." is generated when it failed to ping the server.
@ -188,7 +198,8 @@ Please read sample-tasks.ini for learning how to make your own task file.
Use "/tell <bot username> start" to start the game.
Don't forget to add your username in botowners INI setting if you want it to obey.
Edit the provided configuration files to customize the words and the owners.
Edit the provided configuration files to customize the words and the bot owners.
If it doesn't respond to bot owners, read the "Detecting chat messages" section.
==========================
Using the Remote Control
@ -196,10 +207,14 @@ Edit the provided configuration files to customize the words and the owners.
When the remote control bot is enabled, you can send commands to your bot using whispers.
Don't forget to add your username in botowners INI setting if you want it to obey.
If it doesn't respond to bot owners, read the "Detecting chat messages" section.
Please note that server admins can read what you type and output from the bot.
To perform a command simply do the following: /tell <yourbot> <thecommand>
Where <thecommand> is an internal command as described in "Internal commands" section.
You can remotely send chat messages or commands using /tell <yourbot> send <thetext>
Remote control system can auto-accept /tpa and /tpahere requests from the bot owners.
Remote control system can by default auto-accept /tpa and /tpahere requests from the bot owners.
Auto-accept can be disabled or extended to requests from anyone in remote control configuration.
===============================
@ -215,7 +230,7 @@ For more information about how to define match rules, please refer to sample-mat
=========================
Even if everything should work, I am not responsible of any damage this app could cause to your computer or your server.
This app does not steal your password. If you don't trust it, don't use it or check & compile the source code.
This app does not steal your password. If you don't trust it, don't use it or check & compile from the source code.
Also, remember that when you connect to a server with this program, you will appear where you left the last time.
This means that you can die if you log in in an unsafe place on a survival server!

View file

@ -8,6 +8,7 @@
# You can define an action if the match was in a private message
# You can define an action if the match was not sent by a player
# Regex matches are also supported eg $1, $2, $3.. in actions
# Matches can optionally be restricted to bot owners only
# Simple example: Respond to a message containing a keyword
@ -16,6 +17,7 @@ match=hi
action=send hi, $u!
actionprivate=send /tell $u Hello!
actionother=log detected "hi" message
ownersonly=false
# You do not need to specify all the "action" fields
# Only one of them is required for each match
@ -40,5 +42,12 @@ action=script test
match=server is restarting
actionother=script restart
# Example of custom remote control command
[Match]
match=gohome
actionprivate=send /home
ownersonly=true
# Enjoy!
# - ORelio