Skip to content

Commit e8d508b

Browse files
Fix doorman call webhook error where Client reference may be passed after the client already does note xist
1 parent 3083e48 commit e8d508b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

server/area.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,8 +1404,10 @@ def send_ic(self,
14041404
afkers = len(self.afkers)
14051405
doorman_needed = living_clients <= 1 or afkers >= living_clients - 1
14061406
if doorman_needed and self.can_call_doorman():
1407+
description = f"[{client.id}] {client.name} ({client.showname}) in hub [{client.area.area_manager.id}] {client.area.area_manager.name} [{client.area.id}] {client.area.name}"
1408+
description += f"\n{msg}"
14071409
asyncio.get_running_loop().call_soon(
1408-
self.server.webhooks.doormancall, client
1410+
self.server.webhooks.doormancall, description
14091411
)
14101412
self.set_doorman_call_delay()
14111413

server/network/webhooks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def needcall(self, client=None, reason=None):
140140
url=url,
141141
)
142142

143-
def doormancall(self, client=None):
143+
def doormancall(self, description = ""):
144144
if "doorman_webhook" not in self.server.config:
145145
return
146146

@@ -159,9 +159,6 @@ def doormancall(self, client=None):
159159
if pingoption:
160160
message += f"<@&{self.server.config['doorman_webhook']['role_id']}> \n"
161161
message += self.server.config["doorman_webhook"]["message"]
162-
description = f"[{client.id}] {client.name} ({client.showname}) in hub [{client.area.area_manager.id}] {client.area.area_manager.name} [{client.area.id}] {client.area.name}"
163-
description += f"\n{client.area.last_ic_message[4]}"
164-
165162
self.send_webhook(
166163
username=username,
167164
avatar_url=avatar_url,

0 commit comments

Comments
 (0)