Event not registering?
Helyux opened this issue · 3 comments
Hi first of all, thanks for this wonderful API!
I'm having some trouble understanding the servernotifyregister ability.
This is my current code (left the connecting part):
ts3conn.servernotifyregister(event="server")
msg = "Keep this chat open to use custom commands"
while True:
ts3conn.send_keepalive()
print("DEBUG: Sent Keepalive")
try:
# This method blocks, but we must sent the keepalive message at
# least once in 5 minutes to avoid the sever side idle client
# disconnect. So we set the timeout parameter simply to 1 minute.
event = ts3conn.wait_for_event(timeout=60)
except ts3.query.TS3TimeoutError:
print("DEBUG: Timeout Error")
pass
else:
print("DEBUG: Got Event")
# Greet new clients.
if event[0]["reasonid"] == "0":
print("Client '{}' connected.".format(event[0]["client_nickname"]))
ts3conn.sendtextmessage(targetmode=1,target=event[0]["clid"], msg=msg)
return None
The Serverqueryclient is sitting in the Default Channel.
The Serverqueryclient has SA rights.
Now when a new Client joins the Server, the else:
part never triggers,
all i'm seeing is a constant (60 seconds as in timeout
) switch between DEBUG: Sent Keepalive
and DEBUG: Timeout Error
why am i not getting an event?
Thanks in advance.
I recall some known issue with the keepalive method on the TS3 Side. Maybe try sending a command? This is really just a guess though.
And is the event not triggering, even when connecting?
This did the Trick, thanks alot!
i just changed the ts3conn.send_keepalive()
to ts3conn.version()
and it works as expected.
i wonder if @benediktschmitt can fix the keepalive function in any way.
Sure, I uploaded the new version to pypi.