From 8221bbe536a2f14a55dbbbea8bbf213467575a63 Mon Sep 17 00:00:00 2001 From: maksim Date: Wed, 23 Jul 2025 02:23:29 +0300 Subject: [PATCH 1/3] Add: Sticker support to Messageable#post --- lib/discorb/modules.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/discorb/modules.rb b/lib/discorb/modules.rb index 85d55ab0..cb7aaf6e 100644 --- a/lib/discorb/modules.rb +++ b/lib/discorb/modules.rb @@ -18,6 +18,8 @@ module Messageable # @param [Array, Array>] components The components to send. # @param [Discorb::Attachment] attachment The attachment to send. # @param [Array] attachments The attachments to send. + # @param [Array] stickers The stickers to send. + # @param [Discorb::Sticker] sticker The sticker to send. # # @return [Async::Task] The message sent. # @@ -30,7 +32,9 @@ def post( reference: nil, components: nil, attachment: nil, - attachments: nil + attachments: nil, + stickers: nil, + sticker: nil ) Async do payload = {} @@ -60,6 +64,8 @@ def post( { id: i, filename: a.filename, description: a.description } end + payload[:sticker_ids] = sticker ? [sticker.id] : (stickers.map(&:id) if stickers) + _resp, data = @client .http From fe6e8a87bc71e016540a4228e3b0c1e8b267aaff Mon Sep 17 00:00:00 2001 From: maksim Date: Wed, 23 Jul 2025 02:36:44 +0300 Subject: [PATCH 2/3] Add: Update messageable.rbs --- sig/discorb/messageable.rbs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sig/discorb/messageable.rbs b/sig/discorb/messageable.rbs index 021167d5..64d18ecb 100644 --- a/sig/discorb/messageable.rbs +++ b/sig/discorb/messageable.rbs @@ -22,6 +22,8 @@ module Discorb # @param [Array, Array>] components The components to send. # @param [Discorb::Attachment] attachment The attachment to send. # @param [Array] attachments The attachments to send. + # @param [Array] stickers The stickers to send. + # @param [Discorb::Sticker] sticker The sticker to send. # # @return [Async::Task] The message sent. def post: ( @@ -34,7 +36,9 @@ module Discorb ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?attachment: Discorb::Attachment?, - ?attachments: ::Array[Discorb::Attachment]? + ?attachments: ::Array[Discorb::Attachment]?, + ?sticker: Discorb::Sticker?, + ?stickers: ::Array[Discorb::Sticker]? ) -> Async::Task[Discorb::Message] # From f693ec777c2da6c48dc1234500deca2ea617ed75 Mon Sep 17 00:00:00 2001 From: maksim Date: Wed, 23 Jul 2025 08:11:01 +0300 Subject: [PATCH 3/3] Fix: Now it is safe to have nil as sticker --- lib/discorb/modules.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/discorb/modules.rb b/lib/discorb/modules.rb index cb7aaf6e..ff6e453c 100644 --- a/lib/discorb/modules.rb +++ b/lib/discorb/modules.rb @@ -64,7 +64,8 @@ def post( { id: i, filename: a.filename, description: a.description } end - payload[:sticker_ids] = sticker ? [sticker.id] : (stickers.map(&:id) if stickers) + stickers = [sticker.id] if stickers.nil? && !sticker.nil? + payload[:sticker_ids] = stickers.map(&:id) if stickers _resp, data = @client