# Buggy code
def __init__(
    self,
    bot: Red,
    guild: discord.Guild,
    created_at: int,
    action_type: str,
    user: Union[discord.User, int],
    moderator: discord.User,
    case_number: int,
    reason: str = None,
    until: int = None,
    channel: Optional[Union[discord.TextChannel, discord.VoiceChannel, int]] = None,
    amended_by: Optional[discord.User] = None,
    modified_at: Optional[int] = None,
    message: Optional[discord.Message] = None,
    last_known_username: Optional[str] = None,
):
    self.bot = bot
    self.guild = guild
    self.created_at = created_at
    self.action_type = action_type
    self.user = user
    self.last_known_username = last_known_username
    self.moderator = moderator
    self.reason = reason
    self.until = until
    self.channel = channel
    self.amended_by = amended_by
    self.modified_at = modified_at
    self.case_number = case_number
    self.message = message


# Traceback (AttributeError)
Traceback (most recent call last):
File "/red-v32/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/red-v32/lib/python3.8/site-packages/redbot/cogs/modlog/modlog.py", line 142, in casesfor
rendered_cases = [await case.message_content(embed=embed_requested) for case in cases]
File "/red-v32/lib/python3.8/site-packages/redbot/cogs/modlog/modlog.py", line 142, in <listcomp>
rendered_cases = [await case.message_content(embed=embed_requested) for case in cases]
File "/red-v32/lib/python3.8/site-packages/redbot/core/modlog.py", line 296, in message_content
moderator = escape_spoilers(f"{self.moderator} ({self.moderator.id})")
AttributeError: 'int' object has no attribute 'id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/red-v32/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 892, in invoke
await ctx.command.invoke(ctx)
File "/red-v32/lib/python3.8/site-packages/discord/ext/commands/core.py", line 824, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/red-v32/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'id'

# Fixed code
def __init__(
    self,
    bot: Red,
    guild: discord.Guild,
    created_at: int,
    action_type: str,
    user: Union[discord.User, int],
    moderator: Optional[Union[discord.User, int]],
    case_number: int,
    reason: str = None,
    until: int = None,
    channel: Optional[Union[discord.TextChannel, discord.VoiceChannel, int]] = None,
    amended_by: Optional[Union[discord.User, int]] = None,
    modified_at: Optional[int] = None,
    message: Optional[discord.Message] = None,
    last_known_username: Optional[str] = None,
):
    self.bot = bot
    self.guild = guild
    self.created_at = created_at
    self.action_type = action_type
    self.user = user
    self.last_known_username = last_known_username
    self.moderator = moderator
    self.reason = reason
    self.until = until
    self.channel = channel
    self.amended_by = amended_by
    self.modified_at = modified_at
    self.case_number = case_number
    self.message = message