Skip to content

Commit 5171ec7

Browse files
committed
feat: message stickers - add extension? methods and remove equals method
1 parent 9d4054a commit 5171ec7

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib/discordrb/data/sticker.rb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ module Discordrb
55
class Sticker
66
include IDObject
77

8+
FORMATS = {
9+
png: 1,
10+
apng: 2,
11+
lottie: 3,
12+
gif: 4
13+
}.freeze
14+
15+
FORMATS.each do |name, value|
16+
define_method("#{name}?") do
17+
@format_type == value
18+
end
19+
end
20+
821
# @return [Message] the message this sticker belongs to.
922
attr_reader :message
1023

@@ -39,15 +52,5 @@ def initialize(data, message, bot)
3952
@extension = 'gif'
4053
end
4154
end
42-
43-
# ID or name based comparison
44-
def ==(other)
45-
return false unless other.is_a? Sticker
46-
return Discordrb.id_compare(@id, other) if @id
47-
48-
name == other.name
49-
end
50-
51-
alias_method :eql?, :==
5255
end
5356
end

0 commit comments

Comments
 (0)