hikari.users
#
Application and entities that are used to describe Users on Discord.
OwnUser
#
Bases: UserImpl
Represents a user with extended OAuth2 information.
accent_color
class-attribute
instance-attribute
#
The custom banner color for the user, if set.
The official client will decide the default color if not set.
accent_colour
property
#
Alias for the hikari.users.User.accent_color
field.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
avatar_hash
class-attribute
instance-attribute
#
The user's avatar hash, if they have one, otherwise None
.
avatar_url
property
#
Avatar URL for the user, if they have one set.
May be None
if no custom avatar is set. In this case, you
should use hikari.User.default_avatar_url
instead.
banner_hash
class-attribute
instance-attribute
#
Banner hash of the user, if they have one, otherwise None
banner_url
property
#
Banner URL for the user, if they have one set.
May be None
if no custom banner is set.
discriminator
class-attribute
instance-attribute
#
The user's discriminator.
!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames
email
class-attribute
instance-attribute
#
flags
class-attribute
instance-attribute
#
The public flags for this user.
global_name
class-attribute
instance-attribute
#
The user's global name.
id
class-attribute
instance-attribute
#
The ID of this user.
is_bot
class-attribute
instance-attribute
#
is_mfa_enabled
class-attribute
instance-attribute
#
Whether the user's account has multi-factor authentication enabled.
is_system
class-attribute
instance-attribute
#
is_verified
class-attribute
instance-attribute
#
Whether the email for this user's account has been verified.
Will be None
if retrieved through the OAuth2 flow without the email
scope.
locale
class-attribute
instance-attribute
#
The user's set locale.
This is not provided in the READY
event.
premium_type
class-attribute
instance-attribute
#
premium_type: Union[PremiumType, int, None] = field(
eq=False, hash=False, repr=False
)
The type of Nitro Subscription this user account had.
This will always be None
for bots.
username
class-attribute
instance-attribute
#
The user's username.
fetch_dm_channel
async
#
fetch_dm_channel() -> NoReturn
Fetch the DM channel for this user.
RETURNS | DESCRIPTION |
---|---|
DMChannel
|
The requested channel. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_self
async
#
fetch_self() -> OwnUser
Get this user's up-to-date object.
RETURNS | DESCRIPTION |
---|---|
OwnUser
|
The requested user object. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
make_avatar_url
#
Generate the avatar URL for this user, if set.
If no custom avatar is set, this returns None
. You can then
use the hikari.User.default_avatar_url
attribute instead to fetch
the displayed URL.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the avatar, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
make_banner_url
#
Generate the banner URL for this user, if set.
If no custom banner is set, this returns None
.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the banner, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
send
async
#
send(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
nonce: UndefinedOr[str] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> NoReturn
Send a message to this user in DM's.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL. Attachments can be passed as many different things, to aid in convenience.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
tts |
If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
TYPE:
|
reply |
If provided, the message to reply to.
TYPE:
|
reply_must_exist |
If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message. This will not do anything if not being used with
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
mentions_reply |
If provided, whether to mention the author of the message that is being replied to. This will not do anything if not being used with
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
If provided, optional flags to set on the message. If
Note that some flags may not be able to be set. Currently the only
flags that can be set are
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
BadRequestError
|
This may be raised in several discrete situations, such as messages
being empty with no attachments or embeds; messages with more than
2000 characters in them, embeds that exceed one of the many embed
limits; too many attachments; attachments that are too large;
invalid image URLs in embeds; |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
PartialUser
#
A partial interface for a user.
Fields may or may not be present, and should be explicitly checked
before using them to ensure they are not hikari.undefined.UNDEFINED
.
This is used for endpoints and events that only expose partial user information.
For full user info, consider calling the hikari.users.PartialUser.fetch_self
method to perform an
API call.
accent_color
abstractmethod
property
#
accent_color: UndefinedNoneOr[Color]
Custom banner color for the user if set, else None
.
The official client will decide the default color if not set.
accent_colour
property
#
accent_colour: UndefinedNoneOr[Color]
Alias for the hikari.users.PartialUser.accent_color
field.
avatar_hash
abstractmethod
property
#
avatar_hash: UndefinedNoneOr[str]
Avatar hash for the user, if they have one, otherwise None
.
banner_hash
abstractmethod
property
#
banner_hash: UndefinedNoneOr[str]
Banner hash for the user, if they have one, otherwise None
.
discriminator
abstractmethod
property
#
discriminator: UndefinedOr[str]
Discriminator for the user.
!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames
global_name
abstractmethod
property
#
global_name: UndefinedNoneOr[str]
Global name for the user, if they have one, otherwise None
.
is_system
abstractmethod
property
#
is_system: UndefinedOr[bool]
Whether this user is a system account.
fetch_dm_channel
async
#
fetch_dm_channel() -> DMChannel
Fetch the DM channel for this user.
RETURNS | DESCRIPTION |
---|---|
DMChannel
|
The requested channel. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_self
async
#
fetch_self() -> User
Get this user's up-to-date object by performing an API call.
RETURNS | DESCRIPTION |
---|---|
User
|
The requested user object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
send
async
#
send(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Send a message to this user in DM's.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL. Attachments can be passed as many different things, to aid in convenience.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
tts |
If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
TYPE:
|
reply |
If provided, the message to reply to.
TYPE:
|
reply_must_exist |
If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message. This will not do anything if not being used with
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
mentions_reply |
If provided, whether to mention the author of the message that is being replied to. This will not do anything if not being used with
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
If provided, optional flags to set on the message. If
Note that some flags may not be able to be set. Currently the only
flags that can be set are
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
BadRequestError
|
This may be raised in several discrete situations, such as messages
being empty with no attachments or embeds; messages with more than
2000 characters in them, embeds that exceed one of the many embed
limits; too many attachments; attachments that are too large;
invalid image URLs in embeds; |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
PartialUserImpl
#
Bases: PartialUser
Implementation for partial information about a user.
This is pretty much the same as a normal user, but information may not be
present, which will be denoted by hikari.undefined.UNDEFINED
.
accent_color
class-attribute
instance-attribute
#
accent_color: UndefinedNoneOr[Color] = field(eq=False, hash=False, repr=False)
The custom banner color for the user, if set.
The official client will decide the default color if not set.
accent_colour
property
#
accent_colour: UndefinedNoneOr[Color]
Alias for the hikari.users.PartialUser.accent_color
field.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
avatar_hash
class-attribute
instance-attribute
#
avatar_hash: UndefinedNoneOr[str] = field(eq=False, hash=False, repr=False)
Avatar hash of the user, if a custom avatar is set.
banner_hash
class-attribute
instance-attribute
#
banner_hash: UndefinedNoneOr[str] = field(eq=False, hash=False, repr=False)
Banner hash of the user, if a custom banner is set.
discriminator
class-attribute
instance-attribute
#
discriminator: UndefinedOr[str] = field(eq=False, hash=False, repr=True)
Four-digit discriminator for the user if unmigrated.
!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames
flags
class-attribute
instance-attribute
#
flags: UndefinedOr[UserFlag] = field(eq=False, hash=False, repr=True)
Public flags for this user.
global_name
class-attribute
instance-attribute
#
global_name: UndefinedNoneOr[str] = field(eq=False, hash=False, repr=True)
Global name of the user.
id
class-attribute
instance-attribute
#
The ID of this user.
is_bot
class-attribute
instance-attribute
#
is_bot: UndefinedOr[bool] = field(eq=False, hash=False, repr=True)
Whether this user is a bot account.
is_system
class-attribute
instance-attribute
#
is_system: UndefinedOr[bool] = field(eq=False, hash=False, repr=True)
Whether this user is a system account.
username
class-attribute
instance-attribute
#
username: UndefinedOr[str] = field(eq=False, hash=False, repr=True)
Username of the user.
fetch_dm_channel
async
#
fetch_dm_channel() -> DMChannel
Fetch the DM channel for this user.
RETURNS | DESCRIPTION |
---|---|
DMChannel
|
The requested channel. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_self
async
#
fetch_self() -> User
Get this user's up-to-date object by performing an API call.
RETURNS | DESCRIPTION |
---|---|
User
|
The requested user object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
send
async
#
send(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Send a message to this user in DM's.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL. Attachments can be passed as many different things, to aid in convenience.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
tts |
If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
TYPE:
|
reply |
If provided, the message to reply to.
TYPE:
|
reply_must_exist |
If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message. This will not do anything if not being used with
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
mentions_reply |
If provided, whether to mention the author of the message that is being replied to. This will not do anything if not being used with
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
If provided, optional flags to set on the message. If
Note that some flags may not be able to be set. Currently the only
flags that can be set are
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
BadRequestError
|
This may be raised in several discrete situations, such as messages
being empty with no attachments or embeds; messages with more than
2000 characters in them, embeds that exceed one of the many embed
limits; too many attachments; attachments that are too large;
invalid image URLs in embeds; |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
PremiumType
#
User
#
Bases: PartialUser
, ABC
Interface for any user-like object.
This does not include partial users, as they may not be fully formed.
accent_color
abstractmethod
property
#
The custom banner color for the user, if set else None
.
The official client will decide the default color if not set.
accent_colour
property
#
Alias for the hikari.users.User.accent_color
field.
avatar_url
property
#
Avatar URL for the user, if they have one set.
May be None
if no custom avatar is set. In this case, you
should use hikari.User.default_avatar_url
instead.
banner_url
property
#
Banner URL for the user, if they have one set.
May be None
if no custom banner is set.
discriminator
abstractmethod
property
#
discriminator: str
Discriminator for the user.
!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames
fetch_dm_channel
async
#
fetch_dm_channel() -> DMChannel
Fetch the DM channel for this user.
RETURNS | DESCRIPTION |
---|---|
DMChannel
|
The requested channel. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_self
async
#
fetch_self() -> User
Get this user's up-to-date object by performing an API call.
RETURNS | DESCRIPTION |
---|---|
User
|
The requested user object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
make_avatar_url
#
Generate the avatar URL for this user, if set.
If no custom avatar is set, this returns None
. You can then
use the hikari.User.default_avatar_url
attribute instead to fetch
the displayed URL.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the avatar, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
make_banner_url
#
Generate the banner URL for this user, if set.
If no custom banner is set, this returns None
.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the banner, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
send
async
#
send(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Send a message to this user in DM's.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL. Attachments can be passed as many different things, to aid in convenience.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
tts |
If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
TYPE:
|
reply |
If provided, the message to reply to.
TYPE:
|
reply_must_exist |
If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message. This will not do anything if not being used with
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
mentions_reply |
If provided, whether to mention the author of the message that is being replied to. This will not do anything if not being used with
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
If provided, optional flags to set on the message. If
Note that some flags may not be able to be set. Currently the only
flags that can be set are
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
BadRequestError
|
This may be raised in several discrete situations, such as messages
being empty with no attachments or embeds; messages with more than
2000 characters in them, embeds that exceed one of the many embed
limits; too many attachments; attachments that are too large;
invalid image URLs in embeds; |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
UserFlag
#
Bases: Flag
The known user flags that represent account badges.
ACTIVE_DEVELOPER
class-attribute
instance-attribute
#
User is an active bot developer.
BOT_HTTP_INTERACTIONS
class-attribute
instance-attribute
#
Bot uses only HTTP interactions and is shown in the active member list.
BUG_HUNTER_LEVEL_1
class-attribute
instance-attribute
#
Bug Hunter Level 1.
BUG_HUNTER_LEVEL_2
class-attribute
instance-attribute
#
Bug Hunter Level 2.
DISCORD_CERTIFIED_MODERATOR
class-attribute
instance-attribute
#
Discord Certified Moderator.
EARLY_VERIFIED_DEVELOPER
class-attribute
instance-attribute
#
Early verified Bot Developer.
Only applies to users that verified their account before 20th August 2019.
HYPESQUAD_BRILLIANCE
class-attribute
instance-attribute
#
House of Brilliance.
PARTNERED_SERVER_OWNER
class-attribute
instance-attribute
#
Owner of a partnered Discord server.
difference
#
Perform a set difference with the other set.
This will return all flags in this set that are not in the other value.
Equivalent to using the subtraction -
operator.
intersection
#
Return a combination of flags that are set for both given values.
Equivalent to using the "AND" &
operator.
is_disjoint
#
is_subset
#
Return whether another set contains this set or not.
Equivalent to using the "in" operator.
is_superset
#
Return whether this set contains another set or not.
none
#
none(*flags: Self) -> bool
Check if none of the given flags are part of this value.
Note
This is essentially the opposite of hikari.internal.enums.Flag.any
.
RETURNS | DESCRIPTION |
---|---|
bool
|
split
#
split() -> Sequence[Self]
Return a list of all defined atomic values for this flag.
Any unrecognised bits will be omitted for brevity.
The result will be a name-sorted typing.Sequence
of each member
symmetric_difference
#
Return a set with the symmetric differences of two flag sets.
Equivalent to using the "XOR" ^
operator.
For a ^ b
, this can be considered the same as (a - b) | (b - a)
.
UserImpl
#
Bases: PartialUserImpl
, User
Concrete implementation of user information.
accent_color
class-attribute
instance-attribute
#
The custom banner color for the user, if set.
The official client will decide the default color if not set.
accent_colour
property
#
Alias for the hikari.users.User.accent_color
field.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
avatar_hash
class-attribute
instance-attribute
#
The user's avatar hash, if they have one, otherwise None
.
avatar_url
property
#
Avatar URL for the user, if they have one set.
May be None
if no custom avatar is set. In this case, you
should use hikari.User.default_avatar_url
instead.
banner_hash
class-attribute
instance-attribute
#
Banner hash of the user, if they have one, otherwise None
banner_url
property
#
Banner URL for the user, if they have one set.
May be None
if no custom banner is set.
discriminator
class-attribute
instance-attribute
#
The user's discriminator.
!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames
flags
class-attribute
instance-attribute
#
The public flags for this user.
global_name
class-attribute
instance-attribute
#
The user's global name.
id
class-attribute
instance-attribute
#
The ID of this user.
is_bot
class-attribute
instance-attribute
#
is_system
class-attribute
instance-attribute
#
username
class-attribute
instance-attribute
#
The user's username.
fetch_dm_channel
async
#
fetch_dm_channel() -> DMChannel
Fetch the DM channel for this user.
RETURNS | DESCRIPTION |
---|---|
DMChannel
|
The requested channel. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_self
async
#
fetch_self() -> User
Get this user's up-to-date object by performing an API call.
RETURNS | DESCRIPTION |
---|---|
User
|
The requested user object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
make_avatar_url
#
Generate the avatar URL for this user, if set.
If no custom avatar is set, this returns None
. You can then
use the hikari.User.default_avatar_url
attribute instead to fetch
the displayed URL.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the avatar, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
make_banner_url
#
Generate the banner URL for this user, if set.
If no custom banner is set, this returns None
.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the banner, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
send
async
#
send(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Send a message to this user in DM's.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL. Attachments can be passed as many different things, to aid in convenience.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
tts |
If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
TYPE:
|
reply |
If provided, the message to reply to.
TYPE:
|
reply_must_exist |
If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message. This will not do anything if not being used with
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
mentions_reply |
If provided, whether to mention the author of the message that is being replied to. This will not do anything if not being used with
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
If provided, optional flags to set on the message. If
Note that some flags may not be able to be set. Currently the only
flags that can be set are
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
BadRequestError
|
This may be raised in several discrete situations, such as messages
being empty with no attachments or embeds; messages with more than
2000 characters in them, embeds that exceed one of the many embed
limits; too many attachments; attachments that are too large;
invalid image URLs in embeds; |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |