Skip to content

AttributeError: 'NoneType' object has no attribute 'fetch_message' #2010

@sentry

Description

@sentry

Sentry Issue: BOT-9M

AttributeError: 'NoneType' object has no attribute 'fetch_message'
  File "discord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "bot/exts/moderation/modlog.py", line 732, in on_raw_message_edit
    message = await channel.fetch_message(event.message_id)

Unhandled exception in on_raw_message_edit.

This is caused by the on_raw_message_edit triggering before the guild cache is ready.

A fix for this would be to add a await self.bot.wait_until_guild_available() to all events that rely on channel cache to be ready.

Metadata

Metadata

Assignees

Labels

a: moderationRelated to community moderation functionality: (moderation, defcon, verification)good first issueGood for newcomersp: 2 - normalNormal Prioritystatus: approvedThe issue has received a core developer's approvalt: bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions