Class: Discorb::Sticker::GuildSticker

Inherits:
Discorb::Sticker show all
Defined in:
lib/discorb/sticker.rb

Overview

Represents a sticker of guilds.

Instance Attribute Summary

Attributes inherited from Discorb::Sticker

#available, #description, #format, #guild_id, #id, #name, #pack_id, #sort_value, #tags, #type, #user

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?

Instance Method Details

#delete!(reason: nil) -> Object Also known as: destroy!

Deletes the sticker.

Parameters:

  • reason (String) (defaults to: nil)

    The reason for the deletion.



98
99
100
101
102
# File 'lib/discorb/sticker.rb', line 98

def delete!(reason: nil)
  Async do
    @client.http.request(Route.new("/guilds/#{@guild_id}/stickers/#{@id}", "//guilds/:guild_id/stickers/:sticker_id", :delete), audit_log_reason: reason).wait
  end
end

#edit(name: Discorb::Unset, description: Discorb::Unset, tag: Discorb::Unset, reason: Discorb::Unset) -> Async::Task<void> Also known as: modify

Note:

The arguments of this method are defaultly set to Discorb::Unset. Specify value to set the value, if not don't specify or specify Discorb::Unset.

Edits the sticker.

Parameters:

  • name (String) (defaults to: Discorb::Unset)

    The new name of the sticker.

  • description (String) (defaults to: Discorb::Unset)

    The new description of the sticker.

  • tag (Discorb::Emoji) (defaults to: Discorb::Unset)

    The new tags of the sticker.

  • reason (String) (defaults to: Discorb::Unset)

    The reason for the edit.

Returns:

  • (Async::Task<void>)

    The task.



80
81
82
83
84
85
86
87
88
# File 'lib/discorb/sticker.rb', line 80

def edit(name: Discorb::Unset, description: Discorb::Unset, tag: Discorb::Unset, reason: Discorb::Unset)
  Async do
    payload = {}
    payload[:name] = name unless name == Discorb::Unset
    payload[:description] = description unless description == Discorb::Unset
    payload[:tags] = tag.name unless tag == Discorb::Unset
    @client.http.request(Route.new("/guilds/#{@guild_id}/stickers/#{@id}", "//guilds/:guild_id/stickers/:sticker_id", :patch), payload, audit_log_reason: reason).wait
  end
end

#guild -> Object



64
65
66
# File 'lib/discorb/sticker.rb', line 64

def guild
  @client.guilds[@guild_id]
end