class Discordrb::Events::TypingEvent

Event raised when a user starts typing

Attributes

channel[R]

@return [Channel] the channel on which a user started typing.

member[R]

@return [User, Member, Recipient] the user that started typing.

timestamp[R]

@return [Time] when the typing happened.

user[R]

@return [User, Member, Recipient] the user that started typing.

Public Class Methods

new(data, bot) click to toggle source
# File lib/discordrb/events/typing.rb, line 20
def initialize(data, bot)
  @bot = bot

  @user_id = data['user_id'].to_i

  @channel_id = data['channel_id'].to_i
  @channel = bot.channel(@channel_id)

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

  @timestamp = Time.at(data['timestamp'].to_i)
end