#Docs say that message.guild returns an object, but in usage, it returns the name of the server?

1 messages · Page 1 of 1 (latest)

brazen lark
#

Hi! I'm learning PyCord, and I have this code:

@bot.event
async def on_message(message: discord.Message):
  print(message.guild)
  guildConfig = jsonHelper.getGuildConfig(str(message.guild.id))

But it keeps erroring out because message.guild.id doesn't exist. There's no "id". But the docs says that there is.

Am I doing something wrong? message.guild exists, but it only returns a string of the server name. There's no object.

neon osprey
#

it's definitely a guild object

#

print is just calling __str__ which prints out the name of the guild

#

or __repr__

neon osprey
#

.close

wooden shuttleBOT
#

Done with your help thread?

Please close your own help thread by using </close:1009144375709814897> with @lost falcon.

Backup bot: </solved:1109625445990793246> (or .solved) with @wooden shuttle.