Member

discord_http.member module

class discord_http.member.Member(*, state: DiscordAPI, guild: PartialGuild, data: dict)[source]

Bases: PartialMember

property avatar_decoration: Asset | None

Returns the avatar decoration of the member

Type:

Optional[Asset]

property banner: Asset | None

Returns the banner of the member if available

Type:

Optional[Asset]

property bot: bool

Returns whether the member is a bot

Type:

bool

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

Return type:

Optional[str]

property display_avatar: Asset | None

Returns the display avatar of the member

Type:

Optional[Asset]

property display_name: str

Returns the display name of the member

Type:

str

get_role(role: Snowflake | int) PartialRole | None[source]

Get a role from the member

Parameters:

role (Union[Snowflake, int]) – The role to get. Can either be a role object or the Role ID

Returns:

The role if found, else None

Return type:

Optional[PartialRole]

property global_avatar: Asset | None

Shortcut for User.avatar

Type:

Optional[Asset]

property global_banner: Asset | None

Shortcut for User.banner

Type:

Optional[Asset]

property global_name: str | None

Gives the global display name of a member if available

Type:

Optional[str]

has_permissions(*args: str) bool[source]

Check if a member has a permission

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

Parameters:

*args (str) – Permissions to check

Returns:

Whether the member has the permission(s)

Return type:

bool

property name: str

Returns the username of the member

Type:

str

property public_flags: PublicFlags

Returns the public flags of the member

Type:

int

property resolved_permissions: Permissions

Permissions Returns permissions from an interaction.

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

property system: bool

Returns whether the member is a system user

Type:

bool

class discord_http.member.PartialMember(*, state: DiscordAPI, id: int, guild_id: int)[source]

Bases: PartialBase

async add_roles(*roles: PartialRole | int, reason: str | None = None) None[source]

Add roles to someone

Parameters:
  • *roles (Union[PartialRole, int]) – Roles to add to the member

  • reason (Optional[str]) – The reason for adding the roles

  • reason – The reason for adding the roles

async ban(*, reason: str | None = None, delete_message_days: int | None = 0, delete_message_seconds: int | None = 0) None[source]

Ban the user

Parameters:
  • reason (Optional[str]) – The reason for banning the user

  • delete_message_days (Optional[int]) – How many days of messages to delete

  • delete_message_seconds (Optional[int]) – 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

async create_dm() DMChannel[source]

DMChannel: Create a DM channel with the user

async edit(*, nick: str | None = <MISSING>, roles: list[~discord_http.role.PartialRole | int] | None = <MISSING>, mute: bool | None = <MISSING>, deaf: bool | None = <MISSING>, communication_disabled_until: ~datetime.timedelta | ~datetime.datetime | int | None = <MISSING>, channel_id: int | None = <MISSING>, reason: str | None = None) Member[source]

Edit the member

Parameters:
  • nick (Optional[str]) – The new nickname of the member

  • roles (Optional[list[Union[PartialRole, int]]]) – Roles to make the member have

  • mute (Optional[bool]) – Whether to mute the member

  • deaf (Optional[bool]) – Whether to deafen the member

  • communication_disabled_until (Optional[Union[timedelta, datetime, int]]) – How long to disable communication for (timeout)

  • channel_id (Optional[int]) – The channel ID to move the member to

  • reason (Optional[str]) – The reason for editing the member

Returns:

The edited member

Return type:

Member

Raises:

TypeError

  • If communication_disabled_until is not timedelta, datetime, or int

async edit_voice_state(channel: ~discord_http.object.Snowflake, *, suppress: bool = <MISSING>) None[source]

Updates another user’s voice state in a stage channel

Parameters:
  • channel (Snowflake) – The channel that the member is in (it must be the same channel as the current one)

  • suppress (bool) – Whether to suppress the user

async fetch() Member[source]

Fetch: Fetches the member from the API

async fetch_voice_state() VoiceState[source]

Fetches the voice state of the member

Returns:

The voice state of the member

Return type:

VoiceState

Raises:

NotFound

  • If the member is not in the guild - If the member is not in a voice channel

property guild: PartialGuild

The guild of the member

Type:

PartialGuild

async kick(*, reason: str | None = None) None[source]

Kick the user

Parameters:

reason (Optional[str]) – The reason for kicking the user

property mention: str

The mention of the member

Type:

str

async remove_roles(*roles: PartialRole | int, reason: str | None = None) None[source]

Remove roles from someone

Parameters:

reason (Optional[str]) – The reason for removing the roles

async send(content: str | None = <MISSING>, *, channel_id: int | None = <MISSING>, embed: ~discord_http.embeds.Embed | None = <MISSING>, embeds: list[~discord_http.embeds.Embed] | None = <MISSING>, file: ~discord_http.file.File | None = <MISSING>, files: list[~discord_http.file.File] | None = <MISSING>, view: ~discord_http.view.View | None = <MISSING>, tts: bool | None = False, type: ~discord_http.enums.ResponseType | int = 4, allowed_mentions: ~discord_http.mentions.AllowedMentions | None = <MISSING>) Message[source]

Send a message to the user

Parameters:
  • content (Optional[str]) – Content of the message

  • channel_id (Optional[int]) – Channel ID of the user, leave empty to create a DM

  • embed (Optional[Embed]) – Embed of the message

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

  • file (Optional[File]) – File of the message

  • files (Optional[Union[list[File], File]]) – Files of the message

  • view (Optional[View]) – Components to add to the message

  • tts (Optional[bool]) – Whether the message should be sent as TTS

  • type (Optional[ResponseType]) – Type of the message

  • allowed_mentions (Optional[AllowedMentions]) – Allowed mentions of the message

Returns:

The message sent

Return type:

Message

async unban(*, reason: str | None = None) None[source]

Unban the user

Parameters:

reason (Optional[str]) – The reason for unbanning the user

class discord_http.member.ThreadMember(*, state: DiscordAPI, data: dict)[source]

Bases: PartialBase

class discord_http.member.VoiceState(*, state: DiscordAPI, data: dict)[source]

Bases: object

async edit(*, suppress: bool = <MISSING>) None[source]

Updates the voice state of the member

Parameters:

suppress (bool) – Whether to suppress the user