User Resource¶
Note
The following classes come from the discord.resources.user
module.
User
dataclass
¶
Bases: DataModel
A Discord user.
id: int
instance-attribute
¶
ID of the user.
username: str = None
class-attribute
instance-attribute
¶
Username of the user.
discriminator: str = None
class-attribute
instance-attribute
¶
Discriminator of the user (#XXXX)
global_name: str = None
class-attribute
instance-attribute
¶
Global name of the user.
avatar: str = None
class-attribute
instance-attribute
¶
Image hash of the user's avatar.
bot: Optional[bool] = None
class-attribute
instance-attribute
¶
If the user is a bot.
system: Optional[bool] = None
class-attribute
instance-attribute
¶
If the user belongs to an OAuth2 application.
mfa_enabled: Optional[bool] = None
class-attribute
instance-attribute
¶
Whether the user has two factor enabled.
banner: Optional[str] = None
class-attribute
instance-attribute
¶
Image hash of the user's banner.
accent_color: Optional[int] = None
class-attribute
instance-attribute
¶
Color of user's banner represented as an integer.
locale: Optional[str] = None
class-attribute
instance-attribute
¶
Chosen language option of the user.
fetch
async
¶
Fetch this user by ID.
Note
Fetch includes both /users/@me AND /users/{user.id}!
Returns:
-
User
–the User object
fetch_guilds
async
¶
Fetch this user's guilds.
Important
Requires the OAuth2 guilds scope!
Parameters:
-
kwargs
(Unpack[FetchUserGuildsParams]
, default:{}
) –Field-specific data
Note
If no kwargs are provided, default to 200 guilds limit.
Returns:
-
list[GuildModel]
–each guild's data
fetch_guild_member
async
¶
Fetch this user's guild member data.
Important
Requires the OAuth2 guilds.members.read scope!
Parameters:
-
guild_id
(int
) –id of guild to fetch data from
Returns:
-
MemberModel
–member data from guild
FetchUserGuildsParams
¶
Bases: TypedDict
before: int
instance-attribute
¶
Get guilds before this guild ID.
after: int
instance-attribute
¶
Get guilds after this guild ID.
limit: int
instance-attribute
¶
Max number of guilds to return. Range 1 - 200. Default 200.
with_counts: bool
instance-attribute
¶
Include approximate member and presence count.