Blacklist

The blacklist can be managed within Discord using the /admin commands. However, if you want to manage the blacklist in your own code, you can use these functions.

Warning

These methods can only be used after the blacklist has been activated with add_blacklist().

async ezcord.blacklist.get_bans()[source]

Get all banned user IDs.

Return type:

list[int]

async ezcord.blacklist.get_full_bans()[source]

Get all information about banned users.

Return type:

list[tuple[int, str | None, str]]

Returns:

A list of tuples containing the user ID, ban reason, and date of the ban.

async ezcord.blacklist.add_ban(user_id, reason=None)[source]

Ban a user.

Parameters:
  • user_id (int) – The user ID to ban

  • reason (str | None) – The reason for the ban

Returns:

True if the user was banned successfully, False otherwise

Return type:

bool

async ezcord.blacklist.remove_ban(user_id)[source]

Unban a user.

Parameters:

user_id (int) – The user ID to unban

Returns:

True if the user was unbanned successfully, False otherwise

Return type:

bool