View Source Nostrum.Struct.Guild.Member (Nostrum v0.6.1)
Struct representing a Discord guild member.
A Nostrum.Struct.Guild.Member
stores a Nostrum.Struct.User
's properties
pertaining to a specific Nostrum.Struct.Guild
.
Mentioning Members in Messages
A Nostrum.Struct.Guild.Member
can be mentioned in message content using the String.Chars
protocol or mention/1
.
member = %Nostrum.Struct.Guild.Member{user: Nostrum.Struct.User{id: 120571255635181568}}
Nostrum.Api.create_message!(184046599834435585, "#{member}")
%Nostrum.Struct.Message{content: "<@120571255635181568>"}
member = %Nostrum.Struct.Guild.Member{user: Nostrum.Struct.User{id: 89918932789497856}}
Nostrum.Api.create_message!(280085880452939778, "#{Nostrum.Struct.Guild.Member.mention(member)}")
%Nostrum.Struct.Message{content: "<@89918932789497856>"}
Link to this section Summary
Types
Current timeout status of the user. If user is currently timed out this will be a DateTime.t/0
of the unmute time, it will be nil
or a date in the past if the user is not currently timed out.
Whether the user is deafened.
If you dont request offline guild members this field will be nil
for any members that come online.
Date the user joined the guild.
If you dont request offline guild members this field will be nil
for any members that come online.
Whether the user is muted.
If you dont request offline guild members this field will be nil
for any members that come online.
The nickname of the user
Current guild booster status of the user. If user is currently boosting a guild this will be a DateTime.t/0
since the start of the boosting, it will be nil
if the user is not currently boosting the guild.
A list of role ids
The user struct. This field can be nil
if the Member struct came as a partial Member object included
in a message received from a guild channel.
Functions
Returns a member's permissions in a guild channel, based on its Nostrum.Struct.Overwrite
s.
Returns a member's guild permissions.
Formats a Nostrum.Struct.Guild.Member
into a mention.
Return the topmost role of the given member on the given guild.
Link to this section Types
Specs
communication_disabled_until() :: DateTime.t() | nil
Current timeout status of the user. If user is currently timed out this will be a DateTime.t/0
of the unmute time, it will be nil
or a date in the past if the user is not currently timed out.
Specs
deaf() :: boolean() | nil
Whether the user is deafened.
If you dont request offline guild members this field will be nil
for any members that come online.
Specs
joined_at() :: String.t() | nil
Date the user joined the guild.
If you dont request offline guild members this field will be nil
for any members that come online.
Specs
mute() :: boolean() | nil
Whether the user is muted.
If you dont request offline guild members this field will be nil
for any members that come online.
Specs
nick() :: String.t() | nil
The nickname of the user
Specs
roles() :: [Nostrum.Struct.Guild.Role.id()]
A list of role ids
Specs
t() :: %Nostrum.Struct.Guild.Member{ communication_disabled_until: communication_disabled_until(), deaf: deaf(), joined_at: joined_at(), mute: mute(), nick: nick(), premium_since: premium_since(), roles: roles(), user: user() }
Specs
user() :: Nostrum.Struct.User.t() | nil
The user struct. This field can be nil
if the Member struct came as a partial Member object included
in a message received from a guild channel.
Link to this section Functions
Specs
guild_channel_permissions( t(), Nostrum.Struct.Guild.t(), Nostrum.Struct.Channel.id() ) :: [ Nostrum.Permission.t() ]
Returns a member's permissions in a guild channel, based on its Nostrum.Struct.Overwrite
s.
Examples
guild = Nostrum.Cache.GuildCache.get!(279093381723062272)
member = Map.get(guild.members, 177888205536886784)
channel_id = 381889573426429952
Nostrum.Struct.Guild.Member.guild_channel_permissions(member, guild, channel_id)
#=> [:manage_messages]
Specs
guild_permissions(t(), Nostrum.Struct.Guild.t()) :: [Nostrum.Permission.t()]
Returns a member's guild permissions.
Examples
guild = Nostrum.Cache.GuildCache.get!(279093381723062272)
member = Map.get(guild.members, 177888205536886784)
Nostrum.Struct.Guild.Member.guild_permissions(member, guild)
#=> [:administrator]
Specs
Formats a Nostrum.Struct.Guild.Member
into a mention.
Examples
iex> member = %Nostrum.Struct.Guild.Member{user: %Nostrum.Struct.User{id: 177888205536886784}}
...> Nostrum.Struct.Guild.Member.mention(member)
"<@177888205536886784>"
Specs
top_role(t(), Nostrum.Struct.Guild.t()) :: Nostrum.Struct.Guild.Role.t() | nil
Return the topmost role of the given member on the given guild.
The topmost role is determined via t:Nostrum.Struct.Guild.Role.position
.
Parameters
member
: The member whose top role to return.guild
: The guild which the member belongs to.
Return value
The topmost role of the member on the given guild, if the member has roles
assigned. Otherwise, nil
is returned.