Member

discord_http.member module

class discord_http.member.Member(*, state, guild, data)

Bases: PartialMember

Parameters:
property avatar_decoration: Asset | None

Returns the avatar decoration of the member.

property bot: bool

Returns whether the member is a bot.

property discriminator: str | None

Gives the discriminator of the member if available.

Returns:

  • Discriminator of a user who has yet to convert or a bot account.

  • If the user has converted to the new username, this will return None

property display_avatar: Asset

Returns the display avatar of the member.

property display_banner: Asset | None

Returns the display banner of the member.

property display_name: str

Returns the display name of the member.

get_role(role) PartialRole | None

Get a role from the member.

Parameters:

role (Snowflake | int) – The role to get. Can either be a role object or the Role ID

Return type:

PartialRole | None

Returns:

The role if found, else None

property global_avatar: Asset | None

Shortcut for User.avatar.

property global_banner: Asset | None

Shortcut for User.banner.

property global_name: str | None

Gives the global display name of a member if available.

property guild_permissions: Permissions

Returns the guild permissions of the member.

This is only available if you are using gateway with guild cache.

has_permissions(*args) bool

Check if a member has a permission.

Will be False if used in Member.fetch() every time

Parameters:

*args (str) – Permissions to check

Return type:

bool

Returns:

Whether the member has the permission(s)

is_timed_out() bool

Returns whether the member is timed out or not.

Return type:

bool

property name: str

Returns the username of the member.

property public_flags: UserFlags

Returns the public flags of the member.

property resolved_permissions: Permissions

Permissions Returns permissions from an interaction.

Will always be Permissions.none() if used in Member.fetch()

property roles: list[Role | PartialRole]

Returns the roles of the member.

property system: bool

Returns whether the member is a system user.

property top_role: PartialRole | Role | None

Returns the top role of the member.

Only usable if you are using gateway and caching

class discord_http.member.PartialMember(*, state, id, guild_id)

Bases: PartialBase

Parameters:
async add_roles(*roles, reason=None) None

Add roles to someone.

Parameters:
  • *roles (PartialRole | int) – Roles to add to the member

  • reason (str | None) – The reason for adding the roles

Return type:

None

async ban(*, reason=None, delete_message_days=0, delete_message_seconds=0) None

Ban the user.

Parameters:
  • reason (str | None) – The reason for banning the user

  • delete_message_days (int | None) – How many days of messages to delete

  • delete_message_seconds (int | None) – How many seconds of messages to delete

Raises:

ValueError

  • If delete_message_days and delete_message_seconds are both specified - If delete_message_days is not between 0 and 7 - If delete_message_seconds is not between 0 and 604,800

Return type:

None

async create_dm() DMChannel

Create a DM channel with the user.

Return type:

DMChannel

property default_avatar: Asset

Alias for User.default_avatar.

async edit(*, nick=<MISSING>, roles=<MISSING>, mute=<MISSING>, deaf=<MISSING>, communication_disabled_until=<MISSING>, channel_id=<MISSING>, reason=None) Member

Edit the member.

Parameters:
  • nick (str | None) – The new nickname of the member

  • roles (list[PartialRole | int] | None) – Roles to make the member have

  • mute (bool | None) – Whether to mute the member

  • deaf (bool | None) – Whether to deafen the member

  • communication_disabled_until (timedelta | datetime | int | None) – How long to disable communication for (timeout)

  • channel_id (int | None) – The channel ID to move the member to

  • reason (str | None) – The reason for editing the member

Return type:

Member

Returns:

The edited member

Raises:

TypeError

  • If communication_disabled_until is not timedelta, datetime, or int

async fetch() Member

Fetches the member from the API.

Return type:

Member

property guild: Guild | PartialGuild

The guild of the member.

If you are using gateway cache, it can return full object too

async kick(*, reason=None) None

Kick the user.

Parameters:

reason (str | None) – The reason for kicking the user

Return type:

None

property mention: str

The mention of the member.

async remove_roles(*roles, reason=None) None

Remove roles from someone.

Parameters:
  • *roles (PartialRole | int) – Roles to remove from the member

  • reason (str | None) – The reason for removing the roles

Return type:

None

async send(content=<MISSING>, *, channel_id=<MISSING>, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, flags=<MISSING>, allowed_mentions=<MISSING>, delete_after=None) Message

Send a message to the user.

Parameters:
  • content (str | None) – Content of the message

  • channel_id (int | None) – Channel ID of the user, leave empty to create a DM

  • embed (Embed | None) – Embed of the message

  • embeds (list[Embed] | None) – Embeds of the message

  • file (File | None) – File of the message

  • files (list[File] | None) – Files of the message

  • view (View | None) – Components to add to the message

  • tts (bool | None) – Whether the message should be sent as TTS

  • type (ResponseType | int) – Type of the message

  • flags (MessageFlags | None) – Flags of the message

  • allowed_mentions (AllowedMentions | None) – Allowed mentions of the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message sent

async unban(*, reason=None) None

Unban the user.

Parameters:

reason (str | None) – The reason for unbanning the user

Return type:

None

class discord_http.member.ThreadMember(*, state, guild, data) None

Bases: Member

Parameters:
property thread: PartialChannel | Thread

The thread the member is in.