Class: Discord::MessagesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/discord/resources/messages.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Discord::Resource

Instance Method Details

#bulk_delete(channel:, messages:) ⇒ Object



27
28
29
# File 'lib/discord/resources/messages.rb', line 27

def bulk_delete(channel:, messages:)
  post_request("channels/#{channel}/messages/bulk-delete", body: {messages: messages})
end

#create(channel:, **params) ⇒ Object



13
14
15
16
# File 'lib/discord/resources/messages.rb', line 13

def create(channel:, **params)
  response = post_request("channels/#{channel}/messages", body: params)
  Message.new response.body
end

#delete(channel:, id:) ⇒ Object



23
24
25
# File 'lib/discord/resources/messages.rb', line 23

def delete(channel:, id:)
  delete_request("channels/#{channel}/messages/#{id}")
end

#list(channel:, **params) ⇒ Object



4
5
6
7
# File 'lib/discord/resources/messages.rb', line 4

def list(channel:, **params)
  response = get_request("channels/#{channel}/messages", params: params)
  Collection.from_response(response, type: Message)
end

#retrieve(channel:, message:) ⇒ Object



9
10
11
# File 'lib/discord/resources/messages.rb', line 9

def retrieve(channel:, message:)
  Message.new get_request("channels/#{channel}/messages/#{message}").body
end

#update(channel:, id:, **params) ⇒ Object



18
19
20
21
# File 'lib/discord/resources/messages.rb', line 18

def update(channel:, id:, **params)
  response = patch_request("channels/#{channel}/messages/#{id}", body: params)
  Message.new response.body
end