[SCRIPT] checkban,py

The servers for default will always save the data of the bans in the file bans.txt, it does not matter if the IP of the player is banned again, the new ban will be saved causing the accumulation of bans with repeated IPs, I don't like this.

Seeing this, I decided to modify the code a little so that you can choose whether to let the new ban accumulateor that the old bans of that IP are eliminated leaving only the current ban (only if that IP has been previously banned).

If the option to accumulate the bans is enabled, this script will automatically get only the bans that did not expire leaving aside those that have already expired and still remain in the bans.txt, this will also get the ban with the longest if a IP was banned more than 1 time.

If the option of not accumulating the bans is enabled, the IP ban/nick will be obtained directly and it will be verified that the ban has not expired (in case it is still in the bans.txt)

To activate the option not to accumulate bans you must use the command /togglebans, otherwise use the command again in case you want to disable it, by default this will be disabled (the bans will accumulate)

That said, the purpose of the script is to obtain the data of a specific ban, you can search it through an IP or nick.

Example:
/check MegaStar
/checkban 127.0.0.1

Commands:
/check <ip/nick>
/togglebans => enabled/disabled


checkban.py (4.1 KB)