Skip to content

Commit

Permalink
Return punish result as a bool and not str
Browse files Browse the repository at this point in the history
  • Loading branch information
cemathey committed May 21, 2024
1 parent 00104ca commit d1efa04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions rcon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,11 @@ def remove_map_from_rotation(
return self._str_request(cmd, can_fail=False, log_info=True)

@_escape_params
def punish(self, player_name: str, reason: str) -> str:
return self._str_request(f'punish "{player_name}" "{reason}"', log_info=True)
def punish(self, player_name: str, reason: str) -> bool:
return (
self._str_request(f'punish "{player_name}" "{reason}"', log_info=True)
== SUCCESS
)

@_escape_params
def kick(self, player_name: str, reason: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion rcon/rcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def ban_profanities(self, profanities: list[str]) -> bool:
with invalidates(self.get_profanities):
return super().ban_profanities(",".join(profanities))

def punish(self, player_name: str, reason: str, by: str) -> str:
def punish(self, player_name: str, reason: str, by: str) -> bool:
res = super().punish(player_name, reason)
safe_save_player_action(
rcon=self,
Expand Down

0 comments on commit d1efa04

Please sign in to comment.