class Discorb::Webhook::Message::Author

Represents an author of webhook message.

Attributes

avatar[R]

@return [Discorb::Asset] The avatar of the author.

bot[R]

@return [Boolean] Whether the author is a bot. @note This will be always `true`.

bot?[R]

@return [Boolean] Whether the author is a bot. @note This will be always `true`.

discriminator[R]

@return [String] The discriminator of the author.

id[R]

@return [Discorb::Snowflake] The ID of the author.

name[R]

@return [String] The name of the author.

username[R]

@return [String] The name of the author.

Public Class Methods

new(data) click to toggle source

@!visibility private

# File lib/discorb/webhook.rb, line 375
def initialize(data)
  @data = data
  @bot = data[:bot]
  @id = Snowflake.new(data[:id])
  @username = data[:username]
  @avatar = data[:avatar] ? Asset.new(self, data[:avatar]) : DefaultAvatar.new(data[:discriminator])
  @discriminator = data[:discriminator]
end

Public Instance Methods

to_s() click to toggle source

Format author with `Name#Discriminator` style.

@return [String] Formatted author.

# File lib/discorb/webhook.rb, line 389
def to_s
  "#{@username}##{@discriminator}"
end
Also aliased as: to_s_user
to_s_user()
Alias for: to_s