Module: Discordrb::UserAttributes
- Included in:
- Light::LightProfile, User
- Defined in:
- lib/discordrb/data.rb
Overview
Mixin for the attributes users should have
Instance Attribute Summary collapse
-
#avatar_id ⇒ String
readonly
The ID of this user's current avatar, can be used to generate an avatar URL.
-
#bot_account ⇒ true, false
(also: #bot_account?)
readonly
Whether this user is a Discord bot account.
-
#discriminator ⇒ String
(also: #discrim, #tag, #discord_tag)
readonly
This user's discriminator which is used internally to identify users with identical usernames.
-
#username ⇒ String
(also: #name)
readonly
This user's username.
Instance Method Summary collapse
-
#avatar_url ⇒ String
Utility function to get a user's avatar URL.
-
#distinct ⇒ String
Utility function to get Discord's distinct representation of a user, i.
-
#mention ⇒ String
Utility function to mention users in messages.
Instance Attribute Details
#avatar_id ⇒ String (readonly)
Returns the ID of this user's current avatar, can be used to generate an avatar URL.
103 104 105 |
# File 'lib/discordrb/data.rb', line 103 def avatar_id @avatar_id end |
#bot_account ⇒ true, false (readonly) Also known as: bot_account?
Returns whether this user is a Discord bot account.
98 99 100 |
# File 'lib/discordrb/data.rb', line 98 def bot_account @bot_account end |
#discriminator ⇒ String (readonly) Also known as: discrim, tag, discord_tag
Returns this user's discriminator which is used internally to identify users with identical usernames.
92 93 94 |
# File 'lib/discordrb/data.rb', line 92 def discriminator @discriminator end |
#username ⇒ String (readonly) Also known as: name
Returns this user's username.
88 89 90 |
# File 'lib/discordrb/data.rb', line 88 def username @username end |
Instance Method Details
#avatar_url ⇒ String
Utility function to get a user's avatar URL.
119 120 121 |
# File 'lib/discordrb/data.rb', line 119 def avatar_url API.avatar_url(@id, @avatar_id) end |
#distinct ⇒ String
Utility function to get Discord's distinct representation of a user, i. e. username + discriminator
113 114 115 |
# File 'lib/discordrb/data.rb', line 113 def distinct "#{@username}##{@discriminator}" end |
#mention ⇒ String
Utility function to mention users in messages
107 108 109 |
# File 'lib/discordrb/data.rb', line 107 def mention "<@#{@id}>" end |