Class: MijDiscord::Events::StartTyping

Inherits:
Generic show all
Defined in:
lib/mij-discord/events/message.rb

Instance Attribute Summary collapse

Attributes inherited from Generic

#bot

Instance Method Summary collapse

Methods inherited from EventBase

delegate_method, filter_match, inherited, #trigger?

Constructor Details

#initialize(bot, data) ⇒ StartTyping

Returns a new instance of StartTyping.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/mij-discord/events/message.rb', line 91

def initialize(bot, data)
  super(bot)

  @timestamp = Time.at(data['timestamp'].to_i).utc
  @channel = @bot.channel(data['channel_id'])

  @user = if @channel.pm?
    @channel.recipient
  elsif @channel.group?
    @bot.user(data['user_id'])
  else
    @bot.member(@channel.server, data['user_id'])
  end
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



70
71
72
# File 'lib/mij-discord/events/message.rb', line 70

def channel
  @channel
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



75
76
77
# File 'lib/mij-discord/events/message.rb', line 75

def timestamp
  @timestamp
end

#userObject (readonly) Also known as: author

Returns the value of attribute user.



72
73
74
# File 'lib/mij-discord/events/message.rb', line 72

def user
  @user
end