ClientCompoundGuildBanEndpoints

Methods

__new__()

Compound components do not support instancing.

Sub-typing is supported, but the attributes are only proxied. Sub-types have no meaning by themselves.

Raises

RuntimeError

guild_ban_add(guild, user, ...)

Bans the given user from the guild.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
guild

Guild, int

The guild from where the user will be banned.

user

ClientUserBase, int

The user to ban from the guild.

delete_message_duration

int

0

How much seconds back the user's messages should be deleted. Can be in range [0:604800].

reason

None, str

None

Shows up at the guild's audit logs.

Raises

TypeError

  • If guild was not given neither as Guild nor int.
  • If user was not given neither as ClientUserBase, nor int.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

guild_ban_delete(guild, user, ...)

Unbans the user from the given guild.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
guild

Guild, int

The guild from where the user will be unbanned.

user

ClientUserBase, int

The user to unban at the guild.

reason

None, str

None

Shows up at the guild's audit logs.

Raises

TypeError

  • If guild was not given neither as Guild nor int.
  • If user was not given neither as ClientUserBase, nor int.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

guild_ban_get(guild, user)

Returns the guild's ban entry for the given user id.

This method is a coroutine.

ParameterTypeDescription
guild

Guild, int

The guild where the user banned.

user

ClientUserBase, int

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 as Guild, int.
  • If user was not given neither as ClientUserBase, int.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

guild_ban_get_all(guild)

Returns the guild's ban entries.

This method might need multiple requests to complete it's task

This method is a coroutine.

ParameterTypeDescription
guild

Guild, int

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_ban_get_chunk(guild, ...)

Returns a chunk of the guild's ban entries.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
guild

Guild, int

The guild, what's bans will be requested

after

None, int, DiscordEntity, datetime

None

The timestamp after the banned users were created.

before

None, int, DiscordEntity, datetime

None

The timestamp before the banned users were created.

limit

int

0

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 as Guild, 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.