fix case generation for cases which were not logged to modlog channel (#2477)

Add documentation for failure cases
Prevent an expected failure case.
This commit is contained in:
DiscordLiz 2019-02-21 21:33:45 -05:00 committed by Kowlin
parent 9966668307
commit 619c3f28f7

View File

@ -237,9 +237,21 @@ class Case:
Case Case
The case object for the requested case The case object for the requested case
Raises
------
`discord.NotFound`
The user the case is for no longer exists
`discord.Forbidden`
Cannot read message history to fetch the original message.
`discord.HTTPException`
A generic API issue
""" """
guild = mod_channel.guild guild = mod_channel.guild
if data["message"]:
try:
message = await mod_channel.get_message(data["message"]) message = await mod_channel.get_message(data["message"])
except discord.NotFound:
message = None
user = await bot.get_user_info(data["user"]) user = await bot.get_user_info(data["user"])
moderator = guild.get_member(data["moderator"]) moderator = guild.get_member(data["moderator"])
channel = guild.get_channel(data["channel"]) channel = guild.get_channel(data["channel"])