#Get User Object from UserID

1 messages · Page 1 of 1 (latest)

hexed flame
#

How do you get a user's information (the object with the name, discriminator, mention and all that) from an ID

#

await interactions.get(bot, interactions.User, object_id=USER_ID)

versed swallow
#

What is the code?

#

Any error thrown?

hexed flame
#

no

versed swallow
#

USER_ID is a constant, is that what you intended or not

hexed flame
#

there is just text highlight on interactions.get that says:
Cannot find reference 'get' in '__init__.py'

novel isleBOT
#

interactions.get()

Usage:

# Getting Channel, Guild or User
channel = await interactions.get(bot, interactions.Channel, object_id=CHANNEL_ID)
guild = await interactions.get(bot, interactions.Guild, object_id=GUILD_ID)
user = await interactions.get(bot, interactions.User, object_id=USER_ID)

# Getting Member, Role, Emoji or Message
member = await interactions.get(bot, interactions.Member, object_id=USER_ID, parent_id=GUILD_ID)
role = await interactions.get(bot, interactions.Role, object_id=ROLE_ID, parent_id=GUILD_ID)
emoji = await interactions.get(bot, interactions.Emoji, object_id=EMOJI_ID, parent_id=GUILD_ID)
message = await interactions.get(bot, interactions.Message, object_id=MESSAGE_ID, parent_id=CHANNEL_ID)

Arguments:
First argument is your interactions.Client instance
Second argument is the object you want to get
object_id is your object id
parent_id is usually guild id or channel id (for message). It is optional and needed for certain objects like Member, Role, etc.

versed swallow
#

can you pip freeze

faint vortex
#

@versed swallow interactions.get() is v4

#

oh grandpa is here, ill let him handle it

wise monolith
hexed flame
random rapids
#

Would you believe it's guild.get_role(id)?