Class: Discorb::Sticker::GuildSticker
- Inherits:
-
Discorb::Sticker
- Object
- DiscordModel
- Discorb::Sticker
- Discorb::Sticker::GuildSticker
- 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
-
#delete!(reason: nil) -> Object
(also: #destroy!)
Deletes the sticker.
-
#edit(name: :unset, description: :unset, tag: :unset, reason: :unset) -> Object
(also: #modify)
Edits the sticker.
- #guild -> Object
Methods inherited from DiscordModel
Instance Method Details
#delete!(reason: nil) -> Object Also known as: destroy!
Note:
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
Note:
This method calls HTTP request.
Deletes the sticker.
98 99 100 101 102 |
# File 'lib/discorb/sticker.rb', line 98 def delete!(reason: nil) Async do @client.http.delete("/guilds/#{@guild_id}/stickers/#{@id}", audit_log_reason: reason).wait end end |
#edit(name: :unset, description: :unset, tag: :unset, reason: :unset) -> Object Also known as: modify
Note:
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
Note:
This method calls HTTP request.
Note:
The arguments of this method are defaultly set to :unset
. Specify value to set the value, if not don't specify or specify :unset
.
Edits the sticker.
79 80 81 82 83 84 85 86 87 |
# File 'lib/discorb/sticker.rb', line 79 def edit(name: :unset, description: :unset, tag: :unset, reason: :unset) Async do payload = {} payload[:name] = name unless name == :unset payload[:description] = description unless description == :unset payload[:tags] = tag.name unless tag == :unset @client.http.patch("/guilds/#{@guild_id}/stickers/#{@id}", 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 |