2

I'm trying to access the owner of the guild of using ctx.guild.owner and I also tried ctx.message.guild.owner however both return None. I want the owner to be formatted with their username first then their tag, like Bob#1029. Is there a way to do this.

Thanks

Dylan
  • 55
  • 1
  • 8

2 Answers2

2

To get this you need to first enable Member Intents on your bot.

Example Below: Discord intents

and after you enable the intents you have to enable intents on your main bot file's code. Here is what you need to add.

intents = discord.Intents.default()
intents.members = True

bot = commands.Bot(command_prefix=prefix, intents=intents)

After that, your bot should have intents on. Now, if you want to get the owner's ID, you can use ctx.guild.owner_id to get the owner's ID.

I hope this solved your problem, Have a nice day, and Best of luck on your bot.

BenitzCoding
  • 299
  • 1
  • 16
0

First of all you need to enable intents through the Discord Developer Portal enter image description here

In your case you would have to enable the one I circled in red.

You can learn more in the API here.

FakeBlob
  • 60
  • 2
  • 12