hikari.applications
#
Application and entities related to discord's OAuth2 flow.
Application
#
Bases: PartialApplication
Represents the information of an Oauth2 Application.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
approximate_guild_count
class-attribute
instance-attribute
#
The approximate number of guilds this application is part of.
cover_image_hash
class-attribute
instance-attribute
#
The CDN's hash of this application's default rich presence invite cover image.
cover_image_url
property
#
Rich presence cover image URL for this application, if set.
custom_install_url
class-attribute
instance-attribute
#
The URL of this application's custom authorization link.
description
class-attribute
instance-attribute
#
The description of this application, if any.
flags
class-attribute
instance-attribute
#
flags: ApplicationFlags = field(eq=False, hash=False, repr=False)
The flags for this application.
icon_hash
class-attribute
instance-attribute
#
The CDN hash of this application's icon, if set.
id
class-attribute
instance-attribute
#
The ID of this entity.
install_parameters
class-attribute
instance-attribute
#
install_parameters: Optional[ApplicationInstallParameters] = field(
eq=False, hash=False, repr=False
)
Settings for the application's default in-app authorization link, if enabled.
is_bot_code_grant_required
class-attribute
instance-attribute
#
True
if this application's bot is requiring code grant for invites.
is_bot_public
class-attribute
instance-attribute
#
True
if the bot associated with this application is public.
name
class-attribute
instance-attribute
#
The name of this application.
owner
class-attribute
instance-attribute
#
The application's owner.
privacy_policy_url
class-attribute
instance-attribute
#
The URL of this application's privacy policy.
public_key
class-attribute
instance-attribute
#
The key used for verifying interaction and GameSDK payload signatures.
role_connections_verification_url
class-attribute
instance-attribute
#
The URL of this application's role connection verification entry point.
rpc_origins
class-attribute
instance-attribute
#
A collection of this application's RPC origin URLs, if RPC is enabled.
tags
class-attribute
instance-attribute
#
A sequence of tags describing the content and functionality of the application.
team
class-attribute
instance-attribute
#
The team this application belongs to.
If the application is not part of a team, this will be None
.
terms_of_service_url
class-attribute
instance-attribute
#
The URL of this application's terms of service.
make_cover_image_url
#
Generate the rich presence cover image URL for this application, if set.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
make_icon_url
#
Generate the icon URL for this application.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
ApplicationFlags
#
Bases: Flag
The known application flag bits.
APPLICATION_COMMAND_BADGE
class-attribute
instance-attribute
#
Denotes that the application has at least one global application command.
EMBEDDED
class-attribute
instance-attribute
#
Denotes that the application has functionality that's specially embedded in Discord's client.
GUILD_MEMBERS_INTENT
class-attribute
instance-attribute
#
Denotes that the application has the GUILD_MEMBERS intent enabled in it's dashboard.
GUILD_PRESENCES_INTENT
class-attribute
instance-attribute
#
Denotes that the application has the GUILD_PRESENCES intent enabled in it's dashboard.
MESSAGE_CONTENT_INTENT
class-attribute
instance-attribute
#
Denotes that the application has message content intent enabled in it's dashboard.
MESSAGE_CONTENT_INTENT_LIMITED
class-attribute
instance-attribute
#
Denotes that the application has message content access while pending verification.
VERIFICATION_PENDING_GUILD_LIMIT
class-attribute
instance-attribute
#
Denotes that the application's verification is pending.
VERIFIED_FOR_GUILD_MEMBERS_INTENT
class-attribute
instance-attribute
#
Denotes that a verified application can use the GUILD_MEMBERS intent.
VERIFIED_FOR_GUILD_PRESENCES
class-attribute
instance-attribute
#
Denotes that a verified application can use the GUILD_PRESENCES intent.
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)
.
ApplicationInstallParameters
#
Represents the application install parameters.
permissions
class-attribute
instance-attribute
#
permissions: Permissions = field(eq=True, repr=False, hash=True)
The permissions to add the bot to guild with.
ApplicationRoleConnectionMetadataRecord
#
Represents a role connection metadata record.
description
class-attribute
instance-attribute
#
The metadata's field description.
description_localizations
class-attribute
instance-attribute
#
description_localizations: Mapping[Union[Locale, str], str] = field(
eq=False, hash=False, repr=False, factory=dict
)
A mapping of description localizations for this metadata field.
key
class-attribute
instance-attribute
#
Dictionary key for the metadata field.
name
class-attribute
instance-attribute
#
The metadata's field name.
name_localizations
class-attribute
instance-attribute
#
name_localizations: Mapping[Union[Locale, str], str] = field(
eq=False, hash=False, repr=False, factory=dict
)
A mapping of name localizations for this metadata field.
type
class-attribute
instance-attribute
#
type: Union[ApplicationRoleConnectionMetadataRecordType, int] = field(
eq=False, hash=False, repr=False
)
The type of metadata value record.
ApplicationRoleConnectionMetadataRecordType
#
Bases: int
, Enum
Represents possible application role connection metadata record types.
DATETIME_GREATER_THAN_OR_EQUAL
class-attribute
instance-attribute
#
Datetime Greater Than Or Equal.
DATETIME_LESS_THAN_OR_EQUAL
class-attribute
instance-attribute
#
Datetime Less Than Or Equal.
INTEGER_GREATER_THAN_OR_EQUAL
class-attribute
instance-attribute
#
Integer Greater Than Or Equal.
INTEGER_LESS_THAN_OR_EQUAL
class-attribute
instance-attribute
#
Integer Less Than Or Equal.
AuthorizationApplication
#
Bases: PartialApplication
The application model found attached to hikari.applications.AuthorizationInformation
.
description
class-attribute
instance-attribute
#
The description of this application, if any.
icon_hash
class-attribute
instance-attribute
#
The CDN hash of this application's icon, if set.
id
class-attribute
instance-attribute
#
The ID of this entity.
is_bot_code_grant_required
class-attribute
instance-attribute
#
is_bot_public
class-attribute
instance-attribute
#
name
class-attribute
instance-attribute
#
The name of this application.
privacy_policy_url
class-attribute
instance-attribute
#
The URL of this application's privacy policy.
public_key
class-attribute
instance-attribute
#
The key used for verifying interaction and GameSDK payload signatures.
terms_of_service_url
class-attribute
instance-attribute
#
The URL of this application's terms of service.
make_icon_url
#
Generate the icon URL for this application.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
AuthorizationInformation
#
Model for the data returned by Get Current Authorization Information.
application
class-attribute
instance-attribute
#
application: AuthorizationApplication = field(hash=False, repr=True)
The current application.
expires_at
class-attribute
instance-attribute
#
When the access token this data was retrieved with expires.
scopes
class-attribute
instance-attribute
#
scopes: Sequence[Union[OAuth2Scope, str]] = field(hash=False, repr=True)
A sequence of the scopes the current user has authorized the application for.
user
class-attribute
instance-attribute
#
The user who has authorized this token.
This will only be included if the token is authorized for the
hikari.applications.OAuth2Scope.IDENTIFY
scope.
ConnectionVisibility
#
InviteApplication
#
Bases: PartialApplication
Represents the information of an Invite Application.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
cover_image_hash
class-attribute
instance-attribute
#
The CDN's hash of this application's default rich presence invite cover image.
cover_image_url
property
#
Rich presence cover image URL for this application, if set.
description
class-attribute
instance-attribute
#
The description of this application, if any.
icon_hash
class-attribute
instance-attribute
#
The CDN hash of this application's icon, if set.
id
class-attribute
instance-attribute
#
The ID of this entity.
name
class-attribute
instance-attribute
#
The name of this application.
public_key
class-attribute
instance-attribute
#
The key used for verifying interaction and GameSDK payload signatures.
make_cover_image_url
#
Generate the rich presence cover image URL for this application, if set.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
make_icon_url
#
Generate the icon URL for this application.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
OAuth2AuthorizationToken
#
Bases: PartialOAuth2Token
Model for the OAuth2 token data returned by the authorization grant flow.
access_token
class-attribute
instance-attribute
#
Access token issued by the authorization server.
expires_in
class-attribute
instance-attribute
#
Lifetime of this access token.
guild
class-attribute
instance-attribute
#
Object of the guild the user was added to.
This will only be present if this token was authorized with the
hikari.applications.OAuth2Scope.BOT
scope, otherwise this will be None
.
refresh_token
class-attribute
instance-attribute
#
Refresh token used to obtain new access tokens with the same grant.
scopes
class-attribute
instance-attribute
#
scopes: Sequence[Union[OAuth2Scope, str]] = field(
eq=False, hash=False, repr=True
)
Scopes the access token has access to.
token_type
class-attribute
instance-attribute
#
Type of token issued by the authorization server.
webhook
class-attribute
instance-attribute
#
webhook: Optional[IncomingWebhook] = field(eq=False, hash=False, repr=True)
Object of the webhook that was created.
This will only be present if this token was authorized with the
hikari.applications.OAuth2Scope.WEBHOOK_INCOMING
scope, otherwise this will be None
.
OAuth2ImplicitToken
#
Bases: PartialOAuth2Token
Model for the OAuth2 token data returned by the implicit grant flow.
access_token
class-attribute
instance-attribute
#
Access token issued by the authorization server.
expires_in
class-attribute
instance-attribute
#
Lifetime of this access token.
scopes
class-attribute
instance-attribute
#
scopes: Sequence[Union[OAuth2Scope, str]] = field(
eq=False, hash=False, repr=True
)
Scopes the access token has access to.
state
class-attribute
instance-attribute
#
State parameter that was present in the authorization request if provided.
OAuth2Scope
#
Bases: str
, Enum
OAuth2 Scopes that Discord allows.
These are categories of permissions for applications using the OAuth2 API
directly. Most users will only ever need the hikari.applications.OAuth2Scope.BOT
scope when developing
bots.
ACTIVITIES_READ
class-attribute
instance-attribute
#
Enables fetching the "Now Playing/Recently Played" list.
Note
You must be whitelisted to use this scope.
ACTIVITIES_WRITE
class-attribute
instance-attribute
#
Enables updating a user's activity.
Note
You must be whitelisted to use this scope.
Note
This is not required to use the GameSDK activity manager.
APPLICATIONS_BUILDS_READ
class-attribute
instance-attribute
#
Enables reading build data for a user's applications.
Note
You must be whitelisted to use this scope.
APPLICATIONS_BUILDS_UPLOAD
class-attribute
instance-attribute
#
Enables uploading/updating builds for a user's applications.
Note
You must be whitelisted to use this scope.
APPLICATIONS_COMMANDS
class-attribute
instance-attribute
#
Allows your application's commands to be used in a guild.
This is used in Discord's special Bot Authorization Flow like
hikari.applications.OAuth2Scope.BOT
in-order to join an application into a guild as an
application command providing integration.
APPLICATIONS_COMMANDS_PERMISSION_UPDATE
class-attribute
instance-attribute
#
Allows your application to update its commands permissions via a bearer token.
APPLICATIONS_COMMANDS_UPDATE
class-attribute
instance-attribute
#
Allows your application to update its commands via a bearer token.
APPLICATIONS_ENTITLEMENTS
class-attribute
instance-attribute
#
Enables reading entitlements for a user's applications.
APPLICATIONS_STORE_UPDATE
class-attribute
instance-attribute
#
Enables reading/updating store data for the user's applications.
This includes store listings, achievements, SKU's, etc.
Note
The store API is deprecated and may be removed in the future.
BOT
class-attribute
instance-attribute
#
Enables adding a bot application to a guild.
Note
This requires you to have set up a bot account for your application.
CONNECTIONS
class-attribute
instance-attribute
#
Enables viewing third-party linked accounts such as Twitch.
EMAIL
class-attribute
instance-attribute
#
Enable the application to view the user's email and application info.
GROUP_DM_JOIN
class-attribute
instance-attribute
#
Enables joining users into a group DM.
Warning
This cannot add the bot to a group DM.
GUILDS
class-attribute
instance-attribute
#
Enables viewing the guilds the user is in.
GUILDS_JOIN
class-attribute
instance-attribute
#
Enables adding the user to a specific guild.
Note
This requires you to have set up a bot account for your application.
GUILDS_MEMBERS_READ
class-attribute
instance-attribute
#
Used to read the current user's guild members.
IDENTIFY
class-attribute
instance-attribute
#
Enables viewing info about itself.
Note
This does not include email address info. Use the hikari.applications.OAuth2Scope.EMAIL
scope instead
to retrieve this information.
RELATIONSHIPS_READ
class-attribute
instance-attribute
#
Enables viewing a user's friend list.
Note
You must be whitelisted to use this scope.
ROLE_CONNECTIONS_WRITE
class-attribute
instance-attribute
#
Used to write to the current user's connection and metadata for the app.
RPC
class-attribute
instance-attribute
#
Enables the RPC application to control the local user's Discord client.
Note
You must be whitelisted to use this scope.
RPC_MESSAGES_READ
class-attribute
instance-attribute
#
Enables the RPC application to read messages from all channels the user is in.
RPC_NOTIFICATIONS_READ
class-attribute
instance-attribute
#
Enables the RPC application to read from all channels the user is in.
Note
You must be whitelisted to use this scope.
WEBHOOK_INCOMING
class-attribute
instance-attribute
#
Used to generate a webhook that is returned in the OAuth2 token response.
This is used during authorization code grants.
OwnApplicationRoleConnection
#
Represents an own application role connection.
metadata
class-attribute
instance-attribute
#
Mapping application role connection metadata keys to their value.
Note
Unfortunately, these can't be deserialized to their proper types as Discord don't provide a way to difference between them.
You can deserialize them yourself based on what value you expect from the key:
- INTEGER_X
: Cast to an int
.
- DATETIME_X
: Cast to datetime.datetime.fromisoformat
or ciso8601.parse_rfc3339
(for speed).
- BOOLEAN_X
: Cast to a bool
.
platform_name
class-attribute
instance-attribute
#
The name of the platform.
OwnConnection
#
Represents a user's connection with a third party account.
Returned by the [GET Current User Connections][] endpoint.
id
class-attribute
instance-attribute
#
The string ID of the third party connected account.
Warning
Seeing as this is a third party ID, it will not be a snowflakes.
integrations
class-attribute
instance-attribute
#
integrations: Sequence[PartialIntegration] = field(
eq=False, hash=False, repr=False
)
A sequence of the partial guild integration objects this connection has.
is_activity_visible
class-attribute
instance-attribute
#
True
if this connection's activities are shown in the user's presence.
is_friend_sync_enabled
class-attribute
instance-attribute
#
True
if friends should be added based on this connection.
name
class-attribute
instance-attribute
#
The username of the connected account.
type
class-attribute
instance-attribute
#
The type of service this connection is for.
visibility
class-attribute
instance-attribute
#
visibility: Union[ConnectionVisibility, int] = field(
eq=False, hash=False, repr=True
)
The visibility of the connection.
OwnGuild
#
Bases: PartialGuild
Represents a user bound partial guild object.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
approximate_active_member_count
class-attribute
instance-attribute
#
The approximate amount of presences in this guild.
approximate_member_count
class-attribute
instance-attribute
#
The approximate amount of members in this guild.
features
class-attribute
instance-attribute
#
features: Sequence[Union[str, GuildFeature]] = field(
eq=False, hash=False, repr=False
)
A list of the features in this guild.
icon_hash
class-attribute
instance-attribute
#
The hash for the guild icon, if there is one.
id
class-attribute
instance-attribute
#
The ID of this entity.
my_permissions
class-attribute
instance-attribute
#
my_permissions: Permissions = field(eq=False, hash=False, repr=False)
The guild-level permissions that apply to the current user or bot.
name
class-attribute
instance-attribute
#
The name of the guild.
shard_id
property
#
Return the ID of the shard this guild is served by.
This may return None
if the application does not have a gateway
connection.
ban
async
#
ban(
user: SnowflakeishOr[PartialUser],
*,
delete_message_seconds: UndefinedOr[Intervalish] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None
Ban the given user from this guild.
PARAMETER | DESCRIPTION |
---|---|
user |
The user to ban from the guild.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
delete_message_seconds |
If provided, the number of seconds to delete messages for.
This can be represented as either an int/float between 0 and 604800 (7 days), or
a
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild or user are 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. |
create_category
async
#
create_category(
name: str,
*,
position: UndefinedOr[int] = undefined.UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildCategory
Create a category in the guild.
PARAMETER | DESCRIPTION |
---|---|
name |
The channels name. Must be between 2 and 1000 characters.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
position |
If provided, the position of the category.
TYPE:
|
permission_overwrites |
If provided, the permission overwrites for the category.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildCategory
|
The created category. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild 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. |
create_forum_channel
async
#
create_forum_channel(
name: str,
*,
position: UndefinedOr[int] = undefined.UNDEFINED,
category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = undefined.UNDEFINED,
topic: UndefinedOr[str] = undefined.UNDEFINED,
nsfw: UndefinedOr[bool] = undefined.UNDEFINED,
rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
default_auto_archive_duration: UndefinedOr[
Intervalish
] = undefined.UNDEFINED,
default_thread_rate_limit_per_user: UndefinedOr[
Intervalish
] = undefined.UNDEFINED,
default_forum_layout: UndefinedOr[
Union[ForumLayoutType, int]
] = undefined.UNDEFINED,
default_sort_order: UndefinedOr[
Union[ForumSortOrderType, int]
] = undefined.UNDEFINED,
available_tags: UndefinedOr[Sequence[ForumTag]] = undefined.UNDEFINED,
default_reaction_emoji: Union[
str, Emoji, UndefinedType, Snowflake
] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildForumChannel
Create a forum channel in the guild.
PARAMETER | DESCRIPTION |
---|---|
name |
The channels name. Must be between 2 and 1000 characters.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
position |
If provided, the position of the category.
TYPE:
|
category |
The category to create the channel under. This may be the object or the ID of an existing category.
TYPE:
|
permission_overwrites |
If provided, the permission overwrites for the category.
TYPE:
|
topic |
If provided, the channels topic. Maximum 1024 characters.
TYPE:
|
nsfw |
If provided, whether to mark the channel as NSFW.
TYPE:
|
rate_limit_per_user |
If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
TYPE:
|
default_auto_archive_duration |
If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel. This should be either 60, 1440, 4320 or 10080 minutes and, as of
writing, ignores the parent channel's set default_auto_archive_duration
when passed as
TYPE:
|
default_thread_rate_limit_per_user |
If provided, the ratelimit that should be set in threads created from the forum.
TYPE:
|
default_forum_layout |
If provided, the default forum layout to show in the client.
TYPE:
|
default_sort_order |
If provided, the default sort order to show in the client.
TYPE:
|
available_tags |
If provided, the available tags to select from when creating a thread.
TYPE:
|
default_reaction_emoji |
If provided, the new default reaction emoji for threads created in a forum channel.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildForumChannel
|
The created forum channel. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild 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. |
create_news_channel
async
#
create_news_channel(
name: str,
*,
position: UndefinedOr[int] = undefined.UNDEFINED,
topic: UndefinedOr[str] = undefined.UNDEFINED,
nsfw: UndefinedOr[bool] = undefined.UNDEFINED,
rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = undefined.UNDEFINED,
category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildNewsChannel
Create a news channel in the guild.
PARAMETER | DESCRIPTION |
---|---|
name |
The channels name. Must be between 2 and 1000 characters.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
position |
If provided, the position of the channel (relative to the category, if any).
TYPE:
|
topic |
If provided, the channels topic. Maximum 1024 characters.
TYPE:
|
nsfw |
If provided, whether to mark the channel as NSFW.
TYPE:
|
rate_limit_per_user |
If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
TYPE:
|
permission_overwrites |
If provided, the permission overwrites for the channel.
TYPE:
|
category |
The category to create the channel under. This may be the object or the ID of an existing category.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildNewsChannel
|
The created channel. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild 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. |
create_stage_channel
async
#
create_stage_channel(
name: str,
*,
position: UndefinedOr[int] = undefined.UNDEFINED,
user_limit: UndefinedOr[int] = undefined.UNDEFINED,
bitrate: UndefinedOr[int] = undefined.UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = undefined.UNDEFINED,
region: UndefinedOr[Union[VoiceRegion, str]] = undefined.UNDEFINED,
category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildStageChannel
Create a stage channel in the guild.
PARAMETER | DESCRIPTION |
---|---|
name |
The channel's name. Must be between 2 and 1000 characters.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
position |
If provided, the position of the channel (relative to the category, if any).
TYPE:
|
user_limit |
If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.
TYPE:
|
bitrate |
If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.
TYPE:
|
permission_overwrites |
If provided, the permission overwrites for the channel.
TYPE:
|
region |
If provided, the voice region to for this channel. Passing
TYPE:
|
category |
The category to create the channel under. This may be the object or the ID of an existing category.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildStageChannel
|
The created channel. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild 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. |
create_sticker
async
#
create_sticker(
name: str,
tag: str,
image: Resourceish,
*,
description: UndefinedOr[str] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildSticker
Create a sticker in a guild.
Note
Lottie support is only available for verified and partnered servers.
PARAMETER | DESCRIPTION |
---|---|
name |
The name for the sticker.
TYPE:
|
tag |
The tag for the sticker.
TYPE:
|
image |
The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still PNG, an animated PNG, a Lottie, or a GIF.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
description |
If provided, the description of the sticker.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildSticker
|
The created sticker. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value or if there are no more spaces for the sticker in the guild. |
ForbiddenError
|
If you are missing |
NotFoundError
|
If the guild is not found. |
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. |
create_text_channel
async
#
create_text_channel(
name: str,
*,
position: UndefinedOr[int] = undefined.UNDEFINED,
topic: UndefinedOr[str] = undefined.UNDEFINED,
nsfw: UndefinedOr[bool] = undefined.UNDEFINED,
rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = undefined.UNDEFINED,
category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildTextChannel
Create a text channel in the guild.
PARAMETER | DESCRIPTION |
---|---|
name |
The channels name. Must be between 2 and 1000 characters.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
position |
If provided, the position of the channel (relative to the category, if any).
TYPE:
|
topic |
If provided, the channels topic. Maximum 1024 characters.
TYPE:
|
nsfw |
If provided, whether to mark the channel as NSFW.
TYPE:
|
rate_limit_per_user |
If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
TYPE:
|
permission_overwrites |
If provided, the permission overwrites for the channel.
TYPE:
|
category |
The category to create the channel under. This may be the object or the ID of an existing category.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildTextChannel
|
The created channel. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild 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. |
create_voice_channel
async
#
create_voice_channel(
name: str,
*,
position: UndefinedOr[int] = undefined.UNDEFINED,
user_limit: UndefinedOr[int] = undefined.UNDEFINED,
bitrate: UndefinedOr[int] = undefined.UNDEFINED,
video_quality_mode: UndefinedOr[
Union[VideoQualityMode, int]
] = undefined.UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = undefined.UNDEFINED,
region: UndefinedOr[Union[VoiceRegion, str]] = undefined.UNDEFINED,
category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildVoiceChannel
Create a voice channel in a guild.
PARAMETER | DESCRIPTION |
---|---|
name |
The channels name. Must be between 2 and 1000 characters.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
position |
If provided, the position of the channel (relative to the category, if any).
TYPE:
|
user_limit |
If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.
TYPE:
|
bitrate |
If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.
TYPE:
|
video_quality_mode |
If provided, the new video quality mode for the channel.
TYPE:
|
permission_overwrites |
If provided, the permission overwrites for the channel.
TYPE:
|
region |
If provided, the voice region to for this channel. Passing
TYPE:
|
category |
The category to create the channel under. This may be the object or the ID of an existing category.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildVoiceChannel
|
The created channel. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the gui ld 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. |
delete_channel
async
#
delete_channel(channel: SnowflakeishOr[GuildChannel]) -> GuildChannel
Delete a channel in the guild.
Note
This method can also be used for deleting guild categories as well.
Note
For Public servers, the set 'Rules' or 'Guidelines' channels and the 'Public Server Updates' channel cannot be deleted.
PARAMETER | DESCRIPTION |
---|---|
channel |
The channel or category to delete. This may be the object or the ID of an existing channel.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildChannel
|
Object of the channel or category that was deleted. |
RAISES | DESCRIPTION |
---|---|
hikari.errors.UnauthorizedError, or close a DM.
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the channel 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. |
delete_sticker
async
#
delete_sticker(
sticker: SnowflakeishOr[PartialSticker],
*,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None
Delete a sticker in a guild.
PARAMETER | DESCRIPTION |
---|---|
sticker |
The sticker to delete. This can be a sticker object or the ID of an existing sticker.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you are missing |
NotFoundError
|
If the guild or the sticker are not found. |
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. |
edit
async
#
edit(
*,
name: UndefinedOr[str] = undefined.UNDEFINED,
verification_level: UndefinedOr[
GuildVerificationLevel
] = undefined.UNDEFINED,
default_message_notifications: UndefinedOr[
GuildMessageNotificationsLevel
] = undefined.UNDEFINED,
explicit_content_filter_level: UndefinedOr[
GuildExplicitContentFilterLevel
] = undefined.UNDEFINED,
afk_channel: UndefinedOr[
SnowflakeishOr[GuildVoiceChannel]
] = undefined.UNDEFINED,
afk_timeout: UndefinedOr[Intervalish] = undefined.UNDEFINED,
icon: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
owner: UndefinedOr[SnowflakeishOr[PartialUser]] = undefined.UNDEFINED,
splash: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
banner: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
system_channel: UndefinedNoneOr[
SnowflakeishOr[GuildTextChannel]
] = undefined.UNDEFINED,
rules_channel: UndefinedNoneOr[
SnowflakeishOr[GuildTextChannel]
] = undefined.UNDEFINED,
public_updates_channel: UndefinedNoneOr[
SnowflakeishOr[GuildTextChannel]
] = undefined.UNDEFINED,
preferred_locale: UndefinedOr[Union[str, Locale]] = undefined.UNDEFINED,
features: UndefinedOr[Sequence[GuildFeature]] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> RESTGuild
Edit the guild.
PARAMETER | DESCRIPTION |
---|---|
name |
If provided, the new name for the guild.
TYPE:
|
verification_level |
If provided, the new verification level.
TYPE:
|
default_message_notifications |
If provided, the new default message notifications level.
TYPE:
|
explicit_content_filter_level |
If provided, the new explicit content filter level.
TYPE:
|
afk_channel |
If provided, the new afk channel. Requires
TYPE:
|
afk_timeout |
If provided, the new afk timeout.
TYPE:
|
icon |
If provided, the new guild icon. Must be a 1024x1024 image or can be
an animated gif when the guild has the
TYPE:
|
owner |
If provided, the new guild owner. Warning You need to be the owner of the server to use this.
TYPE:
|
splash |
If provided, the new guild splash. Must be a 16:9 image and the
guild must have the
TYPE:
|
banner |
If provided, the new guild banner. Must be a 16:9 image and the
guild must have the
TYPE:
|
system_channel |
If provided, the new system channel.
TYPE:
|
rules_channel |
If provided, the new rules channel.
TYPE:
|
public_updates_channel |
If provided, the new public updates channel.
TYPE:
|
preferred_locale |
If provided, the new preferred locale.
TYPE:
|
features |
If provided, the guild features to be enabled. Features not provided will be disabled.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RESTGuild
|
The edited guild. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. Or you are missing the |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild 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. |
edit_sticker
async
#
edit_sticker(
sticker: SnowflakeishOr[PartialSticker],
*,
name: UndefinedOr[str] = undefined.UNDEFINED,
description: UndefinedOr[str] = undefined.UNDEFINED,
tag: UndefinedOr[str] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildSticker
Edit a sticker in a guild.
PARAMETER | DESCRIPTION |
---|---|
sticker |
The sticker to edit. This can be a sticker object or the ID of an existing sticker.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
name |
If provided, the new name for the sticker.
TYPE:
|
description |
If provided, the new description for the sticker.
TYPE:
|
tag |
If provided, the new sticker tag.
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildSticker
|
The edited sticker. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing |
NotFoundError
|
If the guild or the sticker are not found. |
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. |
fetch_emoji
async
#
fetch_emoji(emoji: SnowflakeishOr[CustomEmoji]) -> KnownCustomEmoji
Fetch an emoji from the guild.
PARAMETER | DESCRIPTION |
---|---|
emoji |
The emoji to fetch. This can be a
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
KnownCustomEmoji
|
The requested emoji. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the guild or the emoji are not found. |
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. |
fetch_emojis
async
#
fetch_emojis() -> Sequence[KnownCustomEmoji]
Fetch the emojis of the guild.
RETURNS | DESCRIPTION |
---|---|
Sequence[KnownCustomEmoji]
|
The requested emojis. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the guild is not found. |
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. |
fetch_roles
async
#
Fetch the roles of the guild.
RETURNS | DESCRIPTION |
---|---|
Sequence[Role]
|
The requested roles. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild 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() -> RESTGuild
Fetch the guild.
RETURNS | DESCRIPTION |
---|---|
RESTGuild
|
The requested guild. |
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you are not part of the guild. |
NotFoundError
|
If the guild is not found. |
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. |
fetch_sticker
async
#
fetch_sticker(sticker: SnowflakeishOr[PartialSticker]) -> GuildSticker
Fetch a sticker from the guild.
PARAMETER | DESCRIPTION |
---|---|
sticker |
The sticker to fetch. This can be a sticker object or the ID of an existing sticker.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GuildSticker
|
The requested sticker. |
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you are not part of the server. |
NotFoundError
|
If the guild or the sticker are not found. |
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. |
fetch_stickers
async
#
fetch_stickers() -> Sequence[GuildSticker]
Fetch the stickers of the guild.
RETURNS | DESCRIPTION |
---|---|
Sequence[GuildSticker]
|
The requested stickers. |
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you are not part of the server. |
NotFoundError
|
If the guild is not found. |
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. |
kick
async
#
kick(
user: SnowflakeishOr[PartialUser],
*,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None
Kick the given user from this guild.
PARAMETER | DESCRIPTION |
---|---|
user |
The user to kick from the guild.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild or user are 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_icon_url
#
Generate the guild's icon URL, if set.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension 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 resource, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
unban
async
#
unban(
user: SnowflakeishOr[PartialUser],
*,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None
Unban the given user from this guild.
PARAMETER | DESCRIPTION |
---|---|
user |
The user to unban from the guild.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild or user are 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. |
PartialOAuth2Token
#
Model for partial OAuth2 token data returned by the API.
This will generally only be returned when by the client credentials OAuth2 flow.
access_token
class-attribute
instance-attribute
#
Access token issued by the authorization server.
expires_in
class-attribute
instance-attribute
#
Lifetime of this access token.
Team
#
Bases: Unique
Represents a development team, along with all its members.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
icon_hash
class-attribute
instance-attribute
#
The CDN hash of this team's icon.
If no icon is provided, this will be None
.
id
class-attribute
instance-attribute
#
The ID of this entity.
members
class-attribute
instance-attribute
#
members: Mapping[Snowflake, TeamMember] = field(
eq=False, hash=False, repr=False
)
A mapping containing each member in this team.
The mapping maps keys containing the member's ID to values containing the member object.
name
class-attribute
instance-attribute
#
The name of this team.
owner_id
class-attribute
instance-attribute
#
The ID of this team's owner.
make_icon_url
#
Generate the icon URL for this team if set.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL. Can be any power of two between 16 and 4096 inclusive.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
TeamMember
#
Bases: User
Represents a member of a Team.
accent_color
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
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
membership_state
class-attribute
instance-attribute
#
membership_state: Union[TeamMembershipState, int] = field(repr=False)
The state of this user's membership.
permissions
class-attribute
instance-attribute
#
This member's permissions within a team.
At the time of writing, this will always be a sequence of one str
,
which will always be "*"
. This may change in the future, however.
team_id
class-attribute
instance-attribute
#
The ID of the team this member belongs to.
user
class-attribute
instance-attribute
#
The user representation of this team member.
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. |
TeamMembershipState
#
get_token_id
#
Try to get the bot ID stored in a token.
RETURNS | DESCRIPTION |
---|---|
Snowflake
|
The ID that was extracted from the token. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the passed token has an unexpected format. |