Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit 0efce57

Browse files
authored
Merge pull request #215 from theunkn0wn1/fix/SPARK-242
[SPARK-242] Fix errors when injecting with no additional data.
2 parents 162ec66 + 89e22d6 commit 0efce57

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/commands/case_management.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ async def cmd_case_management_inject(ctx: Context):
370370
logger.debug("creating rescue for {!r}", tokens.subject[0])
371371
rescue = await ctx.bot.board.create_rescue(client=tokens.subject[0])
372372
async with ctx.bot.board.modify_rescue(rescue, impersonation=ctx.user.account) as case:
373-
case.add_quote(ctx.words_eol[2], ctx.user.nickname)
373+
case.add_quote(ctx.words_eol[0], ctx.user.nickname)
374374

375375
# check specific capture groups for existence.
376376
if tokens.xbox:
@@ -385,7 +385,7 @@ async def cmd_case_management_inject(ctx: Context):
385385
case.code_red = True
386386

387387
await ctx.reply(
388-
f"{case.client}'s case opened with: " f"{ctx.words_eol[2]} (Case {case.board_index})"
388+
f"{case.client}'s case opened with: " f"{ctx.words_eol[0]} (Case {case.board_index})"
389389
)
390390

391391
if case.code_red:
@@ -394,7 +394,7 @@ async def cmd_case_management_inject(ctx: Context):
394394
return
395395

396396
async with ctx.bot.board.modify_rescue(rescue, impersonation=ctx.user.account) as case:
397-
case.add_quote(ctx.words_eol[2], ctx.user.nickname)
397+
case.add_quote(ctx.words_eol[0], ctx.user.nickname)
398398

399399
await ctx.reply(
400400
f"{case.client}'s case updated with: " f"'{ctx.words_eol[2]}' (Case {case.board_index})"

tests/regressions/test_case_management_regressions.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,18 @@ async def test_spark_239(bot_fx, rescue_sop_fx, monkeypatch):
5050
await trigger(context)
5151

5252
assert rescue_sop_fx.client not in bot_fx.board
53+
54+
55+
async def test_spark_242(bot_fx):
56+
"""
57+
Verifies that `!inject {name}` returns an usage error instead of dying horribly.
58+
"""
59+
60+
pre_len = len(bot_fx.board)
61+
62+
ctx = await Context.from_message(bot_fx, "#fuelrats", "Some_ov", "!inject sinkhole")
63+
64+
await trigger(ctx=ctx)
65+
66+
assert "sinkhole" in bot_fx.board
67+
assert len(bot_fx.board) == pre_len + 1

0 commit comments

Comments
 (0)