Skip to content

Commit

Permalink
Add pattern detection for SPADS !unboss command output. (#504)
Browse files Browse the repository at this point in the history
Teiserver currently tracks who is the boss of a lobby by looking
for known outputs from the `!boss` SPADS command.

However, an `!unboss` command was recently added to SPADS, and
Teiserver currently does not recognize the output of that command.
As a result, whenever the `!unboss` command is used, Teiserver's
list of bosses becomes out of sync with SPADS's list.

This patch adds an additional pattern so that the output of
`!unboss` is recognized and parsed.
  • Loading branch information
DeviousNull authored Oct 14, 2024
1 parent f673efb commit 62acf41
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/teiserver/coordinator/spads_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ defmodule Teiserver.Coordinator.SpadsParser do
_match = Regex.run(~r/Boss mode disabled by \S+/, msg) ->
{:host_update, %{host_bosses: []}}

# Remove an individual boss
match = Regex.run(~r/Boss mode disabled for (\S+) \(by \S+\)/, msg) ->
[_, player_name] = match
player_id = CacheUser.get_userid(player_name)

{:host_update, %{host_bosses: List.delete(state.host_bosses, player_id)}}

# Not handling it, return nil
true ->
nil
Expand Down

0 comments on commit 62acf41

Please sign in to comment.