AttributeError: 'NoneType' Object Has No Attribute 'channels'
Hi I'm having an issue with a module for my Discord bot. I'm getting AttributeError: 'NoneType' object has no attribute 'channels' I'm not sure way it's throwing out this error: He
Solution 1:
You are trying to access the channels
property of some object, but that object is None
== Null in other languages.
From your code the only place you reference channels is message.guild.channels
, in the channel = get(message.guild.channels, name="gtky")
line, so the guild
property of the message object is None
Solution 2:
This is happening because message.guild
is None
. guild
is None
because private messages, direct messages between two users, do not go through a guild.
If your bot sends or receives any private messages, those messages will have None
as their message.guild
attributes.
Post a Comment for "AttributeError: 'NoneType' Object Has No Attribute 'channels'"