[Modlog] Fix get_case for missing cases (#2858)

Due to the modlog redesign, the detection for a missing case changed. This fixes `get_case` for this.

This resolves #2844.
This commit is contained in:
Michael H 2019-07-13 20:47:16 -04:00 committed by Toby Harradine
parent 03e0683dd7
commit 21a6384ebf

View File

@ -514,10 +514,10 @@ async def get_case(case_number: int, guild: discord.Guild, bot: Red) -> Case:
If there is no case for the specified number
"""
try:
case = await _conf.custom(_CASES, str(guild.id), str(case_number)).all()
except KeyError as e:
raise RuntimeError("That case does not exist for guild {}".format(guild.name)) from e
case = await _conf.custom(_CASES, str(guild.id), str(case_number)).all()
if not case["case_number"]:
raise RuntimeError("That case does not exist for guild {}".format(guild.name))
mod_channel = await get_modlog_channel(guild)
return await Case.from_json(mod_channel, bot, case_number, case)