Difference between revisions of "Friendlist"

From Bebot Wiki 2
Jump to navigationJump to search
 
(2 intermediate revisions by the same user not shown)
Line 32: Line 32:
  
 
Both solution are detailed within 0.7 Readme from Git https://github.com/J-Soft/BeBot/ (official) or https://github.com/bitnykk/BeBot/ (sandbox)
 
Both solution are detailed within 0.7 Readme from Git https://github.com/J-Soft/BeBot/ (official) or https://github.com/bitnykk/BeBot/ (sandbox)
 +
 +
For Aocp, principle will be to run a companion service accessible by setting up target server number plus 90 (so 95 for RK5, eg).
 +
 +
More details are provided in the upper Readmes (on any of both github repos).
 +
 +
 +
== AoCp ==
 +
 +
If you choose this great solution, it may bring some rare but unwanted miscommunication issues, e.g. after a server downtime, that could occasionnally make the bot unable to speak with its proxy, or stucked at reboot, or proxy in error, etc.
 +
 +
The best way to fix any of these is to setup the bot and its proxy under a service each (linux prefered from far in this !) as explained on bottom of installation page http://wiki.bebot.link/index.php/Installation
 +
 +
Once this is done and working, you should (1) set a module into the bot that helps proving it's is still online and alive plus (2) another croned server script that will check bot life proof every minute and possibly take measures in case of issue.
 +
 +
1: our suggested bot module is into Custom/Modules and is named HeartBeat.php ; just remove its initial _underscore to activate it and restart the serviced bot. From there the bot should update a .txt file of its own name at startup and then every 5 minutes.
 +
 +
2: from there you only need to cron the server life checker script. Cron would be like :
 +
* * * * * /path/to/script.sh
 +
And this executable (chmod +x) script should contain stuff as :
 +
#!/bin/bash
 +
file=/path/to/bebot/Custom/Modules/Botname.txt
 +
current=`date +%s`
 +
last_modified=`stat -c "%Y" $file`
 +
if [ $(($current-$last_modified)) -gt 999 ]; then
 +
      /bin/systemctl stop botname.service;
 +
      sleep 2;
 +
      /bin/systemctl stop aocp.service;
 +
      sleep 2;
 +
      /bin/systemctl start aocp.service;
 +
      sleep 2;
 +
      /bin/systemctl start botname.service;
 +
fi
 +
As you see, if after 16 minutes there's no proof of bot life, this script would cleanly close both bot then proxy, and then relaunch both proxy then bot (in that wanted stack order, with 2 seconds delay to make sure processes are loaded and ready to communicate).

Latest revision as of 18:47, 16 December 2023

In both AO and AOC, each character should be limited to 1000 contact in friend/buddy list.

This limitation is a problem :

- for a guildbot of an org with more than 1000 members

- for a raidbot with over 1000 subscribers

So how to bypass this issue ?


In Bebot 0.6.x :

- AOC => might use slaves module only (need testing)

- AO => can use slaves module OR AoCP solution (see below)

In short, you need to download file 02_Slaves.php within bot main folder and then add its config line(s) looking like :

    $slaves[] = array("account", "password", "Character);

More details in this archived topic http://bebot.link/ao-0-6-x-customunofficial-modules/slaves/


In Bebot 0.7.x :

- AO => must use AoCP solution ; in short, it's a scala proxy of several bots sharing bigger friendlist

- AOC => has a new tailored solution ; in short, each bot has a slave added to its config by a line looking like :

    $slave = "Character";

Both solution are detailed within 0.7 Readme from Git https://github.com/J-Soft/BeBot/ (official) or https://github.com/bitnykk/BeBot/ (sandbox)

For Aocp, principle will be to run a companion service accessible by setting up target server number plus 90 (so 95 for RK5, eg).

More details are provided in the upper Readmes (on any of both github repos).


AoCp

If you choose this great solution, it may bring some rare but unwanted miscommunication issues, e.g. after a server downtime, that could occasionnally make the bot unable to speak with its proxy, or stucked at reboot, or proxy in error, etc.

The best way to fix any of these is to setup the bot and its proxy under a service each (linux prefered from far in this !) as explained on bottom of installation page http://wiki.bebot.link/index.php/Installation

Once this is done and working, you should (1) set a module into the bot that helps proving it's is still online and alive plus (2) another croned server script that will check bot life proof every minute and possibly take measures in case of issue.

1: our suggested bot module is into Custom/Modules and is named HeartBeat.php ; just remove its initial _underscore to activate it and restart the serviced bot. From there the bot should update a .txt file of its own name at startup and then every 5 minutes.

2: from there you only need to cron the server life checker script. Cron would be like :

* * * * * /path/to/script.sh

And this executable (chmod +x) script should contain stuff as :

#!/bin/bash
file=/path/to/bebot/Custom/Modules/Botname.txt
current=`date +%s`
last_modified=`stat -c "%Y" $file`
if [ $(($current-$last_modified)) -gt 999 ]; then
     /bin/systemctl stop botname.service;
     sleep 2;
     /bin/systemctl stop aocp.service;
     sleep 2;
     /bin/systemctl start aocp.service;
     sleep 2;
     /bin/systemctl start botname.service;
fi

As you see, if after 16 minutes there's no proof of bot life, this script would cleanly close both bot then proxy, and then relaunch both proxy then bot (in that wanted stack order, with 2 seconds delay to make sure processes are loaded and ready to communicate).