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 collapse
- #guild ⇒ Object readonly
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: Discorb::Unset, description: Discorb::Unset, tag: Discorb::Unset, reason: Discorb::Unset) ⇒ Async::Task<void>
(also: #modify)
Edits the sticker.
Methods inherited from DiscordModel
Instance Attribute Details
#guild ⇒ Object (readonly)
59 60 61 |
# File 'lib/discorb/sticker.rb', line 59 def guild @client.guilds[@guild_id] end |
Instance Method Details
#delete(reason: nil) ⇒ Object Also known as: destroy
Deletes the sticker.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/discorb/sticker.rb', line 110 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.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/discorb/sticker.rb', line 75 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 |