Client
Discord client class used to interact with the Discord API.
Attributes activities :
A list of the client's activities. Defaults to None
.
Discord api client for lower level interactions with the Discord API.
The bot account's application. The application data of the client is requested meanwhile it logs in.
None
, AvatarDecoration
The client's avatar decorations.
int
The client's avatar's hash in uint128
.
The client's avatar's type.
None
, Color
The user's banner color if has any.
int
The user's banner's hash in uint128
.
The user's banner's type.
bool
Whether the client is a bot or a user account.
int
The client's discriminator. Given to avoid overlapping names.
None
, str
The clients' non-unique display name.
None
, str
The client's email.
bool
Whether the email of the client is verified.
Contains the event handlers of the client. New event handlers can be added through it as well.
The client's user flags.
The gateway of the client towards Discord.
The group channels of the client. They can be accessed by their id as the key.
A dictionary, which contains the client's guild profiles. If a client is member of a guild, then it should have a respective guild profile accordingly.
set
of Guild
The guilds, where the client is in.
HttpClient
The http session of the client.
int
The client's unique identifier number.
The intent flags of the client.
The preferred locale by the client.
bool
Whether the client has two factor authorization enabled on the account.
The client's username.
The Nitro subscription type of the client.
Stores the private channels of the client. The channels' other recipient' ids are the keys, meanwhile the channels are the values.
None
, ReadyState
The client on login fills up it's .ready_state
with Guild
objects, which will have their members requested.
When receiving a READY
dispatch event, the client's .ready_state
is set as a ReadyState
and a ._delay_ready
task is started, what delays the handle-able ready
event, till every user from the received guilds is cached up. When done, .ready_state
is set back to None
.
Stores the relationships of the client. The relationships' users' ids are the keys and the relationships themselves are the values.
bool
Whether the client is running or not. When the client is stopped, this attribute is set as False
what causes it's heartbeats to stop and it's gateways to close and not reconnect.
str
The client's secret used when interacting with oauth2 endpoints.
int
The client's shard count. Set as 0
if the bot is not using sharding.
Status
The client's display status.
None
, dict
of (str
, str
) itemsThe client's statuses for each platform.
A Dictionary which contains the thread profiles for the user in thread channel - thread profile relation. Defaults to None
.
str
The client's token.
Each bot can join a channel at every Guild
and meanwhile they do, they have an active voice client for that guild. This attribute stores these voice clients. They keys are the guilds' ids, meanwhile the values are the voice clients.
The client's preferred activity.
None
, set
of int
Additional users' (as id) to be passed by the .is_owner
check.
int
The maximal amount of shards that can be launched at the same time.
bool
Whether the client already requests it's gateway.
float
The last timestamp when ._gateway_url
was updated.
str
Cached up gateway url, what is invalidated after 1
minute. Used to avoid unnecessary requests when launching up more shards.
None
, Future
When client gateway is being requested multiple times at the same time, this future is set and awaited at the secondary requests.
bool
Whether the client should try to request the users of it's guilds.
The client's preferred status.
int
The last nonce in int used for requesting guild user chunks. The default value is 0
, what means the next request will start at 1
.
Nonce 0
is allocated for the case, when all the guild's users are requested.
Class Attributes
EventThread
The event loop of the client. Every client uses the same one.
int
Auto id generator for clients without identifier.
Notes
Client supports weakreferencing and dynamic attribute names as well for extension support.
See Also
UserBase
: The superclass ofClient
and of other user types.User
: The default type of Discord users.Webhook
: Discord webhook entity.WebhookRepr
: Discord webhook's user representation.Oauth2User
: A user class with extended oauth2 attributes.
Properties
activity
avatar
avatar_decoration_url
Returns the user's avatar decoration's url. If the user has no avatar decoration returns None
.
This function is a property of UserBase
.
Returns
url : None
, str
avatar_url
Returns the user's avatar's url. If the user has no avatar, then returns it's default avatar's url.
This function is a shared property of UserBase
-s.
Returns
url : None
, str
banner
banner_url
Returns the user's banner's url. If the user has no banner, then returns None
.
This function is a shared property of UserBase
-s.
Returns
url : None
, str
blocked
created_at
When the entity was created.
Returns
created_at : datetime
custom_activity
default_avatar
default_avatar_url
Returns the user's default avatar's url.
Returns
default_avatar_url : str
friends
full_name
The user's name with it's discriminator.
Returns
full_name : str
mention
The mention of the user.
Returns
mention : str
mention_nick
The mention to the user's nick.
Returns
mention : str
Notes
It actually has nothing to do with the user's nickname > <.
mfa
Returns whether the user has multi factory authentication enabled.
This property is deprecated and will be removed in 2024 April. Please use mfa_enabled
instead.
Returns
mfa_enabled : bool
owner
Returns the client's owner if applicable.
If the client is a user account, or if it's .update_application_info
was not called yet, then returns ZEROUSER
. If the client is owned by a Team
, then returns the team's owner.
Returns
owner : ClientUserBase
owners
partial
Returns whether the user is partial. Partial users have only their .id
set and every other field might not reflect the reality.
Returns
partial : bool
platform
Returns the user's top status's platform. If the user is offline it will return an empty string.
Returns
platform : str
plugins
Returns a list of plugins added to the client. Added by the plugin_loader
plugin.
Returns
plugins : list
of Plugin
received_requests
Returns the received friend requests of the client.
Returns
relationships : list
of Relationship
objects
sent_requests
_platform
Returns the client's local platform.
Returns
platform : str
The platform's name or empty string if the client's status is offline or invisible.
Notes
Custom client's status is always 'web'
, so other than ''
, 'web'
will not be returned.
Methods
(token, ...)
__new__Creates a new Client
with the given parameters.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
token |
| A valid Discord token, what the client can use to interact with the Discord API. | ||
activity | The client's preferred activity. | |||
additional_owners |
| Additional users to return | ||
api |
| The api client to use. | ||
application_id |
| The client's application id. If passed as | ||
avatar |
| The client's avatar. | ||
avatar_decoration |
| The client's avatar decoration. | ||
banner |
| The client's banner. | ||
banner_color |
| The client's banner color. | ||
bot |
| Whether the client is a bot user or a user account. | ||
client_id |
| The client's When more | ||
discriminator |
| The client's discriminator. | ||
display_name |
| The client's non-unique display name. | ||
| The client's email. | |||
email_verified |
| Whether the email of the client is verified. | ||
extensions |
| The extension's name to setup on the client. | ||
flags |
| The user's flags. | ||
http |
| The http client to use. | ||
http_debug_options |
| Http client debug options for the client. | ||
intents |
| By default the client will launch up using all the intent flags. Negative values will be interpreted as using all the intents, meanwhile if passed as positive, non existing intent flags are removed. | ||
locale |
| The preferred locale by the client. | ||
mfa_enabled |
| Whether the user has two factor authorization enabled on the account. | ||
name |
| The user's name. | ||
premium_type |
| The Nitro subscription type of the client. | ||
secret |
| Client secret used when interacting with oauth2 endpoints. | ||
shard_count |
| The client's shard count. If passed as lower as the recommended one, will reshard itself. | ||
should_request_users |
| Whether the client should try to request the users of it's guilds. | ||
status |
| The client's preferred status. | ||
**keyword_parameters | keyword parameters | Additional parameters to pass to extension setup functions.
|
Returns
client : Client
Raises
TypeError
If any parameter's type is bad or if unexpected parameter is passed.
ValueError
If an parameter's type is good, but it's value is unacceptable.
RuntimeError
Creating the same client multiple times is not allowed.
(name, description, icon, ...)
achievement_createCreates an achievement for the client's application and returns it.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
name |
| The achievement's name. | |||
description |
| The achievement's description. | |||
icon |
| The achievement's icon. Can have | |||
description_localizations |
|
| Localized descriptions of the achievement. | ||
name_localizations |
|
| Localized names of the achievement. | ||
secret |
|
| Secret achievements will *not* be shown to the user until they've unlocked them. | ||
secure |
|
| Secure achievements can only be set via HTTP calls from your server, not by a game client using the SDK. |
Returns
achievement : Achievement
The created achievement entity.
Raises
TypeError
- If
icon
was not passed asbytes-like
.
ValueError
- If
icon
's format is not any of the expected ones.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(achievement)
achievement_deleteDeletes the passed achievement.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
achievement |
| The achievement to delete. |
Raises
TypeError
If achievement
was not given neither as Achievement
, neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(achievement, ...)
achievement_editEdits the passed achievement with the specified parameters. All parameter is optional.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
achievement |
| The achievement, what will be edited. | ||
description |
| The achievement's new description. | ||
description_localizations |
| Localized descriptions of the achievement. | ||
icon |
| The achievement's new icon. | ||
name |
| The new name of the achievement. | ||
name_localizations |
| Localized names of the achievement. | ||
secret |
| The achievement's new secret value. | ||
secure |
| The achievement's new secure value. |
Returns
achievement : Achievement
After a successful edit, the passed achievement is updated and returned.
Raises
TypeError
- If
icon
was not passed asbytes-like
. - If
achievement
was not given neither asAchievement
, neither asint
.
ValueError
- If
icon
's format is not any of the expected ones.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(achievement)
achievement_getRequests one of the client's achievements by it's id.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
achievement |
| The achievement or it's identifier. |
Returns
achievement : Achievement
Raises
TypeError
If achievement
is not given as Achievement
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
achievement_get_allRequests all the achievements of the client's application and returns them.
This method is a coroutine.
Returns
achievements : list
of Achievement
objects
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(redirect_url, code, scopes)
activate_authorization_codeActivates a user's oauth2 code.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
redirect_url |
| The url, where the activation page redirected to. |
code |
| The code, what is included with the redirect url after a successful activation. |
scopes |
| Scope or a list of oauth2 scopes to request. |
Returns
access : Oauth2Access
, None
If the code, the redirect url or the scopes are invalid, the methods returns None
.
Raises
TypeError
If Scopes
wasn't neither as str
not list
of str
s.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
parse_oauth2_redirect_url
: Parses redirect_url
and the code
from a full url.
(...)
add_additional_ownersAdds additional users to be passed at the .is_owner
check.
Parameter | Type | Optional | Description |
---|---|---|---|
*users |
| The |
Raises
TypeError
A user was passed with invalid type.
(application_command)
application_command_global_createCreates a new global application command.
If there is an application command with the given name, will overwrite that instead.
Each day only maximum only 200 global application command can be created.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
application_command | The application command to create. |
Returns
application_command : ApplicationCommand
The created application command.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
The command will be available in all guilds after 1 hour.
(application_command)
application_command_global_deleteDeletes the given application command.
Parameter | Type | Description |
---|---|---|
application_command |
| The application command delete edit. Can be given as the application command's id as well. |
Raises
TypeError
If application_command
was not given neither as ApplicationCommand
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(old_application_command, new_application_command)
application_command_global_editEdits a global application command.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
old_application_command |
| The application command to edit. Can be given as the application command's id as well. |
new_application_command | The application command to edit to. |
Returns
application_command : ApplicationCommand
The edited application command.
Raises
TypeError
If old_application_command
was not given neither as ApplicationCommand
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
The updates will be available in all guilds after 1 hour.
(application_command)
application_command_global_getRequests the given global application command.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
application_command |
| The application command, or it's id to request. |
Returns
application_commands : ApplicationCommand
The received application command.
Raises
TypeError
If application_command
was not given neither as ApplicationCommand
not as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
application_command_global_get_allRequests the client's global application commands.
This method is a coroutine.
Returns
application_commands : list
of ApplicationCommand
The received application commands.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(application_commands)
application_command_global_update_multipleTakes an iterable of application commands, and updates the actual global ones.
If a command exists with the given name, edits it, if not, will creates a new one.
The created application commands count to the daily limit.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
application_commands |
| The application commands to update the existing ones with. |
Returns
application_commands : list
of ApplicationCommand
The edited and created application commands.
Raises
TypeError
- If
application_commands
is not iterable. - If an element of
application_commands
is notApplicationCommand
instance.
ValueError
- If more than
100
ApplicationCommand
is given.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
The commands will be available in all guilds after 1 hour.
(guild, application_command)
application_command_guild_createCreates a new guild application command.
If there is an application command with the given name, will overwrite that instead.
Each day only maximum only 200 guild application command can be created at each guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, where application commands will be created. |
application_command | The application command to create. |
Returns
application_command : ApplicationCommand
The created application command.
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, application_command)
application_command_guild_deleteDeletes the given application command.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, to what the application command is bound to. |
application_command |
| The application command delete edit. Can be given as the application command's id as well. |
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
application_command
was not given neither asApplicationCommand
norint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, old_application_command, new_application_command)
application_command_guild_editEdits a guild application command.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, to what the application command is bound to. |
old_application_command |
| The application command to edit. Can be given as the application command's id as well. |
new_application_command | The application command to edit to. |
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
old_application_command
was not given neither asApplicationCommand
norint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(application_command)
application_command_guild_getRequests the given guild application command.
Parameter | Type | Description |
---|---|---|
application_command |
| The application command, or it's id to request. |
Returns
application_commands : ApplicationCommand
The received application command.
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
application_command
was not given neither asApplicationCommand
not asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
application_command_guild_get_allRequests the client's global application commands.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, which application commands will be requested. |
Returns
application_commands : list
of ApplicationCommand
The received application commands.
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(application_commands)
application_command_guild_update_multipleTakes an iterable of application commands, and updates the guild's actual ones.
If a command exists with the given name, edits it, if not, will creates a new one.
The created application commands count to the daily limit.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
application_commands |
| The application commands to update the existing ones with. |
Returns
application_commands : list
of ApplicationCommand
The edited and created application commands.
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
application_commands
is not iterable. - If an element of
application_commands
is notApplicationCommand
instance.
ValueError
- If more than
100
ApplicationCommand
is given.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(access, guild, application_command, permission_overwrites)
application_command_permission_editEdits the permissions of the given application_command
in the given guild
.
The new permissions will overwrite the existing permission of an application command.
A command will lose it's permissions on rename.
The endpoint requires oauth access with applications.commands.permissions.update
scope.
The user with the scope must have in the guild:
- Permission to manage guild and roles.
- Ability to invoke the respective command.
- Permission to manage the resources that will be affected. The can be roles, users and channels depending on the permission types.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
access |
| A user's access token to use. |
guild |
| The respective guild. |
application_command |
| The respective application command. Can be |
permission_overwrites |
| The new permission overwrites of the given application command inside of the guild. Give it as |
Returns
permissions : ApplicationCommandPermission
The application command's new permissions.
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
permission_overwrites
was not given asNone
,tuple
,list
,set
. - If
permission_overwrites
contains a nonApplicationCommandPermissionOverwrite
element.
ValueError
- If
permission_overwrites
contains more than 100 elements.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, application_command)
application_command_permission_getReturns the permissions set for the given application_command
in the given guild
.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The respective guild. |
application_command |
| The respective application command. |
Returns
permission : ApplicationCommandPermission
The requested permissions.
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Íf the application command has no permission overwrites in the guild, Discord will drop the following error:
DiscordException Not Found (404), code = 10066: Unknown application command permissions
(guild)
application_command_permission_get_all_guildReturns the permissions set for application commands in the given guild
.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to request application command permissions from. |
Returns
permission : list
of ApplicationCommandPermission
The requested permissions for all the application commands in the guild.
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
application_edit_ownEdits the client's application.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
application |
|
| Application entity to use as a template. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the application with. | |||
cover |
| The application's cover. | |||
custom_install_url |
| The application's default custom authorization link if enabled. | |||
description |
| The description of the application. | |||
flags |
| The application's public flags. | |||
icon |
| The application's icon. | |||
install_parameters | Settings for the application's default in-app authorization link, if enabled. | ||||
interaction_endpoint_url |
| Whether and to which url should interaction events be sent to. | |||
role_connection_verification_url |
| The application's role connection verification entry point | |||
tags |
| Up to 5 tags describing the content and functionality of the application. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(application)
application_getRequests a specific application by it's id.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
application |
| The application or it's identifier to request. |
Returns
application : Application
Raises
TypeError
If application
was not given neither as Application
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This endpoint does not support bot accounts.
()
application_get_all_detectableRequests the detectable applications
This method is a coroutine.
Returns
applications : list
of Application
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, application, ...)
application_invite_createCreates an EMBEDDED_APPLICATION invite to the specified voice channel. The application must have must have embedded
flag.
Deprecated and will be removed in 2024 February.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The target channel of the invite. | |||
application |
| The embedded application to open in the voice channel.
| |||
max_age |
|
| After how much time (in seconds) will the invite expire.
| ||
max_uses |
|
| How much times can the invite be used.
| ||
unique |
|
| Whether the created invite should be unique. | ||
temporary |
|
| Whether the invite should give only temporary membership. |
Returns
invite : Invite
Raises
TypeError
- If
channel
was not given neither asChannel
, neither asint
. - If
application
was not given neither asApplication
nor asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(application_role_connection_metadatas)
application_role_connection_metadata_edit_allEdits all the role connection metadatas of the client's application. Basically overwrites the old ones.
Parameter | Type | Description |
---|---|---|
application_role_connection_metadatas |
| The new application connection metadatas to replace the old ones. |
Returns
application_role_connection_metadatas : list
of ApplicationRoleConnectionMetadata
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
application_role_connection_metadata_get_allRequests all the role connection metadatas of the client's application.
Returns
application_role_connection_metadatas : list
of ApplicationRoleConnectionMetadata
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, ...)
audit_log_get_chunkRequest a batch of audit logs of the guild and returns them. The after
, around
and the before
parameters are mutually exclusive and they can be int
, or as a DiscordEntity
or as a datetime
object.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild, what's audit logs will be requested. | |||
limit |
|
| The amount of audit logs to request. Can be between 1 and 100. Defaults to 100. | ||
before |
|
| The timestamp before the audit log entries wer created. | ||
after |
|
| The timestamp after the audit log entries wer created. | ||
user |
|
| Whether the audit logs should be filtered only to those, which were created by the given user. | ||
entry_type |
|
| Whether the audit logs should be filtered only on the given event. |
Returns
audit_log : AuditLog
A container what contains the AuditLogEntry
-s.
Raises
TypeError
- If
guild
was not given neither asGuild
, nor asint
. - If
after
,before
was passed with an unexpected type. - If
user
is neitherNone
,ClientUserBase
,int
. - If
entry_type
is neitherNone
,AuditLogEntryType
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
limit
was not given asint
. - If
limit
is out of the expected range [1:100].
(guild, ...)
audit_log_iteratorReturns an audit log iterator for the given guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild, what's audit logs will be requested. | |||
user |
|
| Whether the audit logs should be filtered only to those, which were created by the given user. | ||
entry_type |
|
| Whether the audit logs should be filtered only on the given event. |
Returns
audit_log_iterator : AuditLogIterator
(guild, auto_moderation_rule, ...)
auto_moderation_rule_createCreates an auto moderation rule at the given guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild or it's identifier. | |||
auto_moderation_rule | The auto moderation rule to create one like. | ||||
reason |
|
| Shows up at the respective guild's audit logs. |
Returns
auto_moderation_rule : AutoModerationRule
The created auto moderation rule.
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
auto_moderation_rule
was not given asAutoModerationRule
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(auto_moderation_rule, ...)
auto_moderation_rule_deleteDeletes the specified auto moderation rule.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
auto_moderation_rule |
| The auto moderation rule to delete, or a | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If auto_moderation_rule
was not given neither as AutoModerationRule
nor tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(old_auto_moderation_rule, new_auto_moderation_rule, ...)
auto_moderation_rule_editEdits the specified auto moderation rule
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
old_auto_moderation_rule |
| The auto moderation rule to edit, or a | |||
new_auto_moderation_rule | The auto moderation rule to edit the current to. | ||||
reason |
|
| Shows up at the respective guild's audit logs. |
Returns
auto_moderation_rule : AutoModerationRule
Raises
TypeError
- If
old_auto_moderation_rule
was not given neither asAutoModerationRule
nortuple
(int
,int
). - If
new_auto_moderation_rule
was not given asAutoModerationRule
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(auto_moderation_rule)
auto_moderation_rule_getRequests the specified auto moderation rule.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
auto_moderation_rule |
| The auto moderation rule to get, or a |
Returns
auto_moderation_rule : AutoModerationRule
Raises
TypeError
If auto_moderation_rule
was not given neither as AutoModerationRule
nor tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
auto_moderation_rule_get_allRequests all the auto moderation rules of the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild or it's identifier. |
Returns
auto_moderation_rules : list
of AutoModerationRule
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
avatar_decoration_url_asReturns the user's avatar decoration's url. If the user has no avatar decoration returns None
.
This function is a method of UserBase
.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
ext |
|
| The extension of the image's url. Can be any of: | |
size |
|
| The preferred minimal size of the image's url. |
Returns
url : None
, str
Raises
ValueError
If ext
, size
was not passed as any of the expected values.
(...)
avatar_url_asReturns the user's avatar's url. If the user has no avatar, then returns it's default avatar's url.
This function is a shared method of UserBase
-s.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
ext |
|
| The extension of the image's url. Can be any of: | |
size |
|
| The preferred minimal size of the avatar's url. |
Returns
url : None
, str
Raises
ValueError
If ext
, size
was not passed as any of the expected values.
(guild)
avatar_url_atReturns the user's avatar's url at the guild.
This function is a shared method of UserBase
-s.
Parameter | Type | Description |
---|---|---|
guild |
| The respective guild or it's identifier. |
Returns
url : None
, str
(guild, ...)
avatar_url_at_asReturns the user's avatar's url at the guild. If the user has no avatar, then returns it's default avatar's url.
This function is a shared method of UserBase
-s.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
guild |
| The respective guild or it's identifier. | ||
ext |
|
| The extension of the image's url. Can be any of: | |
size |
|
| The preferred minimal size of the avatar's url. |
Returns
url : None
, str
Raises
ValueError
If ext
, size
was not passed as any of the expected values.
(guild)
avatar_url_forReturns the user's guild specific avatar. If the user has no guild local avatar, returns None
.
This function is a shared method of UserBase
-s.
Parameter | Type | Description |
---|---|---|
guild |
| The respective guild or it's identifier. |
Returns
url : None
, str
(guild, ...)
avatar_url_for_asReturns the user's guild specific avatar. If the user has no guild local avatar, then returns None
.
This function is a shared method of UserBase
-s.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
guild |
| The respective guild or it's identifier. | ||
ext |
|
| The extension of the image's url. Can be any of: | |
size |
|
| The preferred minimal size of the avatar's url. |
Returns
url : None
, str
Raises
ValueError
If ext
, size
was not passed as any of the expected values.
(...)
banner_url_asReturns the user's banner's url. If the user has no banner, then returns None
.
This function is a shared method of UserBase
-s.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
ext |
|
| The extension of the image's url. Can be any of: | |
size |
|
| The preferred minimal size of the avatar's url. |
Returns
url : None
, str
Raises
ValueError
If ext
, size
was not passed as any of the expected values.
(emoji)
can_use_emojiReturns whether the user can use the given emoji.
Parameter | Type | Description |
---|---|---|
emoji | The emoji to check. |
Returns
can_use_emoji : bool
(guild, ...)
channel_createCreates a new channel at the given guild
. If the channel is successfully created returns it.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild where the channel will be created. | |||
channel_template |
|
| Channel entity to use as a template. | ||
reason |
|
| Shows up at the | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to create the channel with. | |||
bitrate |
| The bitrate (in bits) of the voice channel. | |||
default_forum_layout |
| The default layout used to display threads of the forum. | |||
default_sort_order |
| The default thread ordering of the forum. | |||
default_thread_auto_archive_after |
| The default duration (in seconds) for newly created threads to automatically archive the themselves. | |||
default_thread_reaction_emoji |
| The emoji to show in the add reaction button on a thread of the forum channel. | |||
default_thread_slowmode |
| The default slowmode applied to the channel's threads. | |||
channel_type |
| The type of the created channel. | |||
flags |
| The channel's flags. | |||
name |
| The channel's name. | |||
nsfw |
| Whether the channel is marked as non safe for work. | |||
parent_id |
| The channel's parent's identifier. | |||
permission_overwrites |
| The channel's permission overwrites. | |||
position |
| The channel's position. | |||
region |
| The channel's voice region. | |||
slowmode |
| The channel's slowmode. | |||
topic |
| The channel's topic. | |||
users |
| The users in the channel. | |||
video_quality_mode | The video quality of the voice channel. |
Returns
channel : Channel
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
channel_deleteDeletes the specified guild channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel to delete. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If the given channel
is not Channel
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If a category channel is deleted, it's sub-channels will not be removed, instead they will move under the guild.
(channel, ...)
channel_editEdits the given guild channel. Different channel types accept different fields, so make sure to not pass out of place parameters. Only the given fields will be modified of the channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel to edit. | |||
channel_template |
|
| A channel to use as a template. | ||
reason |
|
| Shows up at the respective guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
applied_tag_ids |
| The tags' identifier which have been applied to the thread. Applicable for threads of a forum. | |||
auto_archive_after |
| The default duration (in seconds) for newly created threads to automatically archive the themselves. | |||
bitrate |
| The bitrate (in bits) of the voice channel. | |||
default_forum_layout |
| The default layout used to display threads of the forum. | |||
default_sort_order |
| The default thread ordering of the forum. | |||
default_thread_auto_archive_after |
| The default duration (in seconds) for newly created threads to automatically archive the themselves. | |||
default_thread_reaction_emoji |
| The emoji to show in the add reaction button on a thread of the forum channel. | |||
default_thread_slowmode |
| The default slowmode applied to the channel's threads. | |||
flags |
| The channel's flags. | |||
name |
| The channel's name. | |||
nsfw |
| Whether the channel is marked as non safe for work. | |||
open_ |
| Whether the thread channel is open. | |||
parent_id |
| The channel's parent's identifier. | |||
permission_overwrites |
| The channel's permission overwrites. | |||
position |
| The channel's position. | |||
region |
| The channel's voice region. | |||
slowmode |
| The channel's slowmode. | |||
topic |
| The channel's topic. | |||
users |
| The users in the channel. | |||
video_quality_mode | The video quality of the voice channel. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, status, ...)
channel_edit_statusEdits the channel with the given status. Channel should be a guild voice.
this function is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel to edit. | |||
status |
| The channel's status. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
- If any parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(source_channel, target_channel, ...)
channel_followFollows the source_channel
with the target_channel
. Returns the webhook, what will crosspost the published messages.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
source_channel |
| The channel what will be followed. Must be an announcements channel. | |||
target_channel |
| The target channel where the webhook messages will be sent. Can be any guild text channel type. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Returns
webhook : Webhook
The webhook what will crosspost the published messages. This webhook has no .token
set.
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
channel_group_createCreates a group channel with the given users.
This method is a coroutine.
Parameter | Type | Optional | Description |
---|---|---|---|
*users |
| The users to create the channel with. |
Returns
channel : Channel
The created group channel.
Raises
TypeError
If users
contain not only User, Client
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This endpoint does not support bot accounts.
(channel, ...)
channel_group_editEdits the given group channel. Only the provided parameters will be edited.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel to edit. | |||
channel_template |
|
| A channel to use as a template. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to define which fields should be modified. | |||
icon |
| The new icon of the channel. By passing | |||
name |
| The new name of the channel. By passing |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
No request is done if no optional parameter is provided.
(channel)
channel_group_leaveLeaves the client from the specified group channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel to leave from. |
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
channel_group_user_addAdds the users to the given group channel.
This method is a coroutine.
Parameter | Type | Optional | Description |
---|---|---|---|
channel |
| The channel to add the | |
*users |
| The users to add to the |
Raises
TypeError
- If
channel
was not given neither asChannel
norint
. - If
users
contains nonClientUserBase
, neitherint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
channel_group_user_deleteRemoves the users from the given group channel.
This method is a coroutine.
Parameter | Type | Optional | Description |
---|---|---|---|
channel |
| The channel from where the | |
*users |
| The users to remove from the |
Raises
TypeError
- If
channel
was not given neither asChannel
norint
. - If
users
contains nonClientUserBase
, neitherint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, visual_position, ...)
channel_moveMoves a guild channel to the given visual position under it's parent, or guild. If the algorithm can not place the channel exactly on that location, it will place it as close, as it can. If there is nothing to move, then the request is skipped.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel | The channel to be moved. | ||||
visual_position |
| The visual position where the channel should go. | |||
parent |
| If not set, then the channel will keep it's current parent. If the parameter is set | |||
lock_permissions |
|
| If you want to sync the permissions with the new category set it to | ||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
ValueError
- If the
channel
would be between guilds. - If parent channel would be moved under an other category.
TypeError
- If
channel
was isn ot movable. - If
parent
was not given asNone
,Channel
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This method also fixes the messy channel positions of Discord to an intuitive one.
(channel)
channel_pin_get_allReturns the pinned messages at the given channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel from were the pinned messages will be requested. |
Returns
messages : list
of Message
objects
The pinned messages at the given channel.
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(user)
channel_private_createCreates a private channel with the given user. If there is an already cached private channel with the user, returns that.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
user |
| The user to create the private with. |
Returns
channel : Channel
The created private channel.
Raises
TypeError
If user
was not given neither as ClientUserBase
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
channel_private_get_allRequest the client's private + group channels and returns them in a list. At the case of bot accounts the request returns an empty list, so we skip it.
This method is a coroutine.
Returns
channels : list
of (Channel
, Channel
) objects
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel)
channel_thread_get_all_activeRequests all the active threads of the given channel.
Parameter | Type | Description |
---|---|---|
channel |
| The channel to request the thread of, or it's identifier. |
Returns
thread_channels : list
of Channel
Raises
TypeError
If channel
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
When using API v10 or later, this endpoint filters from .guild_thread_get_all_active
method's return. Consider using that instead.
Active threads can also be extracted from Guild.threads
.
(channel)
channel_thread_get_all_archived_privateRequests all the archived private of the given channel.
Parameter | Type | Description |
---|---|---|
channel |
| The channel to request the thread of, or it's identifier. |
Returns
thread_channels : list
of Channel
Raises
TypeError
If channel
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel)
channel_thread_get_all_archived_publicRequests all the archived public threads of the given channel.
Parameter | Type | Description |
---|---|---|
channel |
| The channel to request the thread of, or it's identifier. |
Returns
thread_channels : list
of Channel
Raises
TypeError
If channel
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel)
channel_thread_get_all_self_archivedRequests all the archived private threads by the client.
Parameter | Type | Description |
---|---|---|
channel |
| The channel to request the thread of, or it's identifier. |
Returns
thread_channels : list
of Channel
Raises
TypeError
If channel
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
client_gatewayRequests the gateway information for the client.
Only 1
request can be done at a time and every other will yield the result of first started one.
This method is a coroutine.
Returns
data : dict
of (str
, object
) items
Raises
ConnectionError
No internet connection or if the request raised any DiscordException
.
InvalidToken
When the client's token is invalid.
DiscordException
If any exception was received from the Discord API.
(force)
client_gateway_reshardReshards the client. And also updates it's gateway's url as a side note.
Should be called only if every shard is down.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
force |
| Whether the the client should reshard to lower amount of shards if needed. |
Raises
ConnectionError
No internet connection or if the request raised any DiscordException
.
InvalidToken
When the client's token is invalid.
DiscordException
If any exception was received from the Discord API.
()
client_gateway_urlRequests the client's gateway url. To avoid unreasoned requests when sharding, if this request was done at the last 60
seconds then returns the last generated url.
This method is a coroutine.
Returns
gateway_url : str
The url to what the gateways' websocket will be connected.
Raises
ConnectionError
No internet connection or if the request raised any DiscordException
.
InvalidToken
When the client's token is invalid.
DiscordException
If any exception was received from the Discord API.
()
client_login_staticThe first step at login in is requesting the client's user data. This method is also used to check whether the token of the client is valid.
This method is a coroutine.
Returns
response_data : dict
of (str
: object
)
Decoded json data got from Discord.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
InvalidToken
When the token of the client is invalid.
(guild)
color_atReturns the user's color at the given guild.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, where the user's color will be checked. Can be given as |
Returns
color : Color
()
connectStarts connecting the client to Discord, fills up the undefined events and creates the task, what will keep receiving the data from Discord (._connect
).
If you want to start the connecting process consider using the top-level .start
, start_clients
instead.
This method is a coroutine.
Returns
success : bool
Whether the client could be started.
Raises
RuntimeError
If the client is already running.
()
connection_get_allRequests the client's connections.
This method is a coroutine.
Returns
connections : list
of Connection
objects
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
For a bot account this request will always return an empty list.
()
copyCopies the user returning a new partial one.
Returns
new : instance<type<self>>
(...)
copy_withCopies the user with the given fields.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
avatar |
| The user's avatar. | ||
avatar_decoration |
| The user's avatar decoration. | ||
banner |
| The user's banner. | ||
banner_color |
| The user's banner color. | ||
bot |
| Whether the user is a bot or a user account. | ||
discriminator |
| The user's discriminator. | ||
display_name |
| The user's non-unique display name. | ||
flags |
| The user's flags. | ||
name |
| The user's name. |
Returns
new : instance<type<self>>
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
()
disconnectDisconnects the client and closes it's websocket(s). Till the client goes offline, it might take even over than 1
minute. Because bot accounts can not logout, so they need to wait for timeout.
This method is a coroutine.
(attachment)
download_attachmentDownloads an attachment object's file. This method always prefers the proxy url of the attachment if applicable.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
attachment | The attachment object what's file will be requested. |
Returns
response_data : bytes
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
editEdits the client. Only the provided parameters will be changed. Every parameter what refers to a user account is not tested.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
**keyword_parameters | Keyword parameters | Additional keyword parameters representing which field of the client should be edited. | ||
avatar |
| An | ||
banner |
| An | ||
banner_color |
| The new banner color of the client. By passing it as | ||
display_name |
| The client's non-unique display name. | ||
name |
| The client's new name. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
The method's endpoint has long rate limit reset, so consider using timeout and checking rate limits with RateLimitProxy
.
(...)
edit_presenceChanges the client's presence (status and activity). If a parameter is not defined, it will not be changed.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
activity | The new activity of the Client. | ||||
status |
| The new status of the client. | |||
afk |
|
| Whether the client is afk or not (?). |
Raises
TypeError:
- If the status is not
str
,Status
. - If activity is not
Activity
or has typeActivityType.custom
.
ValueError:
- If the status
str
, but not any of the predefined ones.
(guild, name, image, ...)
emoji_createCreates an emoji at the given guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild, where the emoji will be created. | |||
name |
| The emoji's name. It's length can be between | |||
image |
| The emoji's icon. | |||
roles |
|
| Whether the created emoji should be limited only to users with any of the specified roles. | ||
reason |
|
| Will show up at the guild's audit logs. |
Returns
emoji : Emoji
The created emoji.
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was not given asstr
. - If
name
length is out of the expected range [1:32]. - If
roles
was not given neither asNone
,list
,tuple
,set
.
Notes
Only some characters can be in the emoji's name, so every other character is filtered out.
(emoji, ...)
emoji_deleteDeletes the given emoji.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
emoji | The emoji to delete. | ||||
reason |
|
| Will show up at the respective guild's audit logs. |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If emoji
was not given as Emoji
.
(emoji, ...)
emoji_editEdits the given emoji.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
emoji |
| The emoji to edit. | |||
name |
| The emoji's new name. It's length can be in range [2:32]. | |||
roles |
| The roles to what is the role limited. By passing it as | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was not given asstr
. - If
name
length is out of the expected range [1:32]. - If
roles
was not given neither asNone
,list
,tuple
,set
.
(emoji, ...)
emoji_getRequests the emoji by it's id at the given guild. If the client's logging in is finished, then it should have it's every emoji loaded already.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
emoji |
| The emoji, or 2 snowflake representing it. | |||
force_update |
|
| Whether the emoji should be requested even if it supposed to be up to date. |
Returns
emoji : Emoji
Raises
TypeError
If emoji
was not given as Emoji
, tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
emoji_guild_get_allSyncs the given guild's emojis with the wrapper.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's emojis will be synced. |
Returns
emojis : list
of Emoji
The guild's emojis.
Raises
TypeError
If guild
was not given neither as Guild
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
entitlement_createCreates a new (test) entitlement.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
entitlement_template |
|
| Entitlement to use as a template | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
owner |
| The entitlement's owner. | |||
owner_id |
| The entitlement's owner's identifier. | |||
owner_type |
| The entitlement's owner's type. | |||
sku |
| Alternative for | |||
sku_id |
| Stock keeping unit to create the entitlement for. |
Returns
entitlement : Entitlement
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(entitlement)
entitlement_deleteDeletes the given (test) entitlement.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
entitlement |
| The entitlement to delete. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
entitlement_get_allRequests all the entitlements of the client's application's entitlements that satisfies the criteria.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
exclude_ended |
| Whether ended entitlements should be excluded. Defaults to | ||
guild_id |
| Guild identifier to filter for. | ||
sku_ids |
| Stock keeping units to filter for. | ||
user_id |
| User identifier to filter for. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
entitlement_get_chunkRequests a chunk of the client's application's entitlements that satisfies the criteria.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
after |
| The timestamp after the entitlements were created. | ||
before |
| The timestamp before the entitlements were created. | ||
exclude_ended |
| Whether ended entitlements should be excluded. Defaults to | ||
guild_id |
| Guild identifier to filter for. | ||
limit |
| Up to how much entitlements should be requested. Can be in range | ||
sku_ids |
| Stock keeping units to filter for. | ||
user_id |
| User identifier to filter for. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(eula)
eula_getRequests the eula with the given id.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
eula |
| The |
Returns
eula : EULA
Raises
TypeError
If eula
was not given neither as EULA
not as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(forum_channel, ...)
forum_tag_createCreates a new forum tag in the channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
forum_channel |
| The channel to create the tag in. | |||
forum_tag |
|
| A forum tag which can be used as a template for the newly created tag. | ||
reason |
|
| Shows up at the respective guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
emoji |
| The tag's emoji. | |||
moderated |
| Whether this tag can only be added or removed by a user with | |||
name |
| The tag's name. |
Returns
forum_tag : None
, ForumTag
The created forum tag.
Raises
TypeError
If a parameter's type is not acceptable.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
A forum channel can have up to 25 tags.
See Also
.forum_tag_delete
: Delete a forum tag..forum_tag_edit
: Modify a forum tag.
(forum_channel, forum_tag, ...)
forum_tag_deleteDeletes the given forum tag.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
forum_channel |
| The channel to edit the tag in. | |||
forum_tag |
| The forum tag to delete. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If a parameter's type is not acceptable.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.forum_tag_create
: Create a forum tag..forum_tag_edit
: Modify a forum tag.
(forum_channel, forum_tag, ...)
forum_tag_editEdits the given forum tag.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
forum_channel |
| The channel to edit the tag in. | |||
forum_tag |
| The forum tag to edit. | |||
template_forum_tag |
|
| A forum tag which can be used as a template for edition. | ||
reason |
|
| Shows up at the respective guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
emoji |
| The tag's emoji. | |||
moderated |
| Whether this tag can only be added or removed by a user with | |||
name |
| The tag's name. |
Raises
TypeError
If a parameter's type is not acceptable.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.forum_tag_create
: Create a forum tag..forum_tag_delete
: Delete a forum tag.
(channel_forum, ...)
forum_thread_createCreates and thread at the given channel
with the given message fields. If there is nothing to send will return None
for channel and None
for message as well.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel_forum |
| The forum channel's identifier where the thread will be started. | |||
channel_template |
|
| (Thread) channel entity to use as a template. | ||
*positional_parameters | Positional parameters | Additional parameters to create the message with. | |||
**keyword_parameters | Keyword parameters | Additional parameters to create the message with. | |||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | |||
applied_tag_ids |
| The tags' identifier which have been applied to the thread. | |||
applied_tags |
| Alternative for | |||
attachments |
| Attachments to send. | |||
auto_archive_after |
| The default duration (in seconds) for newly created threads to automatically archive the themselves. | |||
components |
| Components attached to the message. | |||
content |
| The message's content if given. | |||
embed |
| Alternative for | |||
embeds |
| The new embedded content of the message. | |||
file |
| Alternative for | |||
files |
| Alternative for | |||
flags |
| The channel's flags. Due to name collision, | |||
invitable |
| Whether non-moderators can invite other non-moderators to the threads. | |||
name |
| The channel's name. | |||
nonce |
| Used for optimistic message sending. | |||
open_ |
| Whether the thread is open. | |||
silent |
|
| Whether the message should be delivered silently. | ||
slowmode |
| The channel's slowmode. | |||
sticker |
| Alternative for | |||
sticker_ids |
| Sticker(s) to send within the message. | |||
stickers |
| Alternative for | |||
suppress_embeds |
|
| Whether the message's embeds should be suppressed initially. | ||
tts |
|
| Whether the message is text-to-speech. |
Returns
thread_channel : None
, Channel
The created thread channel. None
if there was nothing to send.
message : None
, Message
Returns None
if there is nothing to send.
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.message_create
: Sending a message to a text channel. .thread_create
: Create thread in a text channel.
(user_data, ...)
from_dataCreates a new user from the given data.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
user_data |
| User data. | |||
guild_profile_data |
|
| Guild profile data. | ||
guild_id |
|
| The guild's identifier to which the guild profile is bound to. | ||
strong_cache |
|
| Whether the instance should be put into its strong cache. |
Returns
self : instance<cls>
(guild_id)
gateway_forReturns the corresponding gateway of the client to the passed guild.
Parameter | Type | Description |
---|---|---|
guild_id |
| The respective guild's identifier, what's gateway will be returned. Pass it as |
Returns
gateway : DiscordGatewayClientBase
(name, ...)
get_guildTries to find a guild by it's name. If there is no guild with the given name, then returns the passed default value.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
name |
| The guild's name to search. | ||
default |
|
| The default value, what will be returned if the guild was not found. |
Returns
guild : Guild
, default
Raises
AssertionError
- If
name
was not given asstr
. - If
name
length is out of the expected range [2:100].
(guild)
get_guild_profile_forReturns the user's guild profile for the given guild.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to get guild profile for. |
Returns
guild_profile : None
, Guild
(platform)
get_status_by_platformGets the user's status by the given platform.
Parameter | Type | Description |
---|---|---|
platform |
| The platform to get the status for. |
Returns
status : Status
Defaults to status.offline
if the user has no specific status for the given platform.
(guild, user, ...)
guild_ban_addBans the given user from the guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild from where the user will be banned. | |||
user |
| The user to ban from the guild. | |||
delete_message_duration |
|
| How much seconds back the user's messages should be deleted. Can be in range [0:604800]. | ||
reason |
|
| Shows up at the guild's audit logs. |
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
user
was not given neither asClientUserBase
, norint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, user, ...)
guild_ban_deleteUnbans the user from the given guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild from where the user will be unbanned. | |||
user |
| The user to unban at the guild. | |||
reason |
|
| Shows up at the guild's audit logs. |
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
user
was not given neither asClientUserBase
, norint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, user)
guild_ban_getReturns the guild's ban entry for the given user id.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild where the user banned. |
user |
| The user's or their id, who's entry is requested. |
Returns
ban_entry : BanEntry
The ban entry.
Raises
TypeError
- If
guild
was not passed neither asGuild
,int
. - If
user
was not given neither asClientUserBase
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_ban_get_allReturns the guild's ban entries.
This method might need multiple requests to complete it's task
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's bans will be requested |
Returns
ban_entries : list
of BanEntry
elements
User - reason pairs for each ban entry.
Raises
TypeError
If guild
was not given neither as Guild
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.guild_ban_get_chunk
: Getting a chunk of ban entries up to 1000 users.
(guild, ...)
guild_ban_get_chunkReturns a chunk of the guild's ban entries.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild, what's bans will be requested | |||
after |
|
| The timestamp after the banned users were created. | ||
before |
|
| The timestamp before the banned users were created. | ||
limit |
|
| The amount of ban entries to request. Can be in range [0:1000] When given as non-positive (<= 0) defaults to the maximal amount. |
Returns
ban_entries : list
of BanEntry
elements
User, reason pairs for each ban entry.
Raises
TypeError
- If
guild
was not given neither asGuild
,int
. - If
after
,before
was passed with an unexpected type.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.guild_ban_get_all
: Getting all ban entries of a guild.
(guild)
guild_channel_get_allRequests the given guild's channels and if there any de-sync between the wrapper and Discord, applies the changes.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's channels will be requested. |
Returns
channels : list
of Channel
Raises
TypeError
If guild
was not given neither as Guild
, nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(name, ...)
guild_createCreates a guild with the given parameter. Bot accounts can create guilds only when they have less than 10. User account guild limit is 100, meanwhile staff guild limit is 200.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
name |
| The name of the new guild. | |||
**keyword_parameters | Keyword parameters | Additional parameters to create the guild with. | |||
afk_channel_id |
| The id of the guild's afk channel. The id should be one of the channel's id from | |||
afk_timeout |
|
| The afk timeout for the users at the guild's afk channel. | ||
channels |
| A list of channels of the new guild. It should contain channel data objects. | |||
explicit_content_filter_level | The content filter level of the guild. | ||||
icon |
| The icon of the new guild. | |||
roles |
| A list of roles of the new guild. It should contain role data objects. | |||
default_message_notification_level | The default message notification level of the new guild. | ||||
system_channel_flags |
| Describe which type of messages are sent automatically to the system channel. | |||
system_channel_id |
| The id of the guild's system channel. The id should be one of the channel's id from | |||
verification_level |
| The verification level of the new guild. |
Returns
guild : Guild
A partial guild made from the received data.
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_deleteDeletes the given guild. The client must be the owner of the guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to delete. |
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, category)
guild_discovery_add_sub_categoryAdds a discovery subcategory to the guild.
The client must have manage_guild
permission to execute this method.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to what the discovery subcategory will be added. |
category |
| The discovery category or it's id what will be added as a subcategory. |
Raises
TypeError
- If
guild
is notGuild
,int
. - If
category
is notDiscoveryCategory
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
A guild can have maximum 5
discovery subcategories.
(guild, category)
guild_discovery_delete_sub_categoryRemoves a discovery subcategory of the guild.
The client must have manage_guild
permission to execute this method.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to what the discovery subcategory will be removed from. |
category |
| The discovery category or it's id what will be removed from the subcategories. |
Raises
TypeError
- If
guild
is notGuild
,int
. - If
category
is notDiscoveryCategory
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
A guild can have maximum 5
discovery subcategories.
(guild, ...)
guild_discovery_editEdits the guild's discovery metadata.
The client must have manage_guild
permission to execute this method.
This method is a coroutine.
To modify sub-categories use the
.guild_discovery_add_sub_category
and the.guild_discovery_delete_sub_category
methods.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild what's discovery metadata will be edited or an existing discovery metadata object. | |||
discovery_template |
|
| Guild discovery to use as a template. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to define which fields should be modified. | |||
emoji_discovery |
| Whether guild info is shown when the respective guild's emojis are clicked. | |||
keywords |
| The set discovery search keywords for the guild. | |||
primary_category |
| The primary discovery category of the guild. |
Returns
guild_discovery : GuildDiscovery
Raises
TypeError
- If
guild
is notGuild
,int
. - If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_discovery_getRequests and returns the guild's discovery metadata.
The client must have manage_guild
permission to execute this method.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild | The guild what's discovery will be requested. |
Returns
guild_discovery : GuildDiscovery
Raises
TypeError
- If
guild
is notGuild
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, ...)
guild_editEdits the guild with the given parameters.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild to edit. | |||
guild_template |
|
| Guild entity to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the guild with. | |||
afk_channel_id |
| The afk channel or its identifier. | |||
afk_timeout |
| The afk timeout at the | |||
banner |
| The guild's banner. | |||
boost_progress_bar_enabled |
| Whether the guild has the boost progress bar enabled. | |||
explicit_content_filter_level | The explicit content filter level of the guild. | ||||
description |
| Description of the guild. The guild must be a Community guild. | |||
discovery_splash |
| The guild's discovery splash. | |||
features |
| The guild's features. | |||
hub_type |
| The guild's hub type. | |||
icon |
| The guild's icon. | |||
invite_splash |
| The guild's invite splash. | |||
locale |
| The preferred language of the guild. | |||
default_message_notification_level | The default message notification level of the guild. | ||||
mfa_level |
| The required multi-factor authentication level for the guild. | |||
name |
| The guild's name. | |||
nsfw_level |
| The nsfw level of the guild. | |||
owner_id |
| The guild's owner or their id. | |||
public_updates_channel_id |
| The channel's identifier where the guild's public updates should go. | |||
rules_channel_id |
| The channel or its identifier where the rules of a public guild's should be. | |||
safety_alerts_channel_id |
| The channel or its identifier where safety alerts are sent by Discord. | |||
system_channel_flags |
| Describe which type of messages are sent automatically to the system channel. | |||
system_channel_id |
| The channel or its identifier where the system messages are sent. | |||
vanity_code |
| The guild's vanity invite's code if it has. | |||
verification_level |
| The minimal verification needed to join or to interact with guild. | |||
widget_channel_id |
| The channel or its identifier for which the guild's widget is for. | |||
widget_enabled |
| Whether the guild's widget is enabled. |
Raises
TypeError
- If a parameter's type is invalid.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_getGets or updates the guild.
The client must be in the guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to request. |
Returns
guild : Guild
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
guild_get_allRequests all the guilds of the client.
This method is a coroutine.
Returns
guilds : list
of Guild
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the client finished starting up, all the guilds should be already loaded.
(guild, ...)
guild_incidents_editEdits the guild's incidents with the given parameters.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild to edit the incidents of. | |||
incidents_template |
|
| Guild incidents to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the guild incidents with. | |||
direct_messages_disabled_duration |
| The duration while the direct messages should be disabled in the guild in seconds or time delta. | |||
direct_messages_disabled_until |
| Until when are the direct messages disabled in the guild. | |||
direct_messages_disabled_duration |
| The duration while the invites should be disabled in the guild in seconds or time delta. | |||
invites_disabled_until |
| Until when are the invites disabled of the guild. |
Raises
TypeError
- If a parameter's type is invalid.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, ...)
guild_inventory_settings_editEdits the guild's inventory settings with the given parameters.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild to edit the inventory settings of. | |||
inventory_settings_template |
|
| Guild inventory settings to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the guild inventory settings with. | |||
emoji_pack_collectible |
| Whether you can collect this guild's emojis and use it across all guilds. |
Raises
TypeError
- If a parameter's type is invalid.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_leaveThe client leaves the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild from where the client will leave. |
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_preview_getRequests the preview of a public guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The id of the guild, what's preview will be requested |
Returns
preview : GuildPreview
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, ...)
guild_profile_editEdits the client guild profile in the given guild. Nick and guild specific avatars can be edited on this way.
An extra reason
is accepted as well, which will show up at the respective guild's audit logs.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild where the client's nickname will be changed. If | |||
**keyword_parameters | Keyword parameters | Additional keyword parameters representing which field of the guild profile should be edited. | |||
reason |
|
| Will show up at the respective guild's audit logs. | ||
nick |
| The client's new nickname. Pass it as | |||
avatar |
| The client's new guild specific avatar. Can be a |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, days, ...)
guild_pruneKicks the members of the guild which were inactive since x days.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| Where the pruning will be executed. | |||
days |
| The amount of days since at least the users need to inactive. Can be in range [1:30]. | |||
roles |
|
| By default pruning will kick only the users without any roles, but it can defined which roles to include. | ||
count |
|
| Whether the method should return how much user were pruned, but if the guild is large it will be set to | ||
reason |
|
| Will show up at the guild's audit logs. |
Returns
count : None
, int
The number of pruned users or None
if count
is set to False
.
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
roles
was given neither asNone
,list
. - If
count
was not given asbool
. - If
days
was not given asint
. - If
days
is out of range [1:30].
See Also
.guild_prune_estimate
: Returns how much user would be pruned if .guild_prune
would be called.
(guild, days, ...)
guild_prune_estimateReturns the amount users, who would been pruned, if .guild_prune
would be called.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| Where the counting of prunable users will be done. | |||
days |
| The amount of days since at least the users need to inactive. Can be in range [1:30]. | |||
roles |
|
| By default pruning would kick only the users without any roles, but it can be defined which roles to include. |
Returns
count : int
The amount of users who would be pruned.
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
roles
was given neither asNone
,list
. - If
days
was not given asint
. - If
days
is out of range [1:30].
(guild)
guild_role_get_allRequests the given guild's roles and if there any de-sync between the wrapper and Discord, applies the changes.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's roles will be requested. |
Returns
roles : list
of Role
Raises
TypeError
If guild
was not given neither as Guild
, nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_syncSyncs a guild by it's id with the wrapper. Used internally if de-sync is detected when parsing dispatch events.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to sync. |
Returns
guild : Guild
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_thread_get_all_activeGets all the active threads of the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to get it's threads of. If the guild is given as |
Returns
threads : list
of Channel
Raises
TypeError
If guild
is neither Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, access, ...)
guild_user_addAdds the passed to the guild. The user must have granted you the 'guilds.join'
oauth2 scope.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild, where the user is going to be added. | |||
access |
| The access of the user, who will be added. | |||
user |
| None | Defines which user will be added to the guild. The This field is optional if access is passed as an | ||
nick |
|
| The nickname, which with the user will be added. | ||
roles |
|
| The roles to add the user with. | ||
mute |
|
| Whether the user should be added as muted. | ||
deaf |
|
| Whether the user should be added as deafen. |
Raises
TypeError:
- If
user
was not given neither asNone
,ClientUserBase
,int
. - If
user
was passed asNone
andaccess
was passed asOauth2Access
,str
. - If
access
was not given asOauth2Access
,Oauth2User
, nether asstr
. - If the given
access
not grants'guilds.join'
scope. - If
guild
was not given neither asGuild
, notint
. - If
roles
contain notRole
, norint
.
ValueError
- If the given
access
is not providing the required scope. - If
user
andaccess
refers to a different user.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, user, ...)
guild_user_deleteRemoves the given user from the guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild from where the user will be removed. | |||
user |
| The user to delete from the guild. | |||
reason |
|
| Shows up at the guild's audit logs. |
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
user
was not given neither asClientUserBase
, norint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, user)
guild_user_getGets an user and it's profile at a guild. The user must be the member of the guild. If the user is already loaded updates it.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, where the user is. |
user | ClientUserBase, int | The user's id, who will be requested. |
Returns
user : ClientUserBase
Raises
TypeError
- If
user
was not given neither asClientUserBase
, neither asint
. - If
guild
was not given neither asGuild
norint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_user_get_allRequests all the users of the guild and returns them.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild what's users will be requested. |
Returns
users : list
of ClientUserBase
objects
Raises
TypeError
If guild
was not given neither as Guild
, nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If user caching is allowed, these users should be already loaded if the client finished starting up. This method takes a long time to finish for huge guilds.
When using it with user account, the client's token will be invalidated.
(guild, query, ...)
guild_user_searchGets an user and it's profile at a guild by it's name. If the users are already loaded updates it.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
guild | The guild, where the user is. | |||
query |
| The query string with what the user's name or nick should start. | ||
limit |
|
| The maximal amount of users to return. Can be in range [1:1000]. When passed as non-positive value, will default to the maximal allowed amount. |
Returns
users : list
of ClientUserBase
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
limit
was not given asstr
. - If
limit
is out fo expected range [1:1000].
(guild)
guild_voice_region_get_allRequests the available voice regions for the given guild and returns them and the optional ones.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's regions will be requested. |
Returns
voice_regions : list
of VoiceRegion
objects
The available voice regions for the guild.
optimals : list
of VoiceRegion
objects
The optimal voice regions for the guild.
Raises
TypeError
If guild
was not given neither as Guild
, nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
guild_widget_getReturns the guild's widget.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild or the guild's id, what's widget will be requested. |
Returns
guild_widget : None
, GuildWidget
If the guild has it's widget disabled returns None
instead.
Raises
TypeError
If guild
was not passed neither as Guild
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(role)
has_higher_role_thanReturns whether the user has higher role than the given role at it's respective guild.
If the user is the owner of the guild, then returns True
even if it has lower role.
Parameter | Type | Description |
---|---|---|
role | The role to check. |
Returns
has_higher_role_than : bool
(user, guild)
has_higher_role_than_atReturns whether the user has higher role as the other one at the given guild.
Parameter | Type | Description |
---|---|---|
user | The other user to check. | |
guild |
| The guild where the users' top roles will be checked. Can be given as |
Returns
has_higher_role_than_at : bool
(name)
has_name_likeReturns whether the user's name is like the given string.
Parameter | Type | Description |
---|---|---|
name |
| The name of the user. |
Returns
has_name_like : bool
(name, guild)
has_name_like_atReturns whether the user's name is like the given string.
Parameter | Type | Description |
---|---|---|
name |
| The name of the user. |
guild |
| The guild, where the user's nick will be also checked. Can be given as |
Returns
has_name_like : bool
(role)
has_roleReturns whether the user has the given role.
Parameter | Type | Description |
---|---|---|
role | The role what will be checked. |
Returns
has_role : bool
(house)
hypesquad_house_changeChanges the client's hypesquad house.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
house |
| The hypesquad house to join. |
Raises
TypeError
house
was not given as int
neither as HypesquadHouse
.
Notes
User account only.
()
hypesquad_house_leaveLeaves the client from it's current hypesquad house.
This method is a coroutine.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
User account only.
(guild, integration_id, type_)
integration_createCreates an integration at the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to what the integration will be attached to. |
integration_id |
| The integration's id. |
type_ |
| The integration's type ( |
Returns
integration : Integration
The created integrated.
Raises
TypeError
- If
guild
was not given neither asGuild
norint
. - If
integration_id
was not given asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If type_
is not given as str
.
(integration)
integration_deleteDeletes the given integration.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
integration | The integration what will be deleted. |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If integration
was not given as Integration
.
(integration, ...)
integration_editEdits the given integration.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
integration | The integration to edit. | |||
expire_behavior |
| Can be | ||
expire_grace_period |
| The time in days, after the subscription will be ignored. Can be any of | ||
emojis_enabled |
| Whether the users can use the integration's emojis in Discord. |
Raises
TypeError
- If
expire_behavior
was not passed asint
. - If
expire_grace_period
was not passed asint
. - If
emojis_enabled
was not passed asbool
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
integration
was not given asIntegration
. - If
expire_behavior
was not given neither asNone
nor asint
. - If
expire_grace_period
was not given neither asNone
nor asint
. - If
expire_behavior
is not any of:(0, 1)
. - If
expire_grace_period
is not any of(1, 3, 7, 14, 30)
. - If
emojis_enabled
is neitherNone
,bool
.
(guild)
integration_get_allRequests the integrations of the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's integrations will be requested. |
Returns
integrations : list
of Integration
Raises
TypeError
If guild
was not given neither as Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(integration)
integration_syncSync the given integration's state.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
integration | The integration to sync. |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If integration
was not given as Integration
.
(interaction_event, ...)
interaction_application_command_acknowledgeAcknowledges the given application command interaction.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
interaction_event | Interaction to acknowledge | ||||
wait |
|
| Whether the interaction should be ensured asynchronously. | ||
show_for_invoking_user_only |
|
| Whether the sent message should only be shown to the invoking user. Defaults to |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the interaction is already timed or out or was used, you will get:
DiscordException Not Found (404), code = 10062: Unknown interaction
(interaction_event, choices)
interaction_application_command_autocompleteForwards auto completion choices for the user.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
interaction_event | Interaction to acknowledge | |
choices |
| Choices to show for the user. |
Raises
TypeError
If choice
is neither None
nor iterable
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the interaction is already timed or out or was used, you will get:
DiscordException Not Found (404), code = 10062: Unknown interaction
(interaction_event, ...)
interaction_component_acknowledgeAcknowledges the given component interaction.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
interaction_event | Interaction to acknowledge | |||
wait |
|
| Whether the interaction should be ensured asynchronously. |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the interaction is already timed or out or was used, you will get:
DiscordException Not Found (404), code = 10062: Unknown interaction
(interaction_event, ...)
interaction_component_message_editEdits the given component interaction's source message.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
interaction_event | Interaction, what's source response message will be edited. | |||
*positional_parameters | Positional parameters | Additional parameters to edit the message with. | ||
**keyword_parameters | Keyword parameters | Additional parameters to edit the message with. | ||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | ||
components |
| Components attached to the message. Pass it as | ||
content |
| The new content of the message. | ||
embed |
| Alternative for | ||
embeds |
| The new embedded content of the message. By passing it as | ||
flags |
| The message's new flags. | ||
suppress_embeds |
| Whether the message's embeds should be suppressed or unsuppressed. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event, ...)
interaction_followup_message_createSends a followup message with the given interaction.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
interaction_event | Interaction to create followup message with. | ||||
*positional_parameters | Positional parameters | Additional parameters to create the message with. | |||
**keyword_parameters | Keyword parameters | Additional parameters to create the message with. | |||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | |||
attachments |
| Attachments to send. | |||
components |
| Components attached to the message. | |||
content |
| The message's content if given. | |||
embed |
| Alternative for | |||
embeds |
| The new embedded content of the message. | |||
file |
| Alternative for | |||
files |
| Alternative for | |||
flags |
| The message's flags. | |||
show_for_invoking_user_only |
|
| Whether the sent message should only be shown to the invoking user. | ||
silent |
|
| Whether the message should be delivered silently. | ||
suppress_embeds |
|
| Whether the message's embeds should be suppressed initially. | ||
tts |
|
| Whether the message is text-to-speech. |
Returns
message : None
, Message
Returns None
if there is nothing to send.
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event, message)
interaction_followup_message_deleteDeletes an interaction's followup message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
interaction_event | Interaction with what the followup message was sent with. | |
message |
| The interaction followup's message to edit. |
Raises
TypeError
If message
was not given neither as Message
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event, message, ...)
interaction_followup_message_editEdits the given interaction followup message.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
interaction_event | Interaction with what the followup message was sent with. | |||
message |
| The interaction followup's message to edit. | ||
*positional_parameters | Positional parameters | Additional parameters to edit the message with. | ||
**keyword_parameters | Keyword parameters | Additional parameters to edit the message with. | ||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | ||
attachments |
| Attachments to send. | ||
components |
| Components attached to the message. Pass it as | ||
content |
| The new content of the message. | ||
embed |
| Alternative for | ||
embeds |
| The new embedded content of the message. By passing it as | ||
file |
| Alternative for | ||
files |
| Alternative for | ||
flags |
| The message's new flags. | ||
suppress_embeds |
| Whether the message's embeds should be suppressed or unsuppressed. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event, message_id)
interaction_followup_message_getGets a previously sent message with an interaction.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
interaction_event | Interaction with what the followup message was sent with. | |
message_id |
| The webhook's message's identifier to get. |
Returns
message : Message
Raises
TypeError
- If
message_id
was not given asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event, form)
interaction_form_sendResponds on an interaction with a form.
This function is a coroutine.
Parameter | Type | Description |
---|---|---|
interaction_event | Interaction to respond to. | |
form | The to respond with. |
Raises
RuntimeError
If cannot respond with a form on the given interaction
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Discord do not returns message data, so the method cannot return a Message
either.
If the interaction is already timed or out or was used, you will get:
DiscordException Not Found (404), code = 10062: Unknown interaction
(interaction_event)
interaction_require_subscriptionRequires the user to subscribe to the application.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
interaction_event | Interaction to respond to. |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event, ...)
interaction_response_message_createSends an interaction response. After receiving an InteractionEvent
, you should acknowledge it within 3
seconds to perform followup actions.
Not like .message_create
, this endpoint can be called without any content to still acknowledge the interaction event. This method also wont return a Message
object (thank to Discord), but at least .interaction_followup_message_create
will. To edit or delete this message, you can use .interaction_response_message_edit
and .interaction_response_message_delete
.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
interaction_event | Interaction to respond to. | ||||
*positional_parameters | Positional parameters | Additional parameters to create the message with. | |||
**keyword_parameters | Keyword parameters | Additional parameters to create the message with. | |||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | |||
components |
| Components attached to the message. | |||
content |
| The message's content if given. | |||
embed |
| Alternative for | |||
embeds |
| The new embedded content of the message. | |||
flags |
| The message's flags. | |||
show_for_invoking_user_only |
|
| Whether the sent message should only be shown to the invoking user. | ||
silent |
|
| Whether the message should be delivered silently. | ||
suppress_embeds |
|
| Whether the message's embeds should be suppressed initially. | ||
tts |
|
| Whether the message is text-to-speech. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Discord do not returns message data, so the method cannot return a Message
either.
If the interaction is already timed or out or was used, you will get:
DiscordException Not Found (404), code = 10062: Unknown interaction
(interaction_event)
interaction_response_message_deleteDeletes the given interaction
's source response message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
interaction_event | Interaction, what's source response message will be deleted. |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event, ...)
interaction_response_message_editEdits the given interaction
's source response. If the source interaction event was only deferred, this call will send the message as well.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
interaction_event | Interaction, what's source response message will be edited. | |||
*positional_parameters | Positional parameters | Additional parameters to edit the message with. | ||
**keyword_parameters | Keyword parameters | Additional parameters to edit the message with. | ||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | ||
attachments |
| Attachments to send. | ||
components |
| Components attached to the message. Pass it as | ||
content |
| The new content of the message. | ||
embed |
| Alternative for | ||
embeds |
| The new embedded content of the message. By passing it as | ||
file |
| Alternative for | ||
files |
| Alternative for | ||
flags |
| The message's new flags. | ||
suppress_embeds |
| Whether the message's embeds should be suppressed or unsuppressed. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(interaction_event)
interaction_response_message_getGets the given interaction
's source response message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
interaction_event | Interaction, what's source response message will be deleted. |
Returns
message : Message
The created message.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
invite_createCreates an invite at the given channel with the given parameters.
To create stream invite pass the target_type
parameter as InviteTargetTypes.stream
and use either the target_user
or target_user_id
to define the streamer.
To create an embedded application invite pass the target_type
parameter as InviteTargetTypes.embedded_application
and use either the target_application
or target_application_id
to define the application.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel of the created invite. | |||
invite_template |
|
| Invite entity to use as a template. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to create the invite with. | |||
max_age |
| After how much time (in seconds) will the invite expire. Defaults is never. | |||
max_uses |
| How much times can the invite be used. Defaults to unlimited. | |||
target_application |
| Alternative for | |||
target_application_id |
| The invite's target application. | |||
target_type |
| The invite's target type. | |||
target_user |
| Alternative for | |||
target_user_id |
| The target of the invite if applicable. | |||
temporary |
| Whether the invite should give only temporary membership. | |||
unique |
| Whether the created invite should be unique. |
Returns
invite : Invite
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(, ...)
invite_create_preferredCreates an invite to the guild's preferred channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild . | The guild the invite will be created to. | ||||
**keyword_parameters | Keyword parameters | Additional keyword parameters to describe the created invite. | |||
max_age |
|
| After how much time (in seconds) will the invite expire. Defaults is never. | ||
max_uses |
|
| How much times can the invite be used. Defaults to unlimited. | ||
unique |
|
| Whether the created invite should be unique. | ||
temporary |
|
| Whether the invite should give only temporary membership. |
Returns
invite : Invite
Raises
TypeError
- if
guild
is not Guild˛
ValueError
If the guild has no channel to create invite to.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(invite, ...)
invite_deleteDeletes the given invite.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
invite | The invite to delete. | ||||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If invite
was not given neither Invite
nor str
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, vanity_code, ...)
invite_edit_vanityEdits the given guild's vanity invite's code.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild | The guild, what's invite will be edited. | ||||
vanity_code |
| The new code of the guild's vanity invite. | |||
reason |
|
| Shows up at the guild's audit logs. |
Raises
TypeError
If guild
was not given neither as Guild
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If vanity_code
was not given as str
.
(invite)
invite_getRequests a partial invite with the given code.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
invite |
| The invites code. |
Returns
invite : Invite
Raises
TypeError
If invite
was not given neither Invite
nor str
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If invite_code
was not given as str
.
(channel)
invite_get_all_channelGets the invites of the given channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel, what's invites will be requested. |
Returns
invites : list
of Invite
objects
Raises
TypeError
If channel
was not given neither as Channel
, neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
invite_get_all_guildGets the invites of the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's invites will be requested. |
Returns
invites : list
of Invite
objects
Raises
TypeError
If guild
was not given neither as Guild
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
invite_get_vanityReturns the vanity invite of the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's invite will be returned. |
Returns
invite : None
, Invite
The vanity invite of the guild
, None
if it has no vanity invite.
Raises
TypeError
If guild
was not given neither as Guild
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
is_boostingReturns whether the user is boosting the given guild.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to get whether the user is booster of. |
Returns
is_boosting : bool
(user)
is_ownerReturns whether the passed user is one of the client's owners.
Parameter | Type | Description |
---|---|---|
user | The user who will be checked. |
Returns
is_owner : bool
()
iter_activities()
iter_guildsIterates over the guilds of the user.
This method is an iterable generator.
Yields
guild : Guild
The guild profile's guild.
()
iter_guilds_and_profilesIterates over the guild profiles of the user.
This method is an iterable generator.
Yields
guild : Guild
The guild profile's guild.
guild_profile : GuildProfile
The user's guild profile in the guild.
(channel)
join_audienceMoves the client to the audience inside of the stage channel. The client must be in the stage channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The stage channel to join. |
Raises
RuntimeError
If channel
is partial.
TypeError
If channel
was not given neither as Channel
nor as tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
join_speakersRequest to speak or joins the client as a speaker inside of a stage channel. The client must be in the stage channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel | The stage channel to join. | ||||
request |
|
| Whether the client should only request to speak. |
Raises
TypeError
If channel
was not given neither as Channel
nor as tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel)
join_voiceJoins a voice client to the channel. If there is an already existing voice client at the respective guild, moves it.
If not every library is installed, raises RuntimeError
, or if the voice client fails to connect raises TimeoutError
.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel to join to. |
Returns
voice_client : VoiceClient
Raises
RuntimeError
If not every library is installed to join voice.
TimeoutError
If voice client fails to connect the given channel.
TypeError
If channel
was not given neither as Channel
nor as tuple
(int
, int
).
(channel, ...)
keep_typingReturns a context manager which will keep sending typing events at the channel. Can be used to indicate that the bot is working.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
channel |
| The channel where typing will be triggered. | ||
timeout |
|
| The maximal duration for the |
Returns
typer : Typer
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
Examples
with client.keep_typing(channel):
# Do some things
await client.message_create(channel, 'Ayaya')
(message)
mentioned_inReturns whether the user is mentioned at a given message.
Parameter | Type | Description |
---|---|---|
message | The message, what's mentions will be checked. |
Returns
mentioned : bool
(channel, ...)
message_createCreates and returns a message at the given channel
. If there is nothing to send, then returns None
.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel | The text channel where the message will be sent, or the message on what you want to reply. | ||||
*positional_parameters | Positional parameters | Additional parameters to edit the message with. | |||
**keyword_parameters | Keyword parameters | Additional parameters to edit the message with. | |||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | |||
attachments |
| Attachments to send. | |||
components |
| Components attached to the message. | |||
content |
| The message's content if given. | |||
embed |
| Alternative for | |||
embeds |
| The new embedded content of the message. | |||
file |
| Alternative for | |||
files |
| Alternative for | |||
flags |
| The message's flags. | |||
nonce |
| Used for optimistic message sending. | |||
reply_fail_fallback |
| Whether normal message should be sent if the referenced message is deleted. | |||
reply_message_id |
| Which message should the created message be reply to. Can also be given by passing | |||
silent |
|
| Whether the message should be delivered silently. | ||
sticker |
| Alternative for | |||
sticker_ids |
| Sticker(s) to send within the message. | |||
stickers |
| Alternative for | |||
suppress_embeds |
|
| Whether the message's embeds should be suppressed initially. | ||
tts |
|
| Whether the message is text-to-speech. |
Returns
message : None
, Message
Returns None
if there is nothing to send.
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If
allowed_mentions
's elements' type is correct, but one of their value is invalid. - If more than
10
files would be sent.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.webhook_message_create
: Sending a message with a Webhook
.
(message)
message_crosspostCrossposts the given message. The message's channel must be an announcements (type 5) channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message to crosspost. |
Raises
TypeError
If message
was not given neither as Message
, tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, ...)
message_deleteDeletes the given message.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
message |
| The message to delete. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If message was not given neither as Message
, tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
The rate limit group is different for own or for messages newer than 2 weeks than for message's of others, which are older than 2 weeks.
(messages, ...)
message_delete_multipleDeletes the given messages. The messages can be from different channels as well.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
messages | ( | The messages to delete. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If a message was not given neither as Message
, tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If messages
was not given neither as list
, set
, tuple
.
Notes
This method uses up 3 different rate limit groups parallelly to maximize the deletion speed.
(channel, ...)
message_delete_sequenceDeletes messages between an interval determined by before
and after
. They can be int
, or as a DiscordEntity
or as a DateTime
object.
If the client has no manage_messages
permission at the channel, then returns instantly.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel | The channel, where the deletion should take place. | ||||
after |
|
| The timestamp after the messages were created, which will be deleted. | ||
before |
|
| The timestamp before the messages were created, which will be deleted. | ||
limit |
|
| The maximal amount of messages to delete. | ||
filter |
|
| A callable filter, what should accept a message object as parameter and return either | ||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If after
, before
was passed with an unexpected type.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If channel
was not given as Channel
.
Notes
This method uses up 4 different rate limit groups parallelly to maximize the request and the deletion speed.
(message, ...)
message_editEdits the given message
.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
message |
| The message to edit. | ||
*positional_parameters | Positional parameters | Additional parameters to edit the message with. | ||
**keyword_parameters | Keyword parameters | Additional parameters to edit the message with. | ||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | ||
attachments |
| Attachments to send. | ||
components |
| Components attached to the message. Pass it as | ||
content |
| The new content of the message. | ||
embed |
| Alternative for | ||
embeds |
| The new embedded content of the message. By passing it as | ||
file |
| Alternative for | ||
files |
| Alternative for | ||
flags |
| The message's new flags. | ||
suppress_embeds |
| Whether the message's embeds should be suppressed or unsuppressed. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Do not updates the given message object, so dispatch event events can still calculate differences when received.
See Also
.message_suppress_embeds
: For suppressing only the embeds of the message..webhook_message_edit
: Editing messages sent by webhooks.
(message, ...)
message_getRequests the specified message.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
message |
| The message to get, or a | |||
force_update |
|
| Whether the scheduled event should be requested even if it supposed to be up to date. |
Returns
message : Message
Raises
TypeError
- If
message
's type is neitherMessage
, nortuple
(int
,int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
message_get_all_in_rangeReturns a list of the message between the start
- end
area. If the client has no permission to request messages, or there are no messages at the given area returns an empty list.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
channel |
| The channel from were the messages will be requested. | ||
start |
|
| The first message's index at the channel to be requested. Defaults to | |
end |
|
| The last message's index at the channel to be requested. Defaults to |
Returns
messages : list
of Message
objects
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
start
was not given asint
. - If
start
is out of range [0:]. - If
end
was not given asint
. - If
end
is out of range [0:].
(channel, index)
message_get_at_indexReturns the message at the given channel at the specific index. Can be used to load index
amount of messages at the channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel from were the messages will be requested. |
index |
| The index of the target message. |
Returns
message : Message
object
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
index
was not given asint
. - If
index
is out of range [0:].
(channel, ...)
message_get_chunkRequests messages from the given text channel. The after
, around
and the before
parameters are mutually exclusive and they can be int
, or as a DiscordEntity
or as a DateTime
object. If there is at least 1 message overlap between the received and the loaded messages, the wrapper will chain the channel's message history up. If this happens the channel will get on a queue to have it's messages again limited to the default one, but requesting old messages more times, will cause it to extend.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel from where we want to request the messages. | |||
limit |
|
| The amount of messages to request. Can be between 1 and 100. | ||
after |
|
| The timestamp after the requested messages were created. | ||
around |
|
| The timestamp around the requested messages were created. | ||
before |
|
| The timestamp before the requested messages were created. |
Returns
messages : list
of Message
Raises
TypeError
- If
channel
was not given neither asChannel
norint
. - If
after
,around
,before
was passed with an unexpected type.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
limit
was not given asint
. - If
limit
is out of range [1:100].
See Also
.message_get_chunk_from_zero
: Familiar to this method, but it requests only the newest messages of the channel and makes sure they are chained up with the channel's message history..message_get_at_index
: A top-level method to get a message at the specified index at the given channel. Usually used to load the channel's message history to that point..message_get_all_in_range
: A top-level method to get all the messages till the specified index at the given channel..message_iterator
: An iterator over a channel's message history.
(channel, ...)
message_get_chunk_from_zeroIf the channel
has 1
or less messages loaded use this method instead of .message_get_chunk
to request the newest messages there, because this method makes sure, the returned messages will be chained at the channel's message history.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
channel | The channel from where we want to request the messages. | |||
limit |
|
| The amount of messages to request. Can be between 1 and 100. |
Returns
messages : list
of Message
objects
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
limit
was not given asint
. - If
limit
is out of range [1:100].
(channel, ...)
message_iteratorReturns an asynchronous message iterator over the given text channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel from were the messages will be requested. | |||
chunk_size |
|
| The amount of messages to request when the currently loaded history is exhausted. For message chaining it is preferably |
Returns
message_iterator : MessageIterator
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
chunk_size
was not given asint
. - If
chunk_size
is out of range [1:].
(message)
message_pinPins the given message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message to pin. |
Raises
TypeError
If message
was not given neither as Message
, tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, ...)
message_suppress_embedsSuppresses or unsuppressed the given message's embeds.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
message |
| The message, what's embeds will be (un)suppressed. | ||
suppress_embeds |
|
| Whether the message's embeds would be suppressed or unsuppressed. |
Raises
TypeError
- If
message
was not given neither asMessage
,tuple
(int
,int
). - If
suppress
was not given asbool
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message)
message_unpinUnpins the given message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message to unpin. |
Raises
TypeError
If message
was not given neither as Message
, tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
multi_client_message_delete_sequenceDeletes messages between an interval determined by before
and after
. They can be int
, or as a DiscordEntity
or as a DateTime
object.
Not like .message_delete_sequence
, this method uses up all he clients at the respective channel to delete messages an not only the one from what it was called from.
If non of the clients have manage_messages
permission, then returns instantly.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel | The channel, where the deletion should take place. | ||||
after |
|
| The timestamp after the messages were created, which will be deleted. | ||
before |
|
| The timestamp before the messages were created, which will be deleted. | ||
limit |
|
| The maximal amount of messages to delete. | ||
filter |
|
| A callable filter, what should accept a message object as parameter and return either | ||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If after
, before
was passed with an unexpected type.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If channel
is not Channel
.
Notes
This method uses up to 4 different endpoint groups too as .message_delete_sequence
, but tries to parallelize the them between more clients as well.
(guild)
name_atReturns the user's name at the given guild.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, where the user's nick will be checked. Can be given as |
Returns
name : str
(guild, ...)
onboarding_screen_editEdits the guild's onboarding screen.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild to edit its onboarding screen. | |||
onboarding_screen_template |
|
| Onboarding screen to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the onboarding screen with. | |||
default_channel_ids |
| The channels' identifiers that new members get opted into automatically. | |||
enabled |
| Whether onboarding is enabled. | |||
mode |
| Onboarding mode. | |||
prompts |
| The prompts shown during onboarding and in customize community. |
Returns
onboarding_screen : OnboardingScreen
Raises
TypeError
- If
guild
is notGuild
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
onboarding_screen_getRequests the given guild's onboarding screen.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild what's onboarding screen will be requested. |
Returns
onboarding_screen : OnboardingScreen
Raises
TypeError
- If
guild
is notGuild
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(scopes)
owners_accessSimilar to .activate_authorization_code
, but it requests the application's owner's access. It does not requires the redirect_url and the code parameter either.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
scopes |
| A list of oauth2 scopes to request. |
Returns
access : Oauth2Access
The oauth2 access of the client's application's owner.
Raises
TypeError
If Scopes
is neither str
nor list
of str
s.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
redirect_url
was not given asstr
. - If
code
was not given asstr
. - If
scopes
is empty. - If
scopes
contains empty string.
Notes
Does not work if the client's application is owned by a team.
(channel, ...)
permission_overwrite_createCreates a permission overwrite at the given channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel to what the permission overwrite will be added. | |||
permission_overwrite_template |
|
| Permission overwrite to be used as a template for creating the new one. | ||
reason |
|
| Shows up at the respective guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
allow |
| The permission overwrite's allowed permission's value. | |||
deny |
| The permission overwrite's denied permission's value. | |||
target |
| The permission overwrite's target. Shortcut for defining | |||
target_id |
| The permission overwrite's target's identifier. | |||
target_type | The permission overwrite's target's type. Required if |
Returns
permission_overwrite : PermissionOverwrite
A permission overwrite, what estimatedly is same as the one what Discord will create.
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, permission_overwrite, ...)
permission_overwrite_deleteDeletes the given permission overwrite.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel | ˙˙Channel | The channel where the permission overwrite is. | |||
permission_overwrite |
| The permission overwrite to delete. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, permission_overwrite, ...)
permission_overwrite_editEdits the given permission overwrite.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel | ˙˙Channel, int | The channel where the permission overwrite is. | |||
permission_overwrite | The permission overwrite to edit. | ||||
reason |
|
| Shows up at the respective guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
allow |
| The permission overwrite's allowed permission's value. | |||
deny |
| The permission overwrite's denied permission's value. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, emoji)
reaction_addAdds a reaction on the given message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message on which the reaction will be put on. |
emoji | The reaction to react with. if given as |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message)
reaction_clearRemoves all the reactions from the given message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message from which the reactions will be cleared. |
Raises
TypeError
If message
was not given neither as Message
, tuple
(int
, int
) instance.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, reaction, user)
reaction_deleteRemoves the specified reaction of the user from the given message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message from which the reaction will be removed. |
reaction | The reaction to remove. | |
user | ClientUserBase, int | The user, who's reaction will be removed. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, emoji)
reaction_delete_emojiRemoves all the reaction of the specified emoji from the given message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message from which the reactions will be removed. |
emoji |
| The reaction to remove. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, emoji)
reaction_delete_ownRemoves the specified reaction of the client from the given message.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message from which the reaction will be removed. |
emoji | The reaction to remove. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message)
reaction_get_allRequests all the reactors for every emoji on the given message.
Like the other reaction getting methods, this method prefers using the internal cache as well over doing a request.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message, what's reactions will be requested. |
Returns
message : Message
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, reaction)
reaction_user_get_allRequests the all the users, which reacted on the message with the given message.
If the message has no reactors at all or no reactors with that emoji returns an empty list. If the emoji's every reactors are known, then do requests are done.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
message |
| The message, what's reactions will be requested. |
reaction |
| The reaction, what's reactors will be requested. |
Returns
users : list
of ClientUserBase
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
The given emoji
is not a valid reaction.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message, reaction, ...)
reaction_user_get_chunkRequests the users, who reacted on the given message with the given emoji.
If the message has no reactors at all or no reactors with that emoji, returns an empty list. If we know the emoji's every reactors we query the parameters from that.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
message |
| The message, what's reactions will be requested. | |||
reaction | The emoji, what's reactors will be requested. | ||||
limit |
|
| The amount of users to request. Can be in range [1:100]. Defaults to 100 by Discord. | ||
after |
|
| The timestamp after the message's reactors were created. |
Returns
users : list
of ClientUserBase
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
The given emoji
is not a valid reaction.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
before
parameter is not supported by Discord.
(user, ...)
relationship_createCreates a relationship with the given user.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
user | ClientUserBase, int | The user with who the relationship will be created. | ||
relationship_type |
|
| The type of the relationship. Defaults to |
Raises
TypeError
- If
user
is not given neither asClientUserBase
,int
. - If
relationship_type
was not given neither asNone
,RelationshipType
neither asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This endpoint is available only for user accounts.
(relationship)
relationship_deleteDeletes the given relationship.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
relationship |
| The relationship to delete. Also can be given the respective user with who the client has the relationship with. |
Raises
TypeError
If relationship
was not given neither as Relationship
, ClientUserBase
not as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This endpoint is available only for user accounts.
(user)
relationship_friend_requestSends a friend request to the given user.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
user | ClientUserBase, int | The user, who will receive the friend request. |
Raises
TypeError
If user
was not given neither as ClientUserBase, int.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This endpoint is available only for user accounts.
(...)
remove_additional_ownersRemoves additional owners added by the .add_additional_owners
method.
Parameter | Type | Optional | Description |
---|---|---|---|
*users |
| The |
Raises
TypeError
A user was passed with invalid type.
(access)
renew_access_tokenRenews the access token of an Oauth2Access
.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
access | Oauth2 access to the respective user. |
Raises
TypeError
- If
access
is notOauth2Access
,Oauth2User
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
By default access tokens expire after one week.
(guild)
request_all_users_ofRequests all users of the given guild.
This method uses the client's gateway to request the users. If any of the parameters do not match their expected value or if timeout occurs, returns instead of raising.
If the Client
is created with should_request_users
parameter given as False
, this parameter can be used to request users of specific guilds.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's members will be requested. |
Raises
TypeError
- If
guild
was not given neither asGuild
orint
.
(guilds, force_request)
request_soundboard_soundsRequests the soundboard sounds of the given guilds.
This function is a coroutine.
Parameter | Type | Default | Description |
---|---|---|---|
guilds |
| The guilds or their identifiers to request the sounds of. | |
force_request |
|
| Whether the sounds should be requested even if they are already cached. |
Returns
sounds : None
, list
of SoundboardSoundsEvent
Might return None
if there are no guilds to request sounds from.
(guild, name, ...)
request_usersRequests the members of the given guild by their name.
This method uses the client's gateway to request the users. If any of the parameters do not match their expected value or if timeout occurs, returns an empty list instead of raising.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
guild |
| The guild, what's members will be requested. | ||
name |
| The received user's name or nick should start with this string. | ||
limit |
|
| The amount of users to be received. Limited to |
Returns
users : list
of ClientUserBase
Raises
TypeError
- If
guild
was not given neither asGuild
orint
.
(guild, ...)
role_createCreates a role at the given guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild where the role will be created. | |||
role_template |
|
| Role entity to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to create the role with. | |||
color |
| The role's color. | |||
flags |
| The role's flags. | |||
icon |
| The role's icon. | |||
mentionable |
| Whether the role can be mentioned. | |||
name |
| The role's name. | |||
permissions |
| The permissions of the users having the role. | |||
position |
| The role's position. | |||
separated |
| Users show up in separated groups by their highest | |||
unicode_emoji |
| The role's icon as an unicode emoji. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(role, ...)
role_deleteDeletes the given role.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
role |
| The role to delete | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If role
was not given neither as Role
nor as tuple
of (int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(role, ...)
role_editEdits the role with the given parameters.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
role |
| The role to edit. | |||
role_template |
|
| Role entity to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the role with. | |||
color |
| The role's color. | |||
flags |
| The role's flags. | |||
icon |
| The role's icon. | |||
mentionable |
| Whether the role can be mentioned. | |||
name |
| The role's name. | |||
permissions |
| The permissions of the users having the role. | |||
position |
| The role's position. | |||
separated |
| Users show up in separated groups by their highest | |||
unicode_emoji |
| The role's icon as an unicode emoji. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(role, position, ...)
role_moveMoves the given role.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
role |
| The role to move. | |||
position |
| The position to move the given role. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If role
was not given neither as Role
nor as tuple
of (int
, int
).
ValueError
- If default role would be moved.
- If any role would be moved to position
0
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(roles, ...)
role_reorderMoves more roles at their guild to the specific positions.
Partial roles are ignored and if passed any, every role's position after it is reduced. If there are roles passed with different guilds, then ValueError
will be raised. If there are roles passed with the same position, then their positions will be sorted out.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
roles | ( | A | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If roles
's format is not any of the expected ones.
ValueError
- If default role would be moved.
- If any role would be moved to position
0
. - If roles from more guilds are passed.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, ...)
scheduled_event_createCreates a guild scheduled events.
To define, where the event will take place, use the location
, stage
, voice
parameters.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild, where to create the scheduled event. | |||
scheduled_event_template |
| Scheduled event to use as a template. | |||
reason |
|
| Shows up at the respective guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
description |
|
| The event's description. It's length can be in range [0:1000]. | ||
end |
|
| When the event will end. | ||
location |
|
| The location, where the event will take place. | ||
name |
| The event's name. It's length can be in range [1:100]. | |||
privacy_level |
|
| The privacy level of the event. Whether it is global or guild only. | ||
stage |
|
| The stage channel, where the event will take place. | ||
start |
| When the event will start. | |||
voice |
|
| The voice channel, where the event will take place. |
Returns
scheduled_event : ScheduledEvent
The created scheduled event.
Raises
TypeError
- If
guild
is neitherGuild
norint
. - Parameter of incorrect type given.
- Extra parameters.
ValueError
- Parameter of incorrect value given.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(scheduled_event)
scheduled_event_deleteEdits the given scheduled event.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
scheduled_event |
| The scheduled event to edit. |
Raises
TypeError
If scheduled_event
is neither ScheduledEvent
, nor tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(scheduled_event, ...)
scheduled_event_editEdits the given scheduled event.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
scheduled_event |
| The scheduled event to edit. | |||
scheduled_event_template |
| Scheduled event to use as a template. | |||
reason |
|
| Shows up at the respective guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
description |
| The new description of the scheduled event. It's length can be in range [0:1000]. | |||
end |
| The end of the of the scheduled event. | |||
location |
| The new location, where the event will take place. | |||
name |
| The new name of the scheduled event. It's length can be in range [1:100]. | |||
privacy_level |
| The privacy level of the event. Whether it is global or guild only. | |||
stage |
| The new stage channel, where the event will take place. | |||
start |
| The new start of the scheduled event. | |||
status |
| Thew new status of the scheduled event. | |||
voice |
| The new voice channel, where the event will take place. |
Raises
TypeError
- If
scheduled_event
is neitherScheduledEvent
nortuple
(int
,int
). - Parameter of incorrect type given.
- Extra parameters.
ValueError
- Parameter of incorrect value given.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(scheduled_event, ...)
scheduled_event_getGets the given scheduled event.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
scheduled_event |
| The scheduled event to get. | |||
force_update |
|
| Whether the scheduled event should be requested even if it supposed to be up to date. |
Returns
scheduled_event : ScheduledEvent
Raises
TypeError
If scheduled_event
is neither ScheduledEvent
, nor tuple
(int
, int
) instance.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
scheduled_event_get_all_guildGets the given guild's scheduled event.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild to get it's scheduled of. |
Returns
scheduled_events : list
of ScheduledEvent
Raises
TypeError
If guild
is neither Guild
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(scheduled_event)
scheduled_event_user_get_allRequests a chunk user subscribed to a scheduled event.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
scheduled_event |
| The scheduled event to get. |
Returns
users : list
of ClientUserBase
Raises
TypeError
- If
scheduled_event
is neitherScheduledEvent
, nortuple
(int
,int
) instance.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(scheduled_event, ...)
scheduled_event_user_get_chunkRequests a chunk user subscribed to a scheduled event.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
scheduled_event |
| The scheduled event to get. | |||
after |
|
| The timestamp after the subscribed users were created. | ||
before |
|
| The timestamp before the subscribed users were created. | ||
limit |
|
| The amount of scheduled event users to request. Can be between 1 and 100. |
Returns
users : list
of ClientUserBase
Raises
TypeError
- If
scheduled_event
is neitherScheduledEvent
, nortuple
(int
,int
) instance. - If
after
,before
was passed with an unexpected type.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
limit
was not given asint
. - If
limit
is out of range [1:100].
()
sku_get_allRequests the client's application's stock keeping unit.
This method is a coroutine.
Returns
skus : list
of SKU
The received stock keeping units.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, sound, ...)
soundboard_sound_createCreates a soundboard sound at the given guild.
This function is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild where the soundboard sound will be created. | |||
sound |
| The sound to add. Expected to be in | |||
soundboard_sound_template |
|
| soundboard sound entity to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to create the soundboard_sound with. | |||
emoji |
| Emoji assigned to the sound. | |||
name |
| The name of the sound. | |||
volume |
| The volume of the sound to play as. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(soundboard_sound, ...)
soundboard_sound_deleteDeletes the given soundboard_sound.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
soundboard_sound |
| The soundboard sound to delete | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
If soundboard_sound
was not given neither as SoundboardSound
nor as tuple
of (int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(soundboard_sound, ...)
soundboard_sound_editEdits the soundboard sound with the given parameters.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
soundboard_sound |
| The soundboard sound to edit. | |||
soundboard_sound_template |
|
| Soundboard sound entity to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to create the soundboard sound with. | |||
emoji |
| Emoji assigned to the sound. | |||
name |
| The name of the sound. | |||
volume |
| The volume of the sound to play as. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
soundboard_sound_get_all_defaultRequests the default soundboard sounds.
This method is a coroutine.
Returns
sounds : list
of SoundboardSound
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel, ...)
stage_createEdits the given stage channel.
Will trigger a stage_create
event.
The endpoint has a long rate limit, so please use
.stage_edit
to edit just the stage's topic.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel to create the stage at. | |||
stage_template |
|
| Stage entity to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to create the role with. | |||
privacy_level |
| The new privacy level of the stage. Defaults to guild only. | |||
scheduled_event |
| Alternative for | |||
scheduled_event_id |
| The scheduled event's identifier that started the stage. | |||
send_start_notification |
| Whether @everyone should be notified when the stage is started.
| |||
topic |
| The topic of the stage. |
Returns
stage : Stage
The created stage instance.
Raises
TypeError
- If
channel
was not given asChannel
neither asint
. - If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(stage, ...)
stage_deleteDeletes the given stage channel.
Will trigger a stage_delete
event.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
stage | The stage to delete. Can be given as it's channel's identifier. | ||||
reason |
|
| Shows up at the guild's audit logs. |
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(stage, ...)
stage_editEdits the given stage channel.
Will trigger a stage_edit
event.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
stage | The stage to edit. Can be given as it's channel's identifier. | ||||
stage_template |
|
| Stage entity to use as a template. | ||
reason |
|
| Shows up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to create the role with. | |||
privacy_level |
| The new privacy level of the stage. | |||
topic |
| The new topic of the stage. |
Raises
TypeError
- If
channel
was not given asChannel
neither asint
. - If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(channel)
stage_getGets the stage of the given stage channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The stage's channel's identifier. |
Raises
TypeError
If channel
was not given as Channel
neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
startStarts the clients' connecting to Discord. If the client is already running, raises RuntimeError
.
The return of the method depends on the thread, from which it was called from.
Returns
task : bool
, Task
, FutureWrapperAsync
- If the method was called from the client's thread (KOKORO), then returns a
Task
. The task will returnTrue
, if connecting was successful. - If the method was called from an
EventThread
, but not from the client's, then returns aFutureWrapperAsync
. The task will returnTrue
, if connecting was successful. - If the method was called from any other thread, then waits for the connector task to finish and returns
True
, if it was successful.
Raises
RuntimeError
If the client is already running.
(guild, name, tags, image, ...)
sticker_createCreates a sticker in the guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| The guild to create the sticker in. | |||
name |
| The sticker's name. | |||
tags |
| The tags of the sticker. | |||
image |
| The sticker's image in bytes. | |||
description |
|
| The sticker's representation. | ||
reason |
|
| Will show up at the respective guild's audit logs. |
Returns
sticker : Sticker
The created sticker.
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ValueError
If image
s media type is neither image/png
nor application/json
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(sticker, ...)
sticker_deleteDeletes the sticker.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
sticker |
| The sticker to delete. | |||
reason |
|
| Will show up at the respective guild's audit logs. |
Raises
TypeError
If sticker
is neither Sticker
, nor int
.
ValueError
- Standard stickers cannot be deleted.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(sticker, ...)
sticker_editEdits the given guild bound sticker,
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
sticker |
| The respective sticker. | |||
name |
| New name of the sticker. It's length can be in range [2:32]. | |||
tags |
| The new emoji representation of the sticker. Used as a tag for the sticker. | |||
description |
| New description for the sticker. It's length can be in range [0:100]. | |||
reason |
|
| Will show up at the respective guild's audit logs. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
- Standard stickers cannot be edited.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(sticker, ...)
sticker_getGets an sticker by it's id. If the sticker is already loaded updates it.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
sticker |
| The sticker, who will be requested. | |||
force_update |
|
| Whether the sticker should be requested even if it supposed to be up to date. |
Returns
sticker : Sticker
Raises
TypeError
If sticker
was not given neither as Sticker
, neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
TypeError
If sticker
was not given as Sticker
, nor as int
.
(guild)
sticker_get_all_guildSyncs the given guild's stickers with the wrapper.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's stickers will be synced. |
Returns
stickers : list
of Sticker
The guild's stickers.
Raises
TypeError
If guild
was not given neither as Guild
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(sticker, ...)
sticker_get_guildGets the specified sticker from the respective guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
sticker |
| The sticker to get. | |||
force_update |
|
| Whether the sticker should be requested even if it supposed to be up to date. |
Raises
TypeError
If sticker
is not Sticker
, tuple
(int
, int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
sticker_guild_createDeprecated and will be removed in 2023 December. Please use .sticker_create
instead.
()
sticker_guild_deleteDeprecated and will be removed in 2023 December. Please use .sticker_delete
instead.
()
sticker_guild_editDeprecated and will be removed in 2023 December. Please use .sticker_edit
instead.
()
sticker_guild_getDeprecated and will be removed in 2023 December. Please use .sticker_get_guild
instead.
()
sticker_guild_get_allDeprecated and will be removed in 2023 December. Please use .sticker_get_all_guild
instead.
(sticker_pack, ...)
sticker_pack_getGets the sticker packs. If the sticker-packs are already loaded, updates them.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
sticker_pack |
| The sticker pack' identifier. | |||
force_update |
|
| Whether the sticker-pack should be requested even if it supposed to be up to date. |
Returns
sticker_packs : list
of StickerPack
Raises
TypeError ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
sticker_pack_get_allGets the sticker packs. If the sticker-packs are already loaded, updates them.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
force_update |
|
| Whether the sticker-packs should be requested even if it supposed to be up to date. |
Returns
sticker_packs : list
of StickerPack
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
stopStarts disconnecting the client.
The return of the method depends on the thread, from which it was called from.
Returns
task : None
, Task
, FutureWrapperAsync
- If the method was called from the client's thread (KOKORO), then returns a
Task
. - If the method was called from an
EventThread
, but not from the client's, then returns aFutureWrapperAsync
. - If the method was called from any other thread, returns
None
when disconnecting finished.
(guild, user, ...)
stream_invite_createCreates an STREAM invite at the given guild for the specific user. The user must be streaming at the guild, when the invite is created.
Deprecated and will be removed in 2024 February.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild | The guild where the user streams. | ||||
user | ClientUserBase, int | The streaming user. | |||
max_age |
|
| After how much time (in seconds) will the invite expire. Defaults is never. | ||
max_uses |
|
| How much times can the invite be used. Defaults to unlimited. | ||
unique |
|
| Whether the created invite should be unique. | ||
temporary |
|
| Whether the invite should give only temporary membership. |
Returns
invite : Invite
Raises
TypeError
- If
user
was not given neither asClientUserBase
neither asint
. - If
guild
is notGuild
.
ValueError
- If the user is not streaming at the guild.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(message_or_channel, ...)
thread_createCreates a new thread derived from the given message or channel.
For private thread channels the guild needs to have level 2 boost level.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
message_or_channel | The channel or message to create thread from.
| ||||
channel_template |
|
| Channel to use as a template. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
applied_tag_ids |
| The tags' identifier which have been applied to the thread. | |||
applied_tags |
| Alternative for | |||
auto_archive_after |
| The default duration (in seconds) for newly created threads to automatically archive the themselves. | |||
channel_type |
|
| The type of the created (thread) channel. | ||
flags |
| The channel's flags. | |||
invitable |
| Whether non-moderators can invite other non-moderators to the threads. | |||
name |
| The channel's name. | |||
open_ |
| Whether the thread channel is open. | |||
slowmode |
| The channel's slowmode. |
Returns
thread_channel : Channel
The created thread channel.
Raises
TypeError
If any parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(thread_channel)
thread_joinJoins the client to the given thread channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
thread_channel |
| The channel to join to, or it's identifier. |
Raises
TypeError
If thread_channel
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(thread_channel)
thread_leaveLeaves the client to the given thread channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
thread_channel |
| The channel to join to, or it's identifier. |
Raises
TypeError
If thread_channel
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(thread_channel, user)
thread_user_addAdds the user to the thread channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
thread_channel |
| The channel to add the user to, or it's identifier. |
user |
| The user to add to the the thread. |
Raises
TypeError
- If
thread_channel
's type is incorrect. - If
user
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(thread_channel, user)
thread_user_deleteDeletes the user to the thread channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
thread_channel |
| The channel to remove the user from, or it's identifier. |
user |
| The user to remove from the thread. |
Raises
TypeError
- If
thread_channel
's type is incorrect. - If
user
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(thread_channel, user)
thread_user_getGets a user's thread profile inside of a thread channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
thread_channel |
| The channel to get the user's thread profile of. |
user |
| The user to get it's thread profile of. |
Returns
user : ClientUserBase
The user, who's thread profile was requested.
Raises
TypeError
- If
thread_channel
's type is incorrect. - If
user
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(thread_channel)
thread_user_get_allGets all the users of a thread channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
thread_channel |
| The channel to get it's users of. |
Returns
users : list
of ClientUserBase
The created users.
Raises
TypeError
If thread_channel
's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(...)
to_dataTries to convert the user back to a json serializable dictionary.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
defaults |
|
| Whether default values should be included as well. | ||
include_internals |
|
| Whether internal fields should be included as well. |
Returns
data : dict
of (str
, object
) items
(guild, ...)
top_role_atReturns the top role of the user at the given guild.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
guild |
| The guild where the user's top role will be looked up. | ||
default |
|
| If the user is not a member of the guild, or if has no roles there, then the given default value is returned. Defaults to |
Returns
top_role Role
, default
(channel)
typingSends a typing event to the given channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel where typing will be triggered. |
Raises
TypeError
If channel
was not given neither as Channel
nor int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
The client will be shown up as typing for 8 seconds, or till it sends a message at the respective channel.
()
update_application_infoUpdates the client's application's info.
This method is a coroutine.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Meanwhile the clients logs in this method is called to ensure that the client's application info is loaded.
This endpoint is available only for bot accounts.
(access)
user_achievement_get_allRequests the achievements of a user with it's oauth2 access.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
access |
| The access of the user, who's achievements will be requested. |
Returns
achievements : list
of Achievement
objects
Raises
TypeError
If access
was not given neither as Oauth2Access
, Oauth2User
or str
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This endpoint is unintentionally documented and will never work. For reference: https://github.com/discordapp/discord-api-docs/issues/1230
.
Always drops DiscordException UNAUTHORIZED (401): 401: Unauthorized
.
(user, achievement, percent_complete)
user_achievement_updateUpdates the user
's achievement with the given percentage. The achievement should be secure
. This method only updates the achievement's percentage.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
user |
| The user, who's achievement will be updated. |
achievement |
| The achievement, what's state will be updated |
percent_complete |
| The completion percentage of the achievement.
|
Raises
TypeError
- If
user
was not given neither asClientUserBase
norint
. - If
achievement
was not given neither asAchievement
, neither asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
This endpoint cannot grant achievement, but can it even update them?. For reference: https://github.com/discordapp/discord-api-docs/issues/1230
.
Only secure updates are supported, if they are even.
- When updating secure achievement:
DiscordException NOT FOUND (404), code = 10029: Unknown Entitlement
- When updating non secure:
DiscordException FORBIDDEN (403), code = 40001: Unauthorized
(access, ...)
user_application_role_connection_editEdits a user's application role connections with it's Oauth2Access
. The user must provide the Oauth2Scope.role_connections_write
scope for this request to succeed.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
access |
| The access of the user, who will's application role connections will be requested.. | |||
application_role_connection_template |
| Application role connection to use as a template. | |||
**keyword_parameters | Keyword parameters | Additional keyword parameters either to define the template, or to overwrite specific fields' values. | |||
platform_name |
| The vanity name of the platform the application represents. | |||
platform_user_name |
| The name of the user on the application's platform. | |||
metadata_values |
| Metadata key to attached value relation. |
Returns
application_role_connection : ApplicationRoleConnection
Raises
TypeError
- If
access
is notOauth2Access
,Oauth2User
,str
.
ValueError
- If the given
access
is not providing the required scope.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(access)
user_application_role_connection_getRequests a user's application role connections with it's Oauth2Access
. The user must provide the Oauth2Scope.role_connections_write
scope for this request to succeed.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
access |
| The access of the user, who will's application role connections will be requested.. |
Returns
application_role_connection : ApplicationRoleConnection
Raises
TypeError
- If
access
is notOauth2Access
,Oauth2User
,str
.
ValueError
- If the given
access
is not providing the required scope.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(access)
user_connection_get_allRequests a user's connections. This method will work only if the access token has the 'connections'
scope. At the returned list includes the user's hidden connections as well.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
access |
| Oauth2 access to the respective user or it's access token. |
Returns
connections : list
of Connection
The user's connections.
Raises
TypeError
- If
access
is notOauth2Access
,Oauth2User
,str
.
ValueError
- If the given
access
is not providing the required scope.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(user, ...)
user_getGets an user by it's id. If the user is already loaded updates it.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
user |
| The user, who will be requested. | |||
force_update |
|
| Whether the user should be requested even if it supposed to be up to date. |
Returns
user : ClientUserBase
Raises
TypeError
If user
was not given as ClientUserBase
, nor as int
.
(access)
user_guild_get_allRequests a user's guilds with it's Oauth2Access
. The user must provide the Oauth2Scope.guilds
scope for this request to succeed.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
access |
| The access of the user, who's guilds will be requested. |
Returns
guilds_and_permissions : list
of tuple
(Guild
, UserGuildPermission
)
The guilds and the user's permissions in each of them. Not loaded guilds will show up as partial ones.
Raises
TypeError
- If
access
is notOauth2Access
,Oauth2User
,str
.
ValueError
- If the given
access
is not providing the required scope.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild, user, ...)
user_guild_profile_editEdits the user's guild profile at the given guild.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild |
| Where the user will be edited. | |||
user |
| The user to edit, or their identifier. | |||
reason |
|
| Will show up at the guild's audit logs. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters representing which field of the guild profile should be edited. | |||
deaf |
| Whether the user should be deafen at the voice channels. | |||
mute |
| Whether the user should be muted at the voice channels. | |||
nick |
| The new nick of the user. You can remove the current one by passing it as | |||
voice_channel |
| Moves the user to the given voice channel. Only applicable if the user is already at a voice channel. Pass it as | |||
role_ids |
| The new roles of the user. Give it as | |||
roles |
| Alternative of | |||
timed_out_until |
| Until when the user is timed out. | |||
timeout_duration |
| The timeout duration of the user in seconds. The max allowed value equals to 28 days. | |||
voice_channel |
| Alternative of | |||
voice_channel_id |
| Moves the user to the given voice channel. Only applicable if the user is already at a voice channel. Pass it as |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(access)
user_info_getRequest the a user's information with oauth2 access token. By default a bot account should be able to request every public information about a user (but you do not need oauth2 for that). If the access token has email or/and identify scopes, then more information should show up like this.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
access |
| Oauth2 access to the respective user or it's access token. |
Returns
oauth2_user : Oauth2User
The requested user object.
Raises
TypeError
- If
access
is notOauth2Access
,Oauth2User
,str
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Needs 'email'
or / and 'identify'
scopes granted for more data
(user, role, ...)
user_role_addAdds the role on the user.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
user | ClientUserBase, int | The user who will get the role. | |||
role |
| The role to add on the user. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
- If
user
was not given neither asClientUserBase
, neither asint
. - If
role
was not given neither asRole
nor astuple
of (int
,int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(user, role, ...)
user_role_deleteDeletes the role from the user.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
user | ClientUserBase, int | The user from who the role will be removed. | |||
role |
| The role to remove from the user. | |||
reason |
|
| Shows up at the respective guild's audit logs. |
Raises
TypeError
- If
user
was not given neither asClientUserBase
, neither asint
. - If
role
was not given neither asRole
nor astuple
of (int
,int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(user, guild)
user_voice_kickKicks the user from the guild's voice channels. The user must be in a voice channel at the guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
user | ClientUserBase, int | The user who will be kicked from the voice channel. |
guild |
| The guild from what's voice channel the user will be kicked. |
Raises
TypeError
- If
user
was not given neither asClientUserBase
, neither asint
. - If
guild
was not given neither asGuild
norint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(user, channel)
user_voice_moveMoves the user to the given voice channel. The user must be in a voice channel at the respective guild already.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
user | ClientUserBase, int | The user to move. |
channel |
| The channel where the user will be moved. |
Raises
TypeError
- If
user
was not given neither asClientUserBase
, neither asint
. - If
channel
was not given neither asChannel
nor astuple
of (int
,int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(user, channel)
user_voice_move_to_audienceMoves the user to the audience inside of a stage channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
user | ClientUserBase, int | The user to move. |
channel |
| The channel where the user will be moved. |
Raises
TypeError
- If
user
was not given neither asClientUserBase
, neither asint
. - If
channel
was not given neither asChannel
nor astuple
of (int
,int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(user, channel)
user_voice_move_to_speakersMoves the user to the speakers inside of a stage channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
user | ClientUserBase, int | The user to move. |
channel |
| The channel where the user will be moved. |
Raises
TypeError
- If
user
was not given neither asClientUserBase
, neither asint
. - If
channel
was not given neither asChannel
nor astuple
of (int
,int
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
vanity_invite_editDeprecated and will be removed in 2023 February. Please use .invite_edit_vanity
instead.
(guild, ...)
verification_screen_editRequests the given guild's verification screen.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
guild |
| The guild what's verification screen will be edited. | ||
verification_screen_template |
| Verification screen to use as a template. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the verification screen with. | ||
description |
| The guild's description shown in the verification screen. | ||
edited_at |
| When the last version of the screen was created. | ||
enabled |
| Whether the verification screen should be enabled. | ||
steps |
| The step in the verification screen. |
Returns
verification_screen : VerificationScreen
Raises
TypeError
- If
guild
was notGuild
,int
. - If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
verification_screen_getRequests the given guild's verification screen.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's verification screen will be requested. |
Returns
verification_screen : None
, VerificationScreen
Raises
TypeError
- If
guild
was notGuild
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the guild has no verification screen enabled, will not do any request.
(message)
voice_client_forReturns the voice client for the given message's guild if it has any.
Parameter | Type | Description |
---|---|---|
message | The message what's voice client will be looked up. |
Returns
voice_client : None
, VoiceClient
The voice client if applicable.
()
voice_region_get_allReturns all the voice regions.
This method is a coroutine.
Returns
voice_regions : list
of VoiceRegion
objects
Received voice regions.
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(event_name, check, ...)
wait_forO(n) event waiter with massive overhead compared to other optimized event waiters.
This method is a coroutine.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
event_name |
| The respective event's name. | ||
check |
| Check, what tells that the waiting is over. If the | ||
timeout |
|
| Timeout after |
Returns
result : object
Parameters passed to the check
and the value returned by the check
if it's type is not bool
.
Raised
TimeoutError
Timeout occurred.
BaseException
Any exception raised by check
.
(channel, name, ...)
webhook_createCreates a webhook at the given channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel of the created webhook. | |||
name |
| The name of the new webhook. It's length can be in range [1:80]. | |||
avatar |
|
| The webhook's avatar. Can be |
Returns
webhook : Webhook
The created webhook.
Raises
TypeError
- If
channel
was not given neither asChannel
nor asint
. - If
avatar
was not given neither asNone
,bytes-like
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was not given asstr
. - If
name
range is out of the expected range [1:80]. - If
avatar
's type is not any of the expected ones:'jpg'
,'png'
,'webp'
,'gif'
.
(webhook)
webhook_deleteDeletes the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to delete. |
Raises
TypeError
If webhook
was not given neither as Webhook
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.webhook_delete_token
: Deleting webhook with Discord's webhook API.
(webhook, webhook)
webhook_delete_tokenDeletes the webhook through Discord's webhook API.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to delete. |
webhook | The webhook to delete. |
Raises
TypeError
If webhook
was not given neither as Webhook
neither as a tuple
(int
, str
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(webhook, ...)
webhook_editEdits and updates the given webhook.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
webhook |
| The webhook to edit. | ||
name |
| The webhook's new name. It's length can be in range [1:80]. | ||
avatar |
| The webhook's new avatar. Can be | ||
channel |
| The webhook's channel. |
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was given but not asstr
. - If
name
's length is out of range [1:80]. - If
avatar
's type is not any of the expected ones:'jpg'
,'png'
,'webp'
,'gif'
.
See Also
.webhook_edit_token
: Editing webhook with Discord's webhook API.
(webhook, ...)
webhook_edit_tokenEdits and updates the given webhook through Discord's webhook API.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
webhook |
| The webhook to edit. | ||
name |
| The webhook's new name. It's length can be between | ||
avatar |
| The webhook's new avatar. Can be |
Returns
webhook : Webhook
The updated webhook.
Raises
TypeError
- If
webhook
was not given neither asWebhook
neither as atuple
(int
,str
). - If
avatar
was not given neither asNone
nor asbytes-like
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was given but not asstr
. - If
name
's length is out of range [1:80]. - If
avatar
's type is not any of the expected ones:'jpg'
,'png'
,'webp'
,'gif'
.
Notes
This endpoint cannot edit the webhook's channel, like .webhook_edit
.
(webhook)
webhook_getRequests the webhook by it's id.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to update or the webhook's id to get. |
Returns
webhook : Webhook
Raises
TypeError
If webhook
was not given neither as Webhook
neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the webhook already loaded and if it's guild's webhooks are up to date, no request is done.
See Also
.webhook_get_token
: Getting webhook with Discord's webhook API.
(channel)
webhook_get_all_channelRequests all the webhooks of the channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel, what's webhooks will be requested. |
Returns
webhooks : list
of Webhook objects
Raises
TypeError
If channel
was not given neither as Channel
, neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
You may expect the following exceptions:
Error code | Internal name | Reason |
---|---|---|
10003 | unknown_channel | The channel not exists. |
50013 | missing_permissions | You need manage_webhooks permission. (Or the client has no access to the channel.) |
60003 | mfa_required | You need to have multi-factor authorization to do this operation (guild setting dependent). For bot accounts it means their owner needs mfa. |
Discord drops
Forbidden (403), code = 50013: Missing Permissions
instead ofForbidden (403), code = 50001: Missing Access
.
AssertionError
If channel
was given as a channel's identifier but it detectably not refers to a Channel
.
Notes
No request is done, if the passed channel is partial, or if the channel's guild's webhooks are up to date.
(guild)
webhook_get_all_guildRequests the webhooks of the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's webhooks will be requested. |
Returns
webhooks : list
of Webhook objects
Raises
TypeError
If guild
was not given neither as Guild
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
No request is done, if the guild's webhooks are up to date.
(channel)
webhook_get_own_channelRequests the webhooks of the given channel and returns the first owned one.
Parameter | Type | Description |
---|---|---|
channel |
| The channel, what's webhooks will be requested. |
Returns
webhooks : list
of Webhook objects
(webhook)
webhook_get_tokenRequests the webhook through Discord's webhook API. The client do not needs to be in the guild of the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to update or the webhook's id and token. |
Returns
webhook : Webhook
Raises
TypeError
If webhook
was not given neither as Webhook
neither as a tuple
(int
, str
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the webhook already loaded and if it's guild's webhooks are up to date, no request is done.
(webhook, ...)
webhook_message_createSends a message with the given webhook. If there is nothing to send, or if wait
was not passed as True
returns None
.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
webhook |
| The webhook through what will the message be sent. | |||
*positional_parameters | Positional parameters | Additional parameters to create the message with. | |||
thread |
|
| The thread of the webhook's channel where the message should be sent. | ||
wait |
|
| Whether we should wait for the message to send and receive it's data as well. | ||
**keyword_parameters | Keyword parameters | Additional parameters to create the message with. | |||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | |||
applied_tag_ids |
| The tags' identifier which have been applied to the thread. Applicable for threads of a forum-like channels. | |||
applied_tags |
| Alternative for | |||
attachments |
| Attachments to send. | |||
avatar_url |
|
| The message's author's avatar's url. Defaults to the webhook's avatar' url by Discord. | ||
components |
| Components attached to the message. | |||
content |
| The message's content if given. | |||
embed |
| Alternative for | |||
embeds |
| The new embedded content of the message. | |||
file |
| Alternative for | |||
files |
| Alternative for | |||
flags |
| The message's flags. | |||
name |
|
| The message's author's new name. Default to the webhook's name by Discord. | ||
silent |
|
| Whether the message should be delivered silently. | ||
suppress_embeds |
|
| Whether the message's embeds should be suppressed initially. | ||
thread_name |
| The thread's name to create. Applicable only in forum-like channels. | |||
tts |
|
| Whether the message is text-to-speech. |
Returns
message : Message
, None
Returns None
if there is nothing to send or if wait
was given as False
(so by default).
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.message_create
: Create a message with your client..webhook_message_edit
: Edit a message created by a webhook..webhook_message_delete
: Delete a message created by a webhook..webhook_message_get
: Get a message created by a webhook.
(webhook, message)
webhook_message_deleteDeletes the message sent by the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook who created the message. |
message |
| The webhook's message to delete. |
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If message
was detectably not sent by the webhook
.
See Also
.message_delete
: Delete a message..webhook_message_create
: Create a message with a webhook..webhook_message_edit
: Edit a message created by a webhook..webhook_message_get
: Get a message created by a webhook.
(webhook, message, ...)
webhook_message_editEdits the message sent by the given webhook. The message's author must be the webhook itself.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
webhook |
| The webhook who created the message. | ||
message |
| The webhook's message to edit. | ||
*positional_parameters | Positional parameters | Additional parameters to edit the message with. | ||
**keyword_parameters | Keyword parameters | Additional parameters to edit the message with. | ||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | ||
attachments |
| Attachments to send. | ||
components |
| Components attached to the message. Pass it as | ||
content |
| The new content of the message. | ||
embed |
| Alternative for | ||
embeds |
| The new embedded content of the message. By passing it as | ||
file |
| Alternative for | ||
files |
| Alternative for | ||
flags |
| The message's new flags. | ||
suppress_embeds |
| Whether the message's embeds should be suppressed or unsuppressed. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Embed messages ignore suppression with their endpoint, not like .message_edit
endpoint.
Editing the message with empty string is broken.
See Also
.message_edit
: Edit your own messages..webhook_message_create
: Create a message with a webhook..webhook_message_delete
: Delete a message created by a webhook..webhook_message_get
: Get a message created by a webhook.
(webhook, message_id)
webhook_message_getGets a previously sent message with the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook who created the message. |
message_id |
| The webhook's message's identifier to get. |
Returns
message : Message
Raises
TypeError
- If
webhook
was not given neither asWebhook
neither as atuple
(int
,str
). - If
message_id
was not given asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.message_get
: Get a message..webhook_message_create
: Create a message with a webhook..webhook_message_edit
: Edit a message created by a webhook..webhook_message_delete
: Delete a message created by a webhook.
(guild, ...)
welcome_screen_editEdits the given guild's welcome screen.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
guild |
| The guild, what's welcome screen will be edited. | ||
welcome_screen_template |
| Welcome screen to use as a template. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters to edit the welcome screen with. | ||
description |
| Description, of what is the server about. | ||
enabled |
| Whether the welcome screen should be enabled. | ||
welcome_channels |
| The featured channels by the welcome screen. |
Returns
welcome_screen : WelcomeScreen
Raises
TypeError
- If
guild
is notGuild
,int
. - If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(guild)
welcome_screen_getRequests the given guild's welcome screen.
You need to have manage guild
permission to request the welcome screen if the guild has it disabled.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild what's welcome screen will be requested. |
Returns
welcome_screen : WelcomeScreen
Raises
TypeError
- If
guild
is notGuild
,int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(data, guild_profile_data, guild_id)
_bypass_no_cacheSets a Client
's guild profile.
Only available when user or presence caching is disabled.
Parameter | Type | Description |
---|---|---|
data |
| Received user data. |
guild_profile_data |
| The user's guild profile's data. |
guild_id |
| A respective guild's identifier from where the user data was received. Picked up if the given data includes guild member data as well. |
Returns
user : ClientUserBase
(other)
_compare_attributesCompares the two user's user attributes (excluding id obviously).
Parameter | Type | Description |
---|---|---|
other |
| The other user. |
Returns
is_equal : bool
(other)
_compare_user_attributes_extendedCompares the two user's user attributes (excluding id obviously).
Parameter | Type | Description |
---|---|---|
other |
| The other user. |
Returns
is_equal : bool
()
_connectConnects the client's gateway(s) to Discord and reconnects them if needed.
This method is a coroutine.
(user_id)
_create_emptyCreates a user with its default attributes values set.
Parameter | Type | Description |
---|---|---|
user_id |
| The user's identifier. |
Returns
self : instance<cls>
(guild_datas, shard_id)
_delay_readyDelays the client's "ready" till it receives all of it guild's data. If caching is allowed (so by default), then it waits additional time till it requests all the members of it's guilds.
Parameter | Type | Description |
---|---|---|
guild_datas |
| Partial data for all the guilds to request the users of. |
shard_id |
| The received shard's identifier. |
()
_deleteClears up the client's references. By default this is not called when a client is stopped. This method should be used when you want to get rid of every allocated objects by the client. Take care, local modules might still have active references to the client or to some other objects, what could cause them to not garbage collect.
Raises
RuntimeError
If called when the client is still running.
Examples
>>> from hata import Client, GUILDS
>>> import gc
>>> TOKEN = 'a token goes here'
>>> client = Client(TOKEN)
>>> client.start()
>>> len(GUILDS)
4
>>> client.stop()
>>> client._delete()
>>> client = None
>>> gc.collect()
680
>>> len(GUILDS)
0
(data)
_difference_update_attributesUpdates the user and returns it's overwritten attributes as a dict
with a attribute-name
- old-value
relation.
Parameter | Type | Description |
---|---|---|
data |
| User data received from Discord. |
Returns
old_attributes : dict
of (str
, object
) items
All item in the returned dict is optional.
Returned Data Structure
Keys | Values | Applicable for |
---|---|---|
avatar | Icon | all |
avatar_decoration | None , AvatarDecoration | Client , User |
banner | Icon | Client , User |
banner_color | None , Color | Client , User |
channel_id | int | Webhook |
discriminator | int | Client , User |
display_name | None , str | Client , User |
None , str | Client | |
email_verified | bool | Client |
flags | UserFlag | Client , User |
locale | Locale | Client |
mfa_enabled | bool | Client |
name | str | all |
premium_type | PremiumType | Client |
(data)
_difference_update_presenceUpdates the user's presence and returns it's overwritten attributes as a dict
with a attribute-name
- old-value
relation. An exception from this is activities
, because that's a ActivityChange
containing all the changes of the user's activities.
Parameter | Type | Description |
---|---|---|
data |
| Received guild member data. |
Returns
old_attributes : dict
of (str
, object
) items
All item in the returned dict is optional.
Returned Data Structure
Keys | Values |
---|---|
activities | ActivityChange |
status | Status |
statuses | None , dict of (str , str ) items |
(data, guild)
_difference_update_profileTries to find the user's respective guild profile. If it cannot find it, creates it.
Parameter | Type | Description |
---|---|---|
data |
| Received guild profile data. |
guild | The respective guild of the profile to update. |
Returns
old_attributes : None | dict<str, object>
The changed attributes of the respective guild profile as a dict
with attribute-name
- old-attribute
relation.
May return None
indicating that the guild profile was not cached before so we cannot determine whether it would have been updated.
The possible keys and values within old_attributes
are all optional and they can be any of the following:
Keys | Values |
---|---|
avatar | Icon |
boosts_since | None , DateTime |
flags | None , GuildProfileFlags |
nick | None , str |
pending | bool |
role_ids | None , tuple of int |
timed_out_until | None , DateTime |
(client, include_internals)
_from_clientCreates a client alter ego.
Parameter | Type | Description |
---|---|---|
client | The client to copy. | |
include_internals |
| Whether internal fields should be copied as well. |
Returns
user : ClientUserBase
(data, guild)
_from_data_and_difference_update_profileFirst tries to find the user, then it's respective guild profile for the given guild to update it.
If the method cannot find the user, or the respective guild profile, then creates them.
Parameter | Type | Description |
---|---|---|
data |
| Received guild member data. |
guild | The respective guild of the profile to update. |
Returns
user : ClientUserBase
The respective user.
old_attributes : None | dict<str, object>
The changed attributes of the respective guild profile as a dict
with attribute-name
- old-attribute
relation.
May return None
indicating that the guild profile was not cached before so we cannot determine whether it would have been updated.
The possible keys and values within old_attributes
are all optional and they can be any of the following:
Keys | Values |
---|---|
avatar | Icon |
boosts_since | None , DateTime |
flags | None , GuildProfileFlags |
nick | None , str |
pending | bool |
role_ids | None , tuple of int |
timed_out_until | None , DateTime |
(data, guild)
_from_data_and_update_profileFirst tries to find the user, then it's respective guild profile for the given guild to update it.
If the method cannot find the user, or the respective guild profile, then creates them.
Not like ._from_data_and_difference_update_profile
, this method not calculates changes.
Parameter | Type | Description |
---|---|---|
data |
| Received guild member data. |
guild | The respective guild of the profile to update. |
Returns
user : ClientUserbase
The updated user.
()
_get_hash_partialReturns a partial user's hash value.
Returns
hash_value : int
(data)
_init_on_readyFills up the client's instance attributes on login. If there is an already existing User object with the same id, the client will replace it at channel participants, at USERS
weakreference dictionary, at guild.users
. This replacing is avoidable, if at the creation of the client the .client_id
parameter is set.
Parameter | Type | Description |
---|---|---|
data |
| Data requested from Discord by the |
Raises
RuntimeError
Creating the same client multiple times is not allowed.
(other)
_is_equal_same_typeReturns whether the two users are equal. self
and other
must be the same type.
Parameter | Type | Description |
---|---|---|
other |
| The other user. |
Returns
is_equal : bool
(channel, index)
_load_messages_tillAn internal function to load the messages at the given channel till the given index. Should not be called if the channel reached it's message history's end.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel | The channel from where the messages will be requested. | |
index |
| Till which index the messages should be requested at the given channel. |
Returns
result_state : int
can return the following variables describing a state:
Value | Description |
---|---|
0 | Success. |
1 | index could not be reached, there is no more messages at the channel. |
Raises
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
()
_maybe_replace_alter_egoReplaces the type User
alter_ego of the client if applicable.
(guild_id)
_request_usersRequests the members of the given guild. Called when the client joins a guild and user caching is enabled (so by default).
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild_id |
| The guild, what's members will be requested. |
(item)
_role_reorder_roles_element_validatorValidates a role-position pair.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
item |
| A |
Yields
item : None
, tuple
(Role
, Guild
, int
)
Returns
role : Role
The validated role.
guild : None, Guild
The role's guild.
Raises
TypeError
If item
has invalid format.
(roles)
_role_reorder_roles_validatorValidates roles
parameter of .role_reorder
.
This method is an asynchronous generator.
Parameter | Type | Description |
---|---|---|
roles | ( | A |
Yields
item : None
, tuple
(Role
, Guild
, int
)
Raises
TypeError
If roles
's format is not any of the expected ones.
()
_set_default_attributesSets the user's attribute's to their default.
(data)
_update_attributesUpdates the user with the given data by overwriting it's old attributes.
Parameter | Type | Description |
---|---|---|
data |
| User data received from Discord. |
(data)
_update_presenceUpdates the user's presences with the given data.
Parameter | Type | Description |
---|---|---|
data |
| Received guild member data. |
(data, guild)
_update_profileTries to find the user's respective guild profile. If it cannot find it, creates it.
Parameter | Type | Description |
---|---|---|
data |
| Received guild profile data. |
guild | The respective guild of the profile to update. |
Returns
updated : bool
Returns True
if the guild profile was updated and False
when created.
()
__eq__Return whether the user's id is equal to the other.
(code)
__format__Formats the user in a format string.
Parameter | Type | Description |
---|---|---|
code |
| The option on based the result will be formatted. |
Returns
user : str
Raises
ValueError
Unknown format code.
Examples
>>> from hata import User, now_as_id
>>> user = User.precreate(now_as_id(), name = 'Neko', discriminator = 2012)
>>> user
<User id = 730233383967260672, name = 'Neko#2012'>
>>> # no code stands for `user.name`.
>>> f'{user}'
'Neko'
>>> # 'f' stands for full name
>>> f'{user:f}'
'Neko#2012'
>>> # 'm' stands for mention.
>>> f'{user:m}'
'<@730233383967260672>'
>>> # 'c' stands for created at.
>>> f'{user:c}'
'2020.07.08-01:26:45'
()
__ge__Returns whether the user's id is greater or equal to the other.
()
__getattr__Drops a rich attribute error.
()
__gt__Returns whether the user's id is greater than the other's.
()
__hash__Returns the user's hash.
()
__le__Returns whether the user's id is less or equal to the other.
()
__lt__Returns whether the user's id is less than the other's.
()
__ne__Returns whether the user's id is different as the other's.
()
__repr__Returns the user's representation.