Class: Discord::GuildsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/discord/resources/guilds.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

#channels(guild:) ⇒ Object



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

def channels(guild:)
  response = get_request("guilds/#{guild}/channels")
  Collection.from_response(response, type: Channel)
end

#create_channel(guild:, **params) ⇒ Object



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

def create_channel(guild:, **params)
  response = post_request("guilds/#{guild}/channels", body: params)
  Channel.new response.body
end

#retrieve(id:) ⇒ Object



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

def retrieve(id:)
  Guild.new get_request("guilds/#{id}").body
end

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



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

def update(id:, **params)
  response = patch_request("guilds/#{id}", body: params)
  Guild.new response.body
end