#message.guild.owner.id == None, a version problem?

1 messages · Page 1 of 1 (latest)

grim edge
#

In ON_MESSAGE
My bot has a check, that exludes other bots, system users, dmchannels, and "if not message.guild"

after that are the lines that cause problems:

 if message.guild.owner.id == message.author.id:
   return

so i did:

        print(f"message.guild.owner: {message.guild.owner}\n"
              f"message.author: {message.author}")

and got:

message.guild.owner: None

In my test-bot (using py-cord 2.3.2) 
this worked. 

with the real bot (using 2.4.1) it doesn't find the guild owner anymore. 

What's my best course of action to resolve the issue?
earnest mantle
#

High chance your code is doing something you missed

grim edge
pseudo wave
#

chances are they aren't caching members so it can't find the owner

#

but there's a separate guild.owner_id attribute that always exists

grim edge
#
    async def on_message(self, message: discord.Message):
        # Exclude bots, sys-users, DMs, owner
        if message.author.bot or message.author.system:
            return
        # DM-Check
        if isinstance(message.channel, discord.channel.DMChannel):
            await message.channel.send(bff.get_description())
            return
        if not message.guild:
            return

        print(f"message.guild.owner: {message.guild.owner}\n"
              f"message.author: {message.author}")

        # if message.guild.owner.id == message.author.id:
        #    return

        # enters or refreshes the last time someone was active
        #self.db.make_or_update_entry(message.guild.id, message.author.id, int(datetime.now().timestamp()))
grim edge
#

can you tell me how to fix it? it did work with the old version and i tried fixing but.. well.. I need some help :/

pseudo wave
#

do you have the members intent?

#

or yeah you can just use guild.owner_id instead, you just won't have any of their other info

grim edge
#

I have the guild members intent and am verified.

grim edge
#

lemme post sth

pseudo wave
#

yeah

grim edge
# pseudo wave yeah

did i make a mistake here?:

        intents = discord.Intents.default() | discord.Intents.members
pseudo wave
#

the heck

earnest mantle
pseudo wave
#

you want py intents = discord.Intents.default() intents.members = True

grim edge
#

I try runing it now, if that doesnt fix it I'll try guild.owner_id.

BTW; @pseudo wave , @earnest mantle , you guys definately earned your virtual cape today! Thank you so much for taking time to respond!

I'll report back in a couple of minutes

#

The intents change didn't fix it. trying the guiold.owner_id method now

grim edge
#

owner_id worked like a charm, no errors since this was adjusted.

However I'd like to learn where i went wrong.
I have those intents in the dashboard:

#

That's currently in the bots code for intents:

#

(not true, there is a typo, "intents" in the scond line is not capitalized)

upper ember