mirror of
https://github.com/Thor77/TeamspeakStats.git
synced 2025-07-07 07:58:43 -04:00
Add tsstats/event.py for easy event-initialization
This commit is contained in:
parent
08b4e06f10
commit
da2b773bf6
1 changed files with 33 additions and 0 deletions
33
tsstats/events.py
Normal file
33
tsstats/events.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
|
Event = namedtuple(
|
||||||
|
'Event', ['timestamp', 'identifier', 'action', 'arg', 'arg_is_client']
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def nick(timestamp, identifier, nick):
|
||||||
|
return Event(timestamp, identifier, 'set_nick', nick, arg_is_client=False)
|
||||||
|
|
||||||
|
|
||||||
|
def connect(timestamp, identifier):
|
||||||
|
return Event(
|
||||||
|
timestamp, identifier, 'connect', arg=timestamp, arg_is_client=False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def disconnect(timestamp, identifier):
|
||||||
|
return Event(
|
||||||
|
timestamp, identifier, 'disconnect', arg=timestamp, arg_is_client=False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def kick(timestamp, identifier, target_identifier):
|
||||||
|
return Event(
|
||||||
|
timestamp, identifier, 'kick', target_identifier, arg_is_client=True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def ban(timestamp, identifier, target_identifier):
|
||||||
|
return Event(
|
||||||
|
timestamp, identifier, 'ban', target_identifier, arg_is_client=True
|
||||||
|
)
|
Loading…
Add table
Reference in a new issue