TSN RANKSYSTEM - TeamSpeak Bot

A PHP Bot that assigns time-based server groups
on your TeamSpeak server.

Download

The TSN Ranksystem is an open source project,
it is free to use under the GNU GPLv3 license.

Download the latest version:
DOWNLOAD (Version: 1.3.3)
 

MD5: dec904f2f1fbd6e671924cfe40d56f40

Do you like this tool?

Then you might want to sponsor a beer for the developer.

This enables them to develop new features more smoothly! ;-)
Donate (via PayPal)

Features

The TSN Ranksystem brings two components:

1) A TeamSpeak Bot &
2) A Website with:
- a statistics page (demo) &
- a web interface (demo)


TeamSpeak Bot
The TeamSpeak bot connects to the TeamSpeak server over the official TS3 Query interface. The bot does all backend jobs. It collects the online & active time of the TS3 user, calculates all statistics and collects several other data. And sure, it gives the server groups to the clients (e.g. military ranks, level, prestiges).

Statistics Page
On the public statisics page are several data available. There are displayed statistics about clients and the server.
It is much as powerful to describe all. To name only a few things:
- You'll find ranking list, to get the most active users.
- It has also a server usage graph with the online clients and channel.
- Client statistics about: online & active time, versions, nationalities, platforms, used slots, and so much more...

Web Interface
With the web interface you can easily control the bot. It is an access secured site for the administrators of the Ranksystem. They can manage the bot, like start and stop them. All parameters are defined on this place to individually configurate the Ranksystem for the needed of your TS3 server. Sure, it is well documented directly inside the web interface.

Installation on Linux

1) Requirements

Before you can start running the TSN Ranksystem Bot on your TeamSpeak server, we need to check the requirements of your environment.

 

For the statistics page and to be able to run the Bot in a PHP process, we need a webspace (webserver).

 PHP 5.5.0 or higher
 PHP with privileges for the command "exec"
 PHP with unlimited script execution time; especially you should check this on a webhosting
 required PHP extensions:
- PHP PDO extension
- PHP cURL extension
- PHP Zip extension
- PHP SSH2 extension
- PHP mbstring extension

 network connection to the TS3 ServerQuery of your TS3 server on TCP; default port 10011
 network connection to ts-ranksystem.com (IP: 164.132.201.2) on TCP port 443
 optional: job scheduler (for automatically restart the Bot) like a cronjob

The database will storage all information. This is necessary to get a real time statistic page.

 MySQL (or derivative like MariaDB)
 requires its own database
 required privileges:
- Data:
SELECT, INSERT, UPDATE, DELETE
- Structure:
CREATE, ALTER, INDEX, DROP

To connect with the TeamSpeak 3 server, we need access to the TS3 ServerQuery interface.

 Network connection between the webspace and the TS3 ServerQuery
 TS3 ServerQuery User with following permissions:
- b_virtualserver_info_view
- b_virtualserver_client_list
- b_virtualserver_client_dblist
- b_virtualserver_client_dbsearch
- b_virtualserver_client_dbinfo
- b_virtualserver_notify_register
- b_virtualserver_servergroup_list
- b_virtualserver_servergroup_client_list
- i_group_member_add_power
- i_group_member_remove_power
- b_icon_manage
- b_client_remoteaddress_view
- i_client_private_textmessage_power
- i_ft_file_browse_power
- i_ft_file_download_power

 

2) Download & Unzip

Download and unzip the file ranksystem_latest.zip.

 

3) Upload to webspace

Upload the whole unzipped folder to a directory on your webspace and grant permissions to the user of your webserver.

 

4) Run install process

Open the "install.php" on your browser and follow the instructions https://your.url/ranksystem-folder/install.php.

 

5) Configure webinterface

Configure the TSN Ranksystem about the webinterface https://your.url/ranksystem-folder/webinterface/.
For each parameter you'll find a documentation by mouse click on it.

 

6) Start Bot

Start the TSN Ranksystem Bot via the webinterface.

 

7) Add cronjob (optional)

Optional: Create a cronjob to be sure, the Bot is running 24/7. This will restart the Bot automatically, e.g. on a database restart.

Open a SSH session to the host machine of your webserver.

Enter the command crontab -e, go to editing mode (in VIM you need to press i).

Paste the following in a new line:

*/10 * * * * sudo -u www-data php /path_to_your_webspace/path_to_the_ranksystem/worker.php check >/dev/null 2>&1

Configure the path, where your TSN Ranksystem is located and replace www-data with the user of your webserver.

Save and quit the crontab (in VIM :wq).

Installation on Windows

1) Requirements

Before you can start running the TSN Ranksystem Bot on your TeamSpeak server, we need to check the requirements of your environment.

 

For the statistics page and to be able to run the Bot in a PHP process, we need a webspace (webserver).

 PHP 5.5.0 or higher
 PHP with privileges for the command "exec"
 PHP with unlimited script execution time; especially you should check this on a webhosting
 required PHP extensions:
- PHP PDO extension
- PHP COM extension
- PHP cURL extension
- PHP Zip extension
- PHP SSH2 extension
- PHP mbstring extension

 network connection to the TS3 ServerQuery of your TS3 server on TCP; default port 10011
 network connection to ts-ranksystem.com (IP: 164.132.201.2) on TCP port 443
 optional: job scheduler (for automatically restart the Bot) like a task scheduler

The database will storage all information. This is necessary to get a real time statistic page.

 MySQL (or derivative like MariaDB)
 requires its own database
 required privileges:
- Data:
SELECT, INSERT, UPDATE, DELETE
- Structure:
CREATE, ALTER, INDEX, DROP

To connect with the TeamSpeak 3 server, we need access to the TS3 ServerQuery interface.

 Network connection between the webspace and the TS3 ServerQuery
 TS3 ServerQuery User with following permissions:
- b_virtualserver_info_view
- b_virtualserver_client_list
- b_virtualserver_client_dblist
- b_virtualserver_client_dbsearch
- b_virtualserver_client_dbinfo
- b_virtualserver_notify_register
- b_virtualserver_servergroup_list
- b_virtualserver_servergroup_client_list
- i_group_member_add_power
- i_group_member_remove_power
- b_icon_manage
- b_client_remoteaddress_view
- i_client_private_textmessage_power
- i_ft_file_browse_power
- i_ft_file_download_power

 

2) Download & Unzip

Download and unzip the file ranksystem_latest.zip.

 

3) Upload to webspace

Upload the whole unzipped folder to a directory on your webspace and grant permissions to the user of your webserver.

 

4) Run install process

Open the "install.php" on your browser and follow the instructions https://your.url/ranksystem-folder/install.php.

 

5) Set PHP Path

Set the path to the php.exe (PHP installation) inside the other\phpcommand.php. Examples you'll find inside this file.

 

6) Configure webinterface

Configure the TSN Ranksystem about the webinterface https://your.url/ranksystem-folder/webinterface/.
For each parameter you'll find a documentation by mouse click on it.

 

7) Start Bot

Start the TSN Ranksystem Bot via the webinterface.

 

8) Add new Task (optional)

Optional: Create a task inside the task scheduler to be sure, the Bot is running 24/7. This will restart the Bot automatically, e.g. on a database restart.

Windows help how to create a new task.

Add the following options:

C:\path\to\php.exe -f C:\path\to\Ranksystem\worker.php check

Configure the path, where you find your PHP installation and also the path where your TSN Ranksystem is located.

Get a hosting

When you are not able to host the TSN Ranksystem yourself, you can ask here for a hosting.

The hosting is absolutely free. If you want to support this service, donations are welcome. ;-)

If we accept your request, the hosting will remain as long as the Bot is running and able to connect to your TS3 server. Bots, which are offline for more than one week (=inactive) will be deactivated and after one additional week deleted.


Request a hosting

With the hosting we take the part of the requirements of the webspace and the database.
- You still need access to the TS3 server via ServerQuery; ServerQuery credentials (username and password) are required!
- Be sure your TS3 server allows a connection from our IP address 164.132.201.2.
- You should whitelist these IP also inside the query_ip_whitelist.txt, which you'll find inside the TS3 server installation directory.

 
 
 

After submitting your request it could take a few hours to create the hosting, cause we check each one manually! You will definitely get an answer. In case of accepting we will send you all needed information (hosting credentials & guide) via email.

Bot Commands

CommandParameterBot-AdminDescription
!help
!info
!cmd
!commands
- none -- / -Get a list of valid bot commands
Since version 1.3.0 it will sends you here.
!version- none -- / -Returns the current version under which the Ranksystem runs.
!update
!checkupdate
- none -requiredPerforms a check for new available updates.
Since the Ranksystem updates itself automatically, the update
process will be started as soon as a new version detected.
!next
!nextup
- none -- / -This checks the user-related required time to reach the
next higher rank. The investigated time will be sent as a private
chat message to the user.
!restart
!reboot
- none -requiredInitiates a reboot of the Ranksystem bot.
!shutdown
!quit
!stop
- none -requiredInitiates a shutdown of the Ranksystem bot.
!log
!logs
Parameter 1
number of log entries
expect number between 1 and 999

Example:
!log 5
This will give you the last 5 log lines.
requiredGet the last few log entries of the Ranksystem-Log
via private chat message.
!runtime
!runtimes
- none -- / -Get the last 10 runtimes of the Ranksystem bot.
Each value represents the needed duration for one round
of the bot, measured in seconds.
!uptime
!online
- none -- / -The bot sends the time of the last (re)start and
also calculates the online time.
!memory- none -- / -Get the needed memory the Ranksystem bot is using inside the PHP process.
PHP brings a overhead, so the PHP process on the system needs more memory.
!clean- none -requiredStarts the process of cleaning the user database.
It only takes effect when the function 'clean clients' is activated.
!reloadgroups
!reloadicons
- none -requiredCleans the group cache.
All server groups will be reloaded from the TS3 server and associated with this the group icons will be re-downloaded.
Also the server icon will be re-downloaded.
 

Changelog

Explanation

!   Note          (bigger) change you should notice of; in some cases there are things to do
*   Information   for your information, but there is nothing you need to do; changed something works in background
+   Feature       added a new feature or enhanced a feature
-   Bugfix        fixed a bug or corrected something
 
 

1.3.4 (2019-XX-XX) - NOT YET RELEASED

beta-1 * optimized check for Bot name; added min-length of 3 characters to avoid errors due connecting virtual server
beta-1 * updated hungarian language; thx to ExXeL
beta-2 * little code optimization on reset password function for the webinterface
beta-1 + added check PHP extension mbstring is loaded
beta-1 + added azerbaijan language; thx to G. FARZALIYEV
beta-2 + added new configuration parameter for the max. clients (red) line on the server usage graph on the statistics page
beta-2 - fixed spelling error in russian language; thx to Alexander
beta-2 - fixed "Undefined offset" on list_rankup.php, when stored servergroup of user (which is longer time offline) isn't existing anymore
 

1.3.3 (2019-07-26)

! new PHP extension mbstring is needed
* optimized SQL statement of building user_snapshots
+ added hungarian language; thx to ExXeL
- fixed handling user nicknames with multibyte characters and a length longer 30
- fixed PHP warning on stats/top sites, when servergroup exception is empty
 

1.3.2 (2019-07-01)

- fixed looping systems, when user nicknames are longer than 28 characters
 

1.3.1 (2019-06-30)

! new TS3 permission 'b_virtualserver_servergroup_client_list' needed for reset function
! new TS3 permission 'b_virtualserver_client_dbsearch' needed for special case cldbid has changed
* performance optimization with optimizing the SQL handling; a few statistic values will be cached inside PHP and only saved to DB, when changes have taken place
* updated jQuery library to version 3.4.1
* updated Bootstrap library to version 3.4.1
* changed Ranksystem log; added few more things to log during startup (loglevel, query-slowmode, update-channel); changed some things to be forced to log during startup, also when bot level is very low
* optimized downloading of servergrous & icons on TS3 errors (e.g. connection lost)
* minor code optimizations
* changed core rankup assigning; now check wrong server groups and remove them; if the current level is missed, correct it and add the server group
* changed navbar inside the webinterface to be more clearly and structured
+ added automatically language support; when you add a file inside the languages folder and it fullfill the name conventions, it will be added automatically; more information you will find inside the /languages/add_new_language.php
+ added check for changed client-database-ID (e.g. happens on restoring a server snapshot) for offline user; This check was still here, but only for online user; cldbid will be updated or the time of the user reset depending on specification of 'Client-database-ID reset'
+ added new function to reset the Ranksystem
+ added bot command !memory
+ added an average looptime to the !runtime command
- fixed "DateTime::__construct()" error on /stats/my_stats.php when boost function is defined with decimal numbers
- fixed "TS3 Error: 0: only available in non-blocking mode" on secured (SSH) TS Query connection
- fixed XSS vulnerability on /stats/ top users via client_nickname
- fixed online status of users; when the last user left the TS server, it stayed online on 'List Rankup' page
- fixed rarely constellation on update servergroups in bot core, when none of this groups have an icon and also no servericon is set
- fixed rarely constellation in bot core, when only user(s) without any country flag (pre-4: or without any platform or without any version) are online
- fixed wrong response on command !clean, that you wouldn't be allowed to use the command despite admin privileges
 
Show older entries

Support

Please report bugs and also feature requests preferred on GitHub.

You can also get support on our public TeamSpeak server ts-n.net.
Contact an admin there (server group: Ranksystem Staff Ranksystem - Staff). Please stay patient, when we don't react immediately. Please give us at least 10-15 minutes to response.

You want to ask for a free hosting? Have a look above to request a hosting.