Member Models#

class interactions.api.models.member.Member(kwargs_dict=None, /, **other_kwargs)[स्रोत]#

A class object representing the user of a guild, known as a "member."

टिप्पणी

pending and permissions only apply for members retroactively requiring to verify rules via. membership screening or lack permissions to speak.

चर पद :
  • user (User) -- The user of the guild.

  • nick (str) -- The nickname of the member.

  • avatar (Optional[str]) -- The hash containing the user's guild avatar, if applicable.

  • roles (List[int]) -- The list of roles of the member.

  • joined_at (datetime) -- The timestamp the member joined the guild at.

  • premium_since (datetime) -- The timestamp the member has been a server booster since.

  • deaf (bool) -- Whether the member is deafened.

  • mute (bool) -- Whether the member is muted.

  • flags (MemberFlags) -- The guild member flags. Default to 0.

  • pending (Optional[bool]) -- Whether the member is pending to pass membership screening.

  • permissions (Optional[Permissions]) -- Whether the member has permissions.

  • communication_disabled_until (Optional[str]) -- How long until they're unmuted, if any.

property voice_state: VoiceState | None#

संस्करण 4.4.0 से नया .

Returns the current voice state of the member, if any.

प्रदत्त प्रकार :

VoiceState

property guild: Guild | None#

संस्करण 4.4.0 से नया .

Attempts to get the guild the member is in. Only works then roles or nick or joined at is present and the guild is cached.

प्रदत्त :

The guild this member belongs to.

प्रदत्त प्रकार :

Guild

property guild_id: Snowflake | LibraryException | None#

संस्करण 4.3.2 से नया .

Attempts to get the guild ID the member is in. Only works when roles or nick or joined at is present and the guild is cached.

प्रदत्त :

The ID of the guild this member belongs to.

प्रदत्त प्रकार :

Optional[Union[Snowflake, LibraryException]]

property avatar: str | None#

Returns the user's avatar hash, if any.

property id: Snowflake#

संस्करण 4.1.0 से नया .

Returns the ID of the user.

प्रदत्त :

The ID of the user

प्रदत्त प्रकार :

Snowflake

property mention: str#

संस्करण 4.1.0 से नया .

Returns a string that allows you to mention the given member.

प्रदत्त :

The string of the mentioned member.

प्रदत्त प्रकार :

str

property name: str#

संस्करण 4.2.0 से नया .

Returns the string of either the user's nickname or username.

प्रदत्त :

The name of the member

प्रदत्त प्रकार :

str

async ban(guild_id=<interactions.MISSING>, seconds=0, minutes=<interactions.MISSING>, hours=<interactions.MISSING>, days=<interactions.MISSING>, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

संस्करण 4.3.2 से अलग : Method has been aligned to changes in the Discord API. You can now input days, hours, minutes and seconds, as long as it doesn't exceed 604800 seconds in total for deleting messages, instead of only days.

संस्करण 4.3.2 से अलग : guild_id is no longer required

Bans the member from a guild.

मापदण्ड:
  • guild_id (Optional[Union[int, Snowflake, Guild]]) -- The id of the guild to ban the member from

  • seconds (Optional[int]) -- Number of seconds to delete messages, from 0 to 604800. Defaults to 0

  • minutes (Optional[int]) -- Number of minutes to delete messages, from 0 to 10080

  • hours (Optional[int]) -- Number of hours to delete messages, from 0 to 168

  • days (Optional[int]) -- Number of days to delete messages, from 0 to 7

  • reason (Optional[str]) -- The reason of the ban

async kick(guild_id=<interactions.MISSING>, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

संस्करण 4.3.2 से अलग : guild_id is no longer required.

Kicks the member from a guild.

मापदण्ड:
  • guild_id (Optional[Union[int, Snowflake, Guild]]) -- The id of the guild to kick the member from

  • reason (Optional[str]) -- The reason for the kick

async add_role(role, guild_id=<interactions.MISSING>, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

संस्करण 4.3.2 से अलग : guild_id is no longer required.

This method adds a role to a member.

मापदण्ड:
  • role (Union[Role, int, Snowflake]) -- The role to add. Either Role object or role_id

  • guild_id (Optional[Union[int, Snowflake, Guild]]) -- The id of the guild to add the roles to the member

  • reason (Optional[str]) -- The reason why the roles are added

async remove_role(role, guild_id=<interactions.MISSING>, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

संस्करण 4.3.2 से अलग : guild_id is no longer required.

This method removes a role from a member.

मापदण्ड:
  • role (Union[Role, int]) -- The role to remove. Either Role object or role_id

  • guild_id (Optional[Union[int, Snowflake, Guild]]) -- The id of the guild to remove the roles of the member

  • reason (Optional[str]) -- The reason why the roles are removed

async send(content=<interactions.MISSING>, *, components=<interactions.MISSING>, tts=<interactions.MISSING>, attachments=<interactions.MISSING>, files=<interactions.MISSING>, embeds=<interactions.MISSING>, allowed_mentions=<interactions.MISSING>)[स्रोत]#

संस्करण 4.0.2 से नया .

Sends a DM to the member.

मापदण्ड:
  • content (Optional[str]) -- The contents of the message as a string or string-converted value.

  • components (Optional[Union[ActionRow, Button, SelectMenu, List[ActionRow], List[Button], List[SelectMenu]]]) -- A component, or list of components for the message.

  • tts (Optional[bool]) -- Whether the message utilizes the text-to-speech Discord programme or not.

  • attachments (Optional[List[Attachment]]) --

    संस्करण 4.3.0 से नया .

    The attachments to attach to the message. Needs to be uploaded to the CDN first

  • files (Optional[Union[File, List[File]]]) --

    संस्करण 4.2.0 से नया .

    A file or list of files to be attached to the message.

  • embeds (Optional[Union[Embed, List[Embed]]]) -- An embed, or list of embeds for the message.

  • allowed_mentions (Optional[Union[AllowedMentions, dict]]) -- The allowed mentions for the message.

प्रदत्त :

The sent message as an object.

प्रदत्त प्रकार :

Message

async modify(guild_id=<interactions.MISSING>, nick=<interactions.MISSING>, roles=<interactions.MISSING>, mute=<interactions.MISSING>, deaf=<interactions.MISSING>, channel_id=<interactions.MISSING>, communication_disabled_until=<interactions.MISSING>, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

संस्करण 4.3.2 से अलग : guild_id is no longer required.

Modifies the member of a guild.

मापदण्ड:
  • guild_id (Optional[Union[int, Snowflake, Guild]]) -- The id of the guild to modify the member on

  • nick (Optional[str]) -- The nickname of the member

  • roles (Optional[List[int]]) -- A list of all role ids the member has

  • mute (Optional[bool]) -- whether the user is muted in voice channels

  • deaf (Optional[bool]) -- whether the user is deafened in voice channels

  • channel_id (Optional[Union[Channel, int, Snowflake]]) -- id of channel to move user to (if they are connected to voice)

  • communication_disabled_until (Optional[datetime.isoformat]) -- when the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future)

  • reason (Optional[str]) -- The reason of the modifying

प्रदत्त :

The modified member object

प्रदत्त प्रकार :

Member

async add_to_thread(thread_id)[स्रोत]#

संस्करण 4.0.2 से नया .

Adds the member to a thread.

मापदण्ड:

thread_id (Union[int, Snowflake, Channel]) -- The id of the thread to add the member to

get_avatar_url(guild_id=<interactions.MISSING>)[स्रोत]#

संस्करण 4.2.0 से नया .

संस्करण 4.3.0 से अलग : Has been renamed to get_avatar_url instead of get_member_avatar_url

संस्करण 4.3.2 से अलग : guild_id is no longer required.

Returns the URL of the member's avatar for the specified guild.

मापदण्ड:

guild_id (Optional[Union[int, Snowflake, Guild]]) -- The id of the guild to get the member's avatar from

प्रदत्त :

URL of the members's avatar (None will be returned if no avatar is set)

प्रदत्त प्रकार :

str

async get_guild_permissions(guild_id=<interactions.MISSING>)[स्रोत]#

संस्करण 4.3.2 से नया .

Returns the permissions of the member for the specified guild.

टिप्पणी

The permissions returned by this function will not take into account role and user overwrites that can be assigned to channels or categories. If you need these overwrites, look into Channel.get_permissions_for().

मापदण्ड:

guild (Guild) -- The guild of the member

प्रदत्त :

Base permissions of the member in the specified guild

प्रदत्त प्रकार :

Permissions

async has_permissions(*permissions, channel=<interactions.MISSING>, guild_id=<interactions.MISSING>, operator='and')[स्रोत]#

संस्करण 4.3.2 से नया .

Returns whether the member has the permissions passed.

टिप्पणी

If the channel argument is present, the function will look if the member has the permissions in the specified channel. If the argument is missing, then it will only consider the member's guild permissions.

मापदण्ड:
  • *permissions (Union[int, Permissions]) -- The list of permissions

  • channel (Channel) -- The channel where to check for permissions

  • guild_id (Optional[Union[int, Snowflake, Guild]]) -- The id of the guild

  • operator (Optional[str]) -- The operator to use to calculate permissions. Possible values: and, or. Defaults to and.

प्रदत्त :

Whether the member has the permissions

प्रदत्त प्रकार :

bool