Module: DSU3::API::Message

Defined in:
lib/dsu3/api/message.rb

Overview

Message API calls

Class Method Summary collapse

Class Method Details

.react(token, channel, message, emoji) ⇒ 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:

  • token (String)

    Discord account token

  • channel (String, Integer)

    Channel ID

  • message (String, Integer)

    Message ID

  • emoji (String)


15
16
17
18
19
20
21
22
23
# File 'lib/dsu3/api/message.rb', line 15

def react(token, channel, message, emoji)
  emoji = URI.encode_www_form_component(emoji)

  DSU3::API.request(
    token, :put,
    "channels/#{channel}/messages/#{message}/reactions/#{emoji}/@me",
    { params: { location: 'Message' } }
  )
end