Hello There!
First of all thank you guys for this awesome bot! I really like it and once you set it up it works like a charm.
But i have one Problem... I can't quit the program.
I'm running it within a Screen Session on my Debian-vServer.
When I terminate the program by pressing Crtl+C
Here is a copy of the terminal-output.
kf2server@vServer:~/magicked_admin$ python3 main.py
INFO: Database for server_one initialised
INFO: Connecting to: 127.0.0.1:22123 (server_one)
INFO: Mapper for server_one initialised
INFO: Server server_one initialised
INFO: Executing script: server_one.init
start_wc 1 say Hello! I'm ChatBot and here to help you. Type !help so get started :)
start_tc 180 say Hi! Want to know how you are doing? Typ !me or !help in the chat :)
INFO: Bot on server server_one initialised
INFO: Initialisation complete
ChatBot@server_one: Wave command started.
ChatBot@server_one: Timed command started.
DEBUG: No players
DEBUG: No players
DEBUG: No players
_N0x@server_one: !me
INFO: Writing players
ChatBot@server_one: Stats for _N0x:
Sessions: 0
Play time: 00:00:00
Deaths: 0
Kills: 0
Dosh earned: 0
Dosh spent: 0
Health lost: 0
Dosh this game: 0
Kills this wave: 0
Dosh this wave: 0
_N0x@server_one: !help
ChatBot@server_one: Player commands:
!me, !dosh, !kills, !server_dosh, !server_kills, !top_dosh, !top_kills, !stats, !info
DEBUG: No players
_N0x@server_one: !info
DEBUG: No players
ChatBot@server_one: I'm a bot for ranked Killing Floor 2 servers. Visit:
github.com/th3-z/kf-magicked-admin/
for information, source code, and credits.
DEBUG: No players
^C
INFO: Terminating...
INFO: Writing players
I took a look at the Python skripts and the last thing that is outputting "INFO: Writing players" is
the method write_all_players in server/server.py
def write_all_players(self, final=False):
print("INFO: Writing players")
for player in self.players:
self.database.save_player(player, final)
because saving player stats works while the program is running i suspect that the error lies within the "final" part in the method save_player
in the file database/database.py
if final:
now = datetime.datetime.now()
elapsed_time = now - player.session_start
seconds = elapsed_time.total_seconds()
new_time = player.total_time + seconds
self.cur.execute("UPDATE players SET time_online = ? WHERE username = ?",
(new_time, player.username))
But i could not find any thing wrong here. (Still learning pyhton...)
Please let me know if you need any other information!
Thank you
Tim
EDIT:
Just to make sure here are the permissions for the files. It should be no problem to write data to the .sqlite file.
kf2server@vServer:~/magicked_admin$ ls -lsh
insgesamt 92K
4,0K drwxr-xr-x 4 kf2server kf2server 4,0K Apr 10 12:05 chatbot
4,0K drwxr-xr-x 2 kf2server kf2server 4,0K Apr 10 12:03 config
4,0K drwxr-xr-x 3 kf2server kf2server 4,0K Apr 11 11:37 database
32K -rw-r--r-- 1 kf2server kf2server 32K Apr 10 12:03 icon.ico
4,0K -rw-r--r-- 1 kf2server kf2server 205 Apr 10 12:40 magicked_admin.conf
4,0K -rw-r--r-- 1 kf2server kf2server 2,1K Apr 10 12:46 main.py
4,0K drwxr-xr-x 5 kf2server kf2server 4,0K Apr 10 12:04 server
20K -rw-r--r-- 1 kf2server kf2server 20K Apr 11 09:26 server_one_db.sqlite
4,0K -rw-r--r-- 1 kf2server kf2server 170 Apr 10 13:32 server_one.init
4,0K -rw-r--r-- 1 kf2server kf2server 224 Apr 10 12:41 server_one.motd
4,0K -rw-r--r-- 1 kf2server kf2server 999 Apr 10 12:03 setup.py
4,0K drwxr-xr-x 3 kf2server kf2server 4,0K Apr 10 12:05 utils