资源说明:This git is the "official" Bebot repository to download latest from ; its testing "beta" is at https://github.com/bitnykk/BeBot
////////////////////
///////////////////////////
////////////////////////////////
///@@@@@@///////////////////////////
/////@@///@////////////////////////////
///////@////@@@/////////@@@@@/////////////
////////@///////@@/////@@/////@@////////////
/////////@///@@@///@//@@///@@@//@@////////////
//////////@///@//@///@/@///@@@@//@@/////////////
//////////@///@//@///@/@/////////@@//////////////
//////////@///@@@@///@/@////@@@@@@///////////////
//////////@/////////@///@@/////@@////////////////
///////////@@@@@@@@@/////@@@@@@@@////////////////
//////@@@/////////////////////////@@@///////////
///////@@///////////////@@@////////@@///////////
//////@@@@@@@@//////@@@@@@@@@/////@@@@/////////
/////@@/////@@////@@///////@@////@@//////////
////@@/////@@/({/@@/(o/o)/@@/})/@@/////////
///@@/////@@////@@///////@@////@@////////
//@@@@@@@@@/////@@@@@@@@@/////@@@@@@@//
//////////////////@@@////////////////
/////////////////////////////////
/////////////////////////////
/////////////////////
Updated README from https://github.com/J-Soft/BeBot
More documentation at http://wiki.bebot.link
INSTALLING BEBOT
================
This bot works for both, Anarchy Online (AO) and Age of Conan (AoC). Some
settings and modules only make sense for AO and some make only sense for
AoC. Whenever something is only applicable for one of the games, it is
marked as "AO only" or "AoC only".
PREREQUISITES (WHAT DO YOU NEED?)
---------------------------------
To install and run BeBot you need the following:
* Anarchy Online (free or paid) or Age of Conan
* PHP version from 5.4 (minimal requirement) upto 8.0 (max tested so far)
* database server of either Mysql (from 4.1 upto 8.0) or MariaDB (10.0 upto 10.4)
* either "Official" files at https://github.com/J-Soft/BeBot/archive/master.zip (stable)
or "Beta" files from https://github.com/bitnykk/BeBot/archive/master.zip (sandbox)
NB : if you know how to use git, you also can clone/pull from any of these urls.
Optional (helps run it effectively):
* An "always-on" internet connection
* A dedicated machine to run the bot
CREATE A PLAYER
---------------
A bot is basically a regular player character so you'll need to start AO/AoC
and create a character on the appropriate dimension/server. The breed,
gender, and profession (AO only) or the class and race (AoC only) is
irrelevant for the function of the bot. The name of the character will be
the name of the bot. You can use an already existing player.
Notes for guild-style bot
-------------------------
A guild bot needs to be a member of the guild it is to be a bot for. For AO
this means that it needs to have the same faction as the guild.
Notes on towers (AO only)
-------------------------
For tower wars to work as intended the bot needs to be in the top three
ranks of an org. This is because the [ALL TOWERS] channel is restricted to
these ranks.
INSTALL THE BOT FILES
---------------------
To install the bot simply unzip the files to a directory maintaining the
directory structure.
CONFIGURING THE BOT
===================
STARTBOT.PHP
------------
Open the file StartBot.php which is located in the install directory in a
text editor. Here you need to set the $php_bin to the path and name of your
php executable.
If you start the bot from the same directory as the binary php file (for
windows "php.exe") you can just enter the name. Otherwise you'll have to
enter the name and path of the binary executable (ie C:/Program
files/PHP/php.exe or C:\\ProgramFiles\\PHP\\php.exe or /usr/local/bin/php5).
Note that you can use forward slashes (recommended) or double backslashes
(not recommended) on windows systems. Using single backslashes WILL NOT WORK
as php interprets \ as a special escape character.
On windows, according to the PHP version you'd want Bebot to run into, you may
need to copy a php.exe file right into bot's root folder (where StartBot.bat is).
Unless windows PATH and/or php.ini are well set so the exe can locate required
libraries alone, you may have to copy correct .dll files for this specific PHP.
For 5.4/5.6 : libeay32, libmysql, php5ts and ssleay32, php_mysqli & php_sockets.
For 7.x : libcrypt, libssl, libssh2, sockets, nghttp2, curl & php7(ts).
Bot will tell you what misses to run during startup, so check all lines !
You may need to install some modules (e.g. curl) and activate them in php.ini
So be sure of what php.ini file is loaded by the PHP client Bebot uses.
Set $main_php to the location of the "Main.php" file. Once again you can
just enter "Main.php" if you're starting the bot from the directory its in.
If StartBot.php is in another directory than the bot itself (not
recommended) you must specify the complete path to Main.php.
CONF/BOT.CONF
-------------
Open the file Bot.conf, which is in the conf directory where you installed
the bot, in a text editor. Here you will have to enter the AO/AoC username,
password, and the name of the bot along with the dimension number (AO only)
or server name (AoC only) you would like to run it on.
$owner is the super-duper admin of the bot. This user has got all rights.
This should be the name of the character, which you intend to configure the
bot with, as some settings require you to be owner in order to change.
Below that is the configuration lines for your super admins. You can add as
many superadmins as you like. Just copy and past that line and exchange the
name. These names cannot be downgraded in-game so it is recommended that you
hard-code as few super admins here as possible. Instead of putting the names
in here we recommend using the !adduser SUPERADMIN in-game to add
superadmins.
The next section works just like the superadmins. You can tell the bot what
other bots it may encounter in the guild. This is so that the bot just
ignores tells and messages from the other bot and doesn't end up in a spam
war with it.
For setting up the guild bot section please see bottom of this section.
To switch logging off set "$log" to "off". You can also set it to "chat"
which will only log incoming and outgoing messages. If set to "all"
everything displayed on the console will be put into the log. The default is
"chat". Set "$log_path" to the place where you want logs to be saved.
With "$command_prefix" you can determine what symbol commands start with.
The default here is "!". Note that you need to use the regex string here.
This means that to use "." as your command prefix you need to enter "\."
because "." has got a special meaning in regular expressions. This goes for
a lot of other characters as well.
The last 4 values are probably best left at default.
Guild bot
---------
To make a guild bot set "$guildbot" to true. Change "$guild_name" to the
exact name of your guild.
AO only: Set "$guild_id" to the id of your guild. The easiest way to find
out the guild ID go http://www.anarchy-online.com/content/community/people/
and find your guild. Then scroll to the bottom of the page and click the
"XML version of this membership roster" link.
It will start with:
xxxxxx
the xxxxxx is your guild ID.
To relay chat to another guild bot you want to set $guild_relay_target =
"Name_of_other_guildbot"; If you do not want this feature set
$guild_relay_target = False; (note: False, not "False". If you use quotes
your bot will attempt to relay to the player named "False")
Raid bot
--------
To make a raid bot set "$guildbot" to false and leave "$guild_name" blank.
Set "$guild_id" to 0. For a raid bot you most likely want to set
$guild_relay_target = false; (note: false, not "false")
CONF/MYSQL.CONF
---------------
Set the MySQL username, password, server IP adress or server host name and
database name for the bot (see below).
INSTALLING MYSQL
================
First, you'll need MySQL.
For linux it could be :
Debian-like :
apt-get install mariadb-server
or
apt-get install mysql-server
CentOs-like :
yum install mariadb-server
or
yum install mysql-server
It depends on your OS packager (yum/apt) & what DB server you want (sql/maria).
For windows : Download the Windows Essentials package from MySQL.com.
This is a MSI based installer. If it doesn't work for you, go to
Microsoft Update to install the latest Windows Installer.
In all cases, the DB installer is simple and very similar to what's below.
PHASE 1: MYSQL INSTALLER
------------------------
1. Click Next.
2. Select Typical, Click Next.
3. Click Install.
4. Select Skip Sign-Up, Click Next.
5. Check Configure MySQL Server Now, Click Finish.
6. On recent MYSQL, use Legacy Authentification aka "5.x Compatibility"
(Unless you can adapt the bot yourself using "new Authentification")
Now you should be in the MySQL Server Instance Configuration Wizard.
PHASE 2: MYSQL SERVER INSTANCE CONFIGURATION WIZARD
----------------------------------------------------
1. Click Next.
2. Select Detailed Configuration, Click Next.
3. Select Developer Machine, Click Next.
4. Select Multifunctional Database, Click Next.
5. Select Drive & Installation Path, Click Next.
6. Select Decision Support, Click Next.
7. Check Enable TCP/IP Networking and Enable Strict Mode, Click Next.
8. Select Standard Character Set, Click Next.
9. If windows, check Install As Windows Servers, Check Launch the MySQL Server
automatically, Check Include Bin Directory in Windows PATH, Click Next.
10. Enter and comfirm your root password. Write down your root password
and do not loose it!!! Do not check Enable root access from remote machines.
Click Next.
11. Click Execute.
12. Click Finish. Reboot your computer.
At this point, you have MySQL installed and configured, but you haven't yet
created a MySQL database.
PHASE 3: LOGGING INTO MYSQL
---------------------------
1. Open a command prompt. (Start > Run > CMD, Click OK)
2. In the command prompt, enter the command mysql -u root -p
3. Enter your root password (You did write it down so you wouldn't
forget it right?)
You should now have a MySQL prompt that looks like: mysql>
On windows, if you can't get the command line to work, you can use PhpMyAdmin interface.
It will allow you to use an SQL window to copy-paste and then execute requests below.
PHASE 4: CREATE A DATABASE AND DATABASE USER FOR BEBOT
------------------------------------------------------
1. Type CREATE DATABASE databasename CHARACTER SET latin1; (or utf8 for recent PHP/SQL)
(replace databasename with the name of the database you wish to create)
2. Press Enter/Return.
3. CREATE USER username@localhost; (Change username to the username you
want, keep @localhost)
4. Press Enter/Return.
5. SET PASSWORD FOR username@localhost = PASSWORD("newpassword");
(Change username and newpassword to your selected username and password, again keep @localhost)
6. Press Enter/Return.
7. Type GRANT ALL on databasename.* TO username@localhost;
(Again, change username, keep @localhost)
8. Press Enter/Return.
9. Type quit then Enter/Return to exit the MySQL Monitor.
PHASE 5: CONFIGURE BEBOT
------------------------
1. Edit MySQL.conf, add the values you selected.
$dbase = "databasename";
$user = "username";
$pass = "newpassword";
$server = "localhost";
That's it, you should now be able to start the bot provided PHP is set up
correctly.
Nevertheless, if bot can't locate the database, that's either because these infos
ain't proper, or because the server isn't running, or may be because you have
a firewall that is blocking bot access on your localhost ...
So check everything and retry until it loads !
Backing Up and Restoring your Database
--------------------------------------
It's recommended that you backup your database. If the worst happens, you
can easily recover. And the command to do so is simple:
mysqldump -u username -p --databases databasename --add-drop-table -a -f > filename.sql
On windows, if you don't know how to dump in command line, you can use PhpMyAdmin interface
that will let you read, write, export & import database more easily.
Restoring a database fom a backup
---------------------------------
To restor the database from a previously made backup:
mysql -u username -p databasename < filename.sql
On windows without such command line, you can import via PhpMyAdmin.
IMPORTANT: All changes made to the guild and bot after the backup WILL BE OVERWRITTEN!
PHASE 6: UPDATE DATABASE
------------------------
You can let the bot update its cache by itself, with few control parameters under :
!settings (into whois section) ...
... but you also could "help" it by scheduling execution of a script available in folder :
Extras/WhoisUpdate/
Just copy the WhoisUpdate.conf.dist & name it WhoisUpdate.conf then edit all its infos correctly :
Database user, pass, db, server (e.g. localhost), table ("whois" by default) + AO dimension (5 or 6).
You also have few more parameters to play with lower in this file, to set accordingly to your taste.
Then you can schedule the load of whether UpdateWhoisCache.bat (windows) or WhoisUpdate.php (linux).
STARTING THE BOT
================
* Open a console (In windows press "Start" => "Run" => enter "cmd" and
press enter).
* Now run StartBot (.php under linux or .bat under windows) :
- Windows: Navigate to the directory of your bot assuming you have the
php.exe in the same directory and write "StartBot.bat". You also can
make it a startup shortcut as long as your database service runs too.
- Linux: Assuming you can run php from anywhere, navigate to your bot
directory & write e.g. "php StartBot.php" (assuming your php binary is
named "php" for example). You also can cron it at startup with screen,
as long as your database service runs too.
The console should now state that the bot is loading the modules,
authenticating and connecting. Once this is done you can log onto a character
in-game (see below) marked as "superadmin" to be able to control the bot.
PLAYING WHILE RUNNING THE BOT (AO ONLY)
---------------------------------------
You can run the bot and play AO from the same account (with different
characters) without waiting.
PLAYING WHILE RUNNING THE BOT (AOC ONLY)
----------------------------------------
You can run the bot and play AoC from the same account (with different
characters). However the bot must connect first and you have to wait at
least 5 minutes after logging the bot in, before you can connect with your
client. If the bot (re)connects while you are logged in, you get
disconnected.
IN-GAME SETUP
=============
There is a settings module to handle configuration of most aspects and many
modules for BeBot. Most notable is the Security module. To start configuring
it send a tell to your bot with "!settings security". For a list of modules
whose settings are configurable by the new interface send a tell to your bot
with "!settings".
ADDING AND REMOVING MODULES
===========================
If you do not wish for certain modules to be used by a bot just put an
underscore ("_") at the front of the name in the "Modules" directory. There
are several files already in the distribution that have been commented out
in this way: Most notable is _ExampleModule.php which is a template to make
your own modules.
INSTALLING 3RD PARTY MODULES
----------------------------
We recommend you put any 3rd party modules into the directory named Custom
instead of putting it directly into the modules or core directories. This is
because if a 3rd party module has got the same name as a standard module or
a module with that name is added later it will be over-written if you
upgrade the bot. Modules in the "Custom" directory are never touched by
installing following upgrades to BeBot.
AO EXTERNAL LOOT HELPER SUPPORT
-------------------------------
Bebot is now able to benefit from 3rd party loot helper as AOIA offers at
https://sourceforge.net/projects/aoiaplus/
AOIA running first, it will automate AO scripts during your gameplay.
When you killed a mob/boss, to roll its remains open loot ingame & do :
/loot botname mloot
You then can "view" an AOIA window with prepared "Roll" link(s) down below.
If there are more than 8 items in remains, you'll get several paged links.
Simply click link(s), being !leader on bot (named "botname" in example).
All loots present in remains window should be automatically added to roll.
This way you can add several remains in 1 roll, otherwise !clear in between.
You also can delete unwanted loots ingame remains BEFORE doing upper /loot
AOC ITEM SERVER ACCESS
----------------------
Bebot needs to be granted a server access for Age Of Conan's !items support.
You could use any custom server by editing the module files by yourself.
But, by default, the module will use MeatHook's database server.
To contact its server admin & be provided with a key for your bot, go :
https://forums.funcom.com/u/MeatHooks
Once key is obtained, do the following command :
!set items Passkey xyz-123-etc
BYPASS THE 1K FRIENDLIST LIMIT
==============================
Any character should be limited to 1000 buddies in friendlist.
This limitation is a problem :
- for a guildbot of an org with more than 1000 members
- for a raidbot with over 1000 subscribers
Anarchy Online
--------------
To bypass that annoying limit for AO :
First create all needed slaves in one or several account(s).
Then download AOCP at https://github.com/Budabot/AOChatProxy
If none yet, you may also need to install Java JDK for your OS
Configure AOCP within its config.properties (copied from template) with :
- proxy local port (9993 by default, advised unless you know why you change)
- server distant adress & port (according to what game/dimension you need)
- all the slaves you want starting at number one (with user, pass, name)
Once ready, run the service (run.bat on windows, run.sh on linux/mac).
Then the service should be waiting for main bot connection ...
Now edit you Conf/Bot.conf and set $dimension to the correct value :
For AO its a number, e.g. for Live Proxy : $dimension = "95";
Finally, run main bot and it should connect along with all slaves.
(This may take long especially the first time with huge list ...)
If you setup this proxy correctly, you should obtain the wanted result.
In Ao, whole friendlist will be redistributed to main+slave(s) on startup.
Age of Conan
------------
To bypass that annoying limit for AoC :
First create all needed slaves in one or several account(s).
E.g. if your main bot is Mybot, slaves could be serially named :
Myslave1, Myslave2, Myslave3, etc.
Edit conf file of your main bot & add this line all below before "?>" :
$slave = "Myslave1";
If you have more slaves, edit conf file of first slave to add same way :
$slave = "Myslave2";
Then do the same for next slave, open its conf file to add also :
$slave = "Myslave3";
Etc ... until you added the last slave to the penultimate slave conf.
Note : only the last slave should have no slave in its config file!
Now you should bring all bots (main + slaves) online together.
(Remember in AOC you have to pause between logins on same account)
Start by listing all slaves (comma-separated) into main bot, e.g. :
!set Online OtherBots Myslave1,Myslave2,Myslave3
Once done, each slave should also have its leader set :
On Myslave1 : !adduser Mybot leader
On Myslave2 : !adduser Myslave1 leader
On Myslave3 : !adduser Myslave2 leader
Etc ... until you made the penultimate slave as leader on last slave.
Note : only the main bot should have no bot as leader!
Also verify this module is set to accept guild members as they chat :
!settings Autouseradd
If you setup this all correctly, you should obtain the wanted result.
In AoC, anything over 950 (for safety) is notified to next slave in chain.
Result
------
Therefore resulting friendlist limit is now about 1k x (main + X slaves).
E.g. with 4 slaves : 1k x (1+4) = 5k
In case of issue, check how you setup your bot(s) in these 2 modules :
!settings Members
!settings Online
You may also need to refresh your Whois/User/Online tables by doing :
!rosterupdate
!restart
Note : you may also use the WhoisUpdate tool within Extras folder.
EXTERNAL RELAY MODULES
======================
Nowadays there are 2 main options for this in the gaming universe :
- IRC which has historically been the most used media for linked chat
- Discord that is now a very commonly used multiplatform chat appli
We'll see below how to connect your raid/guild bot to these.
IRC
---
You first decide which IRC server you want to use. Many are public & free.
Create you #channel if it doesn't exist, you must be owner or at least moderator.
You may use a dedicated bot to hold channel, kick intruders, set a pass/key, etc.
Commands are described @ https://gist.github.com/xero/2d6e4b061b4ecbeb9f99
Once your #channel is ready, it's time to link your Bebot by doing :
!settings irc
You'll obtain a panel in which you can set everything up :
- main connection elements Server, Port (often 6667), #Channel & various options
- security elements like Key (if a pass was set) & channels options
- visual elements like prefixes, references, size limits, etc ...
After settings this all correctly, you can start IRC relay with :
!irc connect
The bot should also reconnect by itself after reboot.
For more details & commands :
!help irc
If your bot can't connect to IRC, verify all !settings ...
Possibly you mistyped something like server, channel, port or pass/key.
Twitch
------
Chat of your Twitch account, shown beside your video stream, is IRC compatible.
So to connect Bebot to your Twitch chat, do exactly as said upper for IRC, plus :
- set account name (lowercase) as Nick (main account or another with chat access)
- use 6667 as Port with irc.chat.twitch.tv as Server
- set Channel as chat account #name (lowercase preceded by #)
- enter OAuthTok you obtain on https://twitchapps.com/tmi/
Discord
-------
Create your server/channel(s) if they don't exist, you must be owner or at least admin.
You may set several channel(s), role(s), visual(s) & start inviting people at will.
Right clic on server > Settings > Widget and activate it on the top right corner.
Click on the channel you want to relay from/to & copy its Id (last digit in its URL).
If you can't find Id, go into your settings "Appearance" tab & activate Dev mode "On".
Then right click the wanted channel to copy its Id all below its contextual menu.
(The Server Id is the first digit in URL, or right click server & copy like done upper)
Now go https://discord.com/developers/applications to create an access for your Bebot :
Click "New Application" & give it a name which can be different from ingame botname.
Go into "Bot" tab, activate this option by clicking "Add Bot" & confirming.
Copy the Bot Token from this tab, it will be used later below.
Then go into "OAuth2" tab, check "bot" option in the "Scopes" window.
In "Permissions", check at least "View Channels" & "Send Messages" (aka 3072)
Back upper in "Scopes", click "Copy" to obtain the bot validation link.
Paste link in a web browser to visit it, select wanted server, confirm, captcha & win!
Now your bot should show as offline in your Discord (except at quick connection ping).
Execute this section only if you run Bebot on a PHP version lower than 7.0 :
Any Discord bot would be limitated until it has connected Discord wsocket once.
There is a lib to automate that but it only works with PHP 7.0+ ...
So to emulate this 1-timer ping, you can use any compatible solution for few minutes.
E.g. "Bot Designer For Discord" is a genius android appstored by Nilpointer Soft (J. Tomana).
Launch, create bot, enter name/token, accept policies, start, add time, login, logoff, close.
This way your bot access will be unlocked & fully capable, even under PHP 5.x !
Final step is to configure your Bebot by doing :
!settings discord
You'll obtain a panel in which you can set everything up :
- main connection elements BotToken & ChannelId
- other elements like channels options
After settings this all correctly, you can start Discord relay with :
!discord connect
The bot should fastly ping & then keep on relaying by itself even after reboot.
For more details & commands :
!help discord
If you bot doesn't ping/relay correctly, verify all !settings ...
Also verify all Discord side : roles/permissions, Ids, widget, etc.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。
English
