#‘NoneType‘ object has no Attribute ‘guild‘

1 messages · Page 1 of 1 (latest)

rapid pike
#

You're using a slash command, not a text command.

Text commands have the .message attribute in ctx.
Slash commands don't, because there wasn't a message for the slash command when you invoke it. You must use ctx.guild.id instead of ctx.message.guild.id.

#

You need to learn how to read the errors, it's pretty simple

#

It tells you which line has the error

#

why are you doing channel.strip()

#

channel is a TextChannel object, not a string

#

Think

#

What are you trying to obtain in that line

#

No like I'm asking a question

#

What do you want to get in that line

#

how are you not sure about code that you write

#

Now I'm completely not sure what your intentions are because you can't really answer what your code does PES2_Shrug but I presume you're trying to get the ID of the channel.

#

There's already an attribute for that, channel.id

#

xqbwhat that should be up to you?

rapid pike
#

If you know Python you will know what to do xqbwhat

#

You have absolutely no idea what you’re doing?

#

I can see that you’re trying to add a key (your guild ID) and a value for that (the channel ID) to the global chat data dictionary. In that case it should be replaced with the method I mentioned above on how you can get the ID of the channel.

#

Did you read this?