module Discordrb::UserAttributes
Mixin for the attributes users should have
Attributes
@return [String] the ID of this user's current avatar, can be used to generate an avatar URL. @see avatar_url
@return [true, false] whether this user is a Discord bot account
@return [true, false] whether this user is a Discord bot account
@return [String] this user's discriminator which is used internally to identify users with identical usernames.
@return [String] this user's discriminator which is used internally to identify users with identical usernames.
@return [String] this user's discriminator which is used internally to identify users with identical usernames.
@return [String] this user's username
@return [String] this user's discriminator which is used internally to identify users with identical usernames.
@return [String] this user's username
Public Instance Methods
Utility function to get a user's avatar URL. @param format [String, nil] If `nil`, the URL will default to `webp` for static avatars, and will detect if the user has a `gif` avatar. You can otherwise specify one of `webp`, `jpg`, `png`, or `gif` to override this. Will always be PNG for default avatars. @return [String] the URL to the avatar image.
# File lib/discordrb/data.rb, line 140 def avatar_url(format = nil) return API::User.default_avatar(@discriminator) unless @avatar_id API::User.avatar_url(@id, @avatar_id, format) end
Utility function to get Discord's distinct representation of a user, i.e. username + discriminator @return [String] distinct representation of user
# File lib/discordrb/data.rb, line 133 def distinct "#{@username}##{@discriminator}" end
Utility function to mention users in messages @return [String] the mention code in the form of <@id>
# File lib/discordrb/data.rb, line 127 def mention "<@#{@id}>" end