Skip to content

Commit

Permalink
Merge branch 'release-1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkress committed Aug 3, 2015
2 parents e250d49 + 8f48fe7 commit 58c3554
Show file tree
Hide file tree
Showing 9 changed files with 529 additions and 202 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ python:
branches:
only:
- master
- develop
install:
- pip install flake8 --use-mirrors
- pip install flake8
script:
- flake8 --ignore=E501,E265,E266,E402 .
82 changes: 66 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
# Spunky Bot
This README is just a quick start document. You can find more detailed documentation at [https://spunkybot.de](https://spunkybot.de).

# What is Spunky Bot?

**Spunky Bot** is a lightweight game server administration bot and RCON tool.
Its purpose is to administrate an [Urban Terror](http://www.urbanterror.info) 4.1 / 4.2 server and to provide real time statistical data for players.
Spunky Bot offers in-game commands without authentication and automated administration even when no admin is online.
The code of Spunky Bot is inspired by the eb2k9 bot by Shawn Haggard, which was released under the Beerware License.

[![Build Status](https://travis-ci.org/SpunkyBot/spunkybot.png?branch=master)](https://travis-ci.org/SpunkyBot/spunkybot)
![License](http://img.shields.io/badge/license-MIT-blue.svg)
[![Code Health](https://landscape.io/github/SpunkyBot/spunkybot/master/landscape.svg)](https://landscape.io/github/SpunkyBot/spunkybot/master)
![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Version](https://img.shields.io/badge/version-1.5.0-orange.svg)

If you want to know more, this is a list of selected starting points:

* Introduction to [Spunky Bot](https://spunkybot.de)
* The full list of [commands](https://github.com/SpunkyBot/spunkybot/blob/master/doc/Commands.md)
* There is much more inside the [official documentation](https://github.com/SpunkyBot/spunkybot/wiki)


## Features
- Lightweight and fast
- Real Time game statistics
- Real time game statistics
- Different user groups and levels
- Supports all RCON commands
- Supports temporary and permanent bans
- Supports temporary and permanent bans of players
- Supports rotation messages
- Stores all player related information in a SQLite database
- Runs 'out of the box', no other software requirements


## Environment
- Urban Terror 4.1.1 and 4.2.023
- Python 2.6.x / 2.7.x
Expand All @@ -25,35 +38,72 @@ The code of Spunky Bot is inspired by the eb2k9 bot by Shawn Haggard, which was
- Supporting Linux 32-bit and 64-bit operating system


## Resources
* [Documentation](https://github.com/SpunkyBot/spunkybot/wiki)
* [Bug Tracker](https://github.com/SpunkyBot/spunkybot/issues)
* [Code](https://github.com/SpunkyBot/spunkybot)
* [Homepage](http://spunkybot.de)
## Quickstart
It's easy to get started with Spunky Bot:

- Download the [latest release](https://spunkybot.de/#download)
- Read our [quickstart guide](https://spunkybot.de/#get-started) to get up and running

## Configuration
### Configuration
- Modify the Urban Terror server config file as follows:
- `seta g_logsync "1"`
- `seta g_loghits "1"`
- Restart the Urban Terror server
- Modify the Spunky Bot configuration file `/conf/settings.conf`
- Restart your Urban Terror server
- Modify the Spunky Bot configuration file `/conf/settings.conf` and set game server port and RCON password
- In-game displayed rules/advertisements are contained in the file `/conf/rules.conf`
- If you do not want to display the rotation messages, set the value `show_rules=0` in the config file `/conf/settings.conf`
- Run the bot manually: `python spunky.py`
- Run the application manually: `python spunky.py`
- Or use the provided initscript to run Spunky Bot as daemon

**_First start instruction:_**

- Connect to your game server and type `!iamgod` in the global chat to get the admin level "Head Admin". This command is only once available.


## Documentation
You can find all the documentation in the [Wiki](https://github.com/SpunkyBot/spunkybot/wiki).

### Bot Commands
The description of all available commands as well as the admin levels and rights are located under the subfolder `/doc`.
The description of all available [commands](https://github.com/SpunkyBot/spunkybot/blob/master/doc/Commands.md) as well as the admin levels and rights is located under the subfolder `/doc`.


## Resources
* [Documentation](https://github.com/SpunkyBot/spunkybot/wiki)
* [Troubleshooting](https://github.com/SpunkyBot/spunkybot/wiki/Troubleshooting)
* [Bug Tracker](https://github.com/SpunkyBot/spunkybot/issues)
* [Mailing List](https://groups.google.com/group/spunkybot)
* [Code](https://github.com/SpunkyBot/spunkybot)
* [Homepage](https://spunkybot.de)


## Changelog
You can keep up-to-date with the changes that we have made via our [releases page](https://github.com/Spunkybot/spunkybot/releases).


## Versioning
Spunky Bot is currently maintained under the [Semantic Versioning](http://semver.org) guidelines. Releases will be numbered with the following format: `<major>.<minor>.<patch>`


## Additional Information
For additional information, visit the Spunky Bot website at [https://www.spunkybot.de](https://www.spunkybot.de).

If you have any questions about Spunky Bot or need help, please use the [mailing list](https://groups.google.com/group/spunkybot) or post the question on our [forum](http://forum.spunkybot.de). If you need help right now, you can also find us on [Twitter](https://twitter.com/spunkybot).

If you have bug reports or feature suggestions, please use the [issue tracker](https://github.com/SpunkyBot/spunkybot/issues?state=open).


## Contributing
You can help us in different ways:

* Open an [issue](https://github.com/SpunkyBot/spunkybot/issues) with suggestions for improvements
* Fork this repository and submit a pull request
* Improve the [documentation](https://github.com/SpunkyBot/spunkybot-docs) (separate repository)

By contributing code to this project in any form, including sending a pull request via GitHub, a code fragment or patch via mail or public discussion groups, you agree to release your code under the terms of the MIT license that you can find in the [LICENSE](https://github.com/SpunkyBot/spunkybot/blob/master/LICENSE) file included in this source distribution.


## License
The Spunky Bot is released under the MIT License.
The code of Spunky Bot is released under the MIT License. See the [LICENSE](https://github.com/SpunkyBot/spunkybot/blob/master/LICENSE) file for the full license text.


### Third Party Libraries
Expand All @@ -64,4 +114,4 @@ The Spunky Bot is released under the MIT License.
- Schedule: [schedule.py](https://github.com/dbader/schedule)
- This file is released under the MIT License.

Urban Terror™ and FrozenSand™ are trademarks of 0870760 B.C. Ltd.
Urban Terror™ and FrozenSand™ are trademarks of 0870760 B.C. Ltd.
12 changes: 10 additions & 2 deletions conf/settings.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ rules_frequency = 90 ; Interval in seconds betwee
task_frequency = 60 ; Interval in seconds for checking ping, warnings + spectators. Set to 0 to disable this feature
max_ping = 200 ; Maximum allowed ping, player with higher ping will be kicked. Set to 0 to disable this feature
kick_spec_full_server = 10 ; Warn / kick spectator when more than X players are connected. Set to 0 to disable this feature
teamkill_autokick = 1 ; Enable (1) or disable (0) autokick for team killing
teamkill_autokick = 1 ; Enable (1) or disable (0) autokick for team killing. Regulars or higher levels will not get kicked
noob_autokick = 0 ; Enable (1) or disable (0) autokick of players with low score. Regulars or higher levels will not get kicked
show_country_on_connect = 1 ; Enable (1) or disable (0) displaying message "Player connected from..."
show_first_kill = 1 ; Enable (1) or disable (0) displaying message "firstblood" / "first nade kill"
show_hit_stats_respawn = 1 ; Enable (1) or disable (0) displaying hit statistics during respawn
Expand All @@ -21,6 +22,13 @@ allow_teams_round_end = 0 ; Enable (1) or disable (0)
spam_bomb_planted = 1 ; Enable (1) or disable (0) spamming the message "Bomb has been planted" in global chat
verbose = 0 ; Enable (1) or disable (0) debug messages

[mapcycle]
dynamic_mapcycle = 0 ; Enable (1) or disable (0) dynamic mapcycle. If enabled, the rotation of small or big_cycle will be used
switch_count = 5 ; When server reaches the number of players, the map rotation will be switched to 'big_cycle' list
; Comma separated list of valid map names
small_cycle = ut4_turnpike, ut4_abbey
big_cycle = ut4_turnpike, ut4_algiers, ut4_casa, ut4_sanc

[lowgrav]
support_lowgravity = 0 ; Enable (1) or disable (0) support for Low Gravity Server
gravity = 100 ; Set g_gravity to given value, default: 800
gravity = 100 ; Set g_gravity to given value, default: 800
4 changes: 3 additions & 1 deletion debian-startscript
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ DIR=/opt/spunkybot
USER=q3ut4
GROUP=q3ut4

# Change the name, if you want to run multiple instances of Spunky Bot
NAME=spunkybot

# Don't modify the code below
DAEMON=$DIR/spunky.py
NAME=spunkybot
RUNDIR=/var/run/$NAME
PIDFILE=$RUNDIR/$NAME.pid

Expand Down
14 changes: 13 additions & 1 deletion doc/Spunky Bot Commands.md → doc/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
- Usage: `!freezestats`
- **hestats** - display HE grenade kill stats
- Usage: `!hestats`
- **hits** - display hit stats
- Usage: `!hits`
- **teams** - balance teams
- Usage: `!teams`
- **time** - display the current server time
Expand Down Expand Up @@ -61,6 +63,8 @@
- Usage: `!nextmap`
- **mute** - mute or unmute a player
- Usage: `!mute <name> [<seconds>]`
- **poke** - notify a player that he needs to move
- Usage: `!poke <name>`
- **seen** - display when the player was last seen
- Usage: `!seen <name>`
- **shuffleteams** - shuffle the teams
Expand Down Expand Up @@ -137,15 +141,21 @@

### Senior Admin [80]

- **banlist** - display the last entries of the banlist
- **banlist** - display the last active 10 bans
- Usage: `!banlist`
- **kiss** - clear all player warnings
- Usage: `!kiss`
- **kill** - kill a player
- Usage: `!kill <name>`
- **lastbans** - list the last 4 bans
- Usage: `!lastbans`
- Short: `!bans`
- **lookup** - search for player in database
- Usage: `!lookup <name>`
- Short: `!l <name>`
- **makereg** - make a player a regular (Level 2) user
- Usage: `!makereg <name>`
- Short: `!mr <name>`
- **map** - load given map
- Usage: `!map <ut4_name>`
- **maps** - display all available maps
Expand All @@ -158,6 +168,8 @@
- Usage: `!cyclemap`
- **setnextmap** - set the given map as nextmap
- Usage: `!setnextmap <ut4_name>`
- **swapteams** - swap the current teams
- Usage: `!swapteams`
- **permban** - ban a player permanent
- Usage: `!permban <name> <reason>`
- Short: `!pb <name> <reason>`
Expand Down
Binary file modified lib/GeoIP.dat
Binary file not shown.
6 changes: 3 additions & 3 deletions lib/rcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This program is released under the MIT License.
"""

__version__ = '1.0.8'
__version__ = '1.0.9'


### IMPORTS
Expand Down Expand Up @@ -123,8 +123,8 @@ def get_mapcycle_path(self):
else:
mapcycle_path = None
if mapcycle_path:
file_handle = open(mapcycle_path, 'r')
lines = file_handle.readlines()
with open(mapcycle_path, 'r') as file_handle:
lines = [line for line in file_handle if line != '\n']
try:
while 1:
tmp = lines.pop(0).strip()
Expand Down
8 changes: 3 additions & 5 deletions lib/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This program is released under the MIT License.
"""

__version__ = '1.0.3'
__version__ = '1.0.4'


### IMPORTS
Expand Down Expand Up @@ -52,15 +52,13 @@ def process(self):
# initial wait
time.sleep(30)
while 1:
filehandle = open(self.rules_file, 'r+')
rotation_msg = filehandle.readlines()
with open(self.rules_file, 'r') as filehandle:
rotation_msg = filehandle.readlines()
if not rotation_msg:
filehandle.close()
break
for line in rotation_msg:
# display rule
with self.rcon_lock:
self.rcon_handle.push("say ^2%s" % line.strip())
# wait for given delay in the config file
time.sleep(self.rules_frequency)
filehandle.close()
Loading

0 comments on commit 58c3554

Please sign in to comment.