Skip to content

Commit

Permalink
[Fix] Fix Caseutils Break on Welcome
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed May 26, 2024
1 parent 99fd31d commit 347969a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions halpybot/commands/caseutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
sys_cleaner,
gather_case,
)
from ..packages.command import Commands
from ..packages.command import Commands, get_help_text
from ..packages.edsm import (
checklandmarks,
)
Expand Down Expand Up @@ -130,6 +130,8 @@ async def welcome_utils(ctx: Context, args: List[str]):
if args[0].casefold() in test_case.irc_nick.casefold():
case = test_case
break
except IndexError:
return await ctx.reply(get_help_text(ctx.bot.commandsfile, ctx.command))
if not case:
return None
spatches = case.dispatchers
Expand All @@ -149,7 +151,6 @@ async def welcome_utils(ctx: Context, args: List[str]):

@Commands.command("welcome")
@needs_permission(Pup)
@gather_case(1)
async def cmd_welcome(ctx: Context, args: List[str]):
"""
Welcome the Client and add an identified Seal as a Dispatch responder.
Expand All @@ -158,6 +159,8 @@ async def cmd_welcome(ctx: Context, args: List[str]):
Aliases: n/a
"""
case = await welcome_utils(ctx, args)
if not args:
return
if not case:
await ctx.reply(
await ctx.bot.facts.fact_formatted(fact=("welcome", "en"), arguments=args)
Expand All @@ -171,7 +174,6 @@ async def cmd_welcome(ctx: Context, args: List[str]):

@Commands.command("silentwelcome", "swelcome", "wmute", "mute", "silencewelcome")
@needs_permission(Pup)
@gather_case(1)
async def cmd_swelcome(ctx: Context, args: List[str]):
"""
Suppress the welcome warning and add an identified Seal as a Dispatch responder.
Expand All @@ -180,6 +182,8 @@ async def cmd_swelcome(ctx: Context, args: List[str]):
Aliases: n/a
"""
case = await welcome_utils(ctx, args)
if not args:
return
if not case:
return await ctx.reply(f"Attn {ctx.sender}: Case for {args[0]} not found!")

Expand Down

0 comments on commit 347969a

Please sign in to comment.