Class: LibDiscord::GuildTemplate

Inherits:
Resource
  • Object
show all
Defined in:
lib/lib_discord/guild_template.rb

Overview

Guild Template Resource

Do not instantiate a GuildTemplate directly. Instead request from an instance of Client.

client = LibDiscord::Client.new("Bot auth.token")
g = client["guild_template"]

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from LibDiscord::Resource

Instance Method Details

#create_guild_from_guild_template(template_code:, json:) ⇒ Response

Parameters:

  • template_code (#to_s)
  • json (#to_json)

    JSON serializable payload

Returns:

Raises:

See Also:



42
43
44
# File 'lib/lib_discord/guild_template.rb', line 42

def create_guild_from_guild_template(template_code:, json:)
  send_request(:post, "/guilds/templates/#{template_code}", json:)
end

#create_guild_template(guild_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



74
75
76
# File 'lib/lib_discord/guild_template.rb', line 74

def create_guild_template(guild_id:, json:)
  send_request(:post, "/guilds/#{guild_id}/templates", json:)
end

#delete_guild_template(guild_id:, template_code:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



124
125
126
# File 'lib/lib_discord/guild_template.rb', line 124

def delete_guild_template(guild_id:, template_code:)
  send_request(:delete, "/guilds/#{guild_id}/templates/#{template_code}")
end

#get_guild_template(template_code:) ⇒ Response

Parameters:

  • template_code (#to_s)

Returns:

Raises:

See Also:



27
28
29
# File 'lib/lib_discord/guild_template.rb', line 27

def get_guild_template(template_code:)
  send_request(:get, "/guilds/templates/#{template_code}")
end

#get_guild_templates(guild_id:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



57
58
59
# File 'lib/lib_discord/guild_template.rb', line 57

def get_guild_templates(guild_id:)
  send_request(:get, "/guilds/#{guild_id}/templates")
end

#modify_guild_template(guild_id:, template_code:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



108
109
110
# File 'lib/lib_discord/guild_template.rb', line 108

def modify_guild_template(guild_id:, template_code:, json:)
  send_request(:patch, "/guilds/#{guild_id}/templates/#{template_code}", json:)
end

#sync_guild_template(guild_id:, template_code:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



90
91
92
# File 'lib/lib_discord/guild_template.rb', line 90

def sync_guild_template(guild_id:, template_code:)
  send_request(:put, "/guilds/#{guild_id}/templates/#{template_code}")
end