Class: DSU3::Message

Inherits:
DObject show all
Defined in:
lib/dsu3/data/message.rb

Overview

Message object

Instance Attribute Summary

Attributes inherited from DObject

#id, #net

Instance Method Summary collapse

Constructor Details

#initialize(channel, id) ⇒ Message

Returns a new instance of Message.

Parameters:

  • channel (DSU3::Channel)

    Channel instance

  • id (String, Integer)

    Message ID



8
9
10
11
# File 'lib/dsu3/data/message.rb', line 8

def initialize(channel, id)
  super(channel.net, id)
  @channel_id = channel.id
end

Instance Method Details

#react(emoji, cooldown = 0) ⇒ Object

Note:

To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id

Reacts to a message

Parameters:

  • emoji (String)
  • cooldown (Integer) (defaults to: 0)


17
18
19
# File 'lib/dsu3/data/message.rb', line 17

def react(emoji, cooldown = 0)
  @net.request(seq: true, cooldown: cooldown) { DSU3::API::Message.react(_1, @channel_id, @id, emoji) }
end