Skip to content

Commit ea48220

Browse files
committed
BUGFIX:
- Mission: Key errors in ban messages
1 parent e9bfcc9 commit ea48220

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

plugins/mission/listener.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,8 @@ async def onBanReject(self, server: Server, data: dict) -> None:
673673
admin_channel = self.bot.get_admin_channel(server)
674674
if not admin_channel:
675675
return
676-
player = server.get_player(ucid=data['ucid'])
677676
message = _('Banned user {name} (ucid={ucid}, ipaddr={ipaddr}) rejected. Reason: {reason}').format(
678-
name=player.display_name, ucid=data['ucid'], ipaddr=data['ipaddr'], reason=data['reason'])
677+
name=data.get('name', 'n/a'), ucid=data['ucid'], ipaddr=data['ipaddr'], reason=data['reason'])
679678
await admin_channel.send(f"```{message}```")
680679

681680
@event(name="onBanEvade")

plugins/mission/lua/callbacks.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function mission.onPlayerTryConnect(addr, name, ucid, playerID)
126126
end
127127
local msg = {
128128
command = 'onBanReject',
129+
name = name,
129130
ucid = ucid,
130131
ipaddr = ipaddr,
131132
reason = dcsbot.banList[ucid]
@@ -136,6 +137,7 @@ function mission.onPlayerTryConnect(addr, name, ucid, playerID)
136137
local old_ucid = dcsbot.banList[ipaddr]
137138
local msg = {
138139
command = 'onBanEvade',
140+
name = name,
139141
ucid = ucid,
140142
ipaddr = ipaddr,
141143
old_ucid = old_ucid,

0 commit comments

Comments
 (0)