Skip to content

Commit

Permalink
my_connection_lost event
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaTegner committed Jul 11, 2024
1 parent 127fc04 commit 5fbef26
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/_static/csv/bot.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ on_my_connect teamtalk.Server Called when the bot has successfully connected to
on_my_login teamtalk.Server Called when the bot has successfully logged in to the teamtalk.Server
on_my_logout teamtalk.Server Called when the bot has successfully logged out from the teamtalk.Server
on_my_disconnec teamtalk.Server Called when the bot has successfully disconnected from the teamtalk.Server
on_my_connection_lost teamtalk.instance Called when the bot has lost connection to the teamtalk.Server
on_my_kicked_from_channel teamtalk.Channel Called when the bot has been kicked from teamtalk.Channel
5 changes: 5 additions & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ This document holds a human-readable list of changes between releases.
version: 1.3.0 - unreleased
---------------------------------

Added
~~~~~

- Added the handling of the bot lost connection to the server event.

Fixed
~~~~~

Expand Down
4 changes: 4 additions & 0 deletions teamtalk/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,10 @@ async def _process_events(self) -> None: # noqa: C901
banned_user = TeamTalkBannedUserAccount(self, banned_user_struct)
self.banned_users.append(banned_user)
return
if event == sdk.ClientEvent.CLIENTEVENT_CON_LOST:
self.bot.dispatch("my_connection_lost", self)
return

else:
# if we haven't handled the event, log it
# except if it's CLIENTEVENT_CMD_PROCESSING or CLIENTEVENT_CMD_ERROR or CLIENTEVENT_CMD_SUCCESS
Expand Down

0 comments on commit 5fbef26

Please sign in to comment.