Skip to content

Commit

Permalink
Fix buttons and string selects without emojis breaking due to API cha…
Browse files Browse the repository at this point in the history
…nge (#247) (#249)
  • Loading branch information
wouterdedroog committed Jan 8, 2024
1 parent 0f01116 commit edad88d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/discordrb/webhooks/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def button(style:, label: nil, emoji: nil, custom_id: nil, disabled: nil, url: n
when Integer, String
emoji.to_i.positive? ? { id: emoji } : { name: emoji }
else
emoji.to_h
emoji&.to_h
end

@components << { type: COMPONENT_TYPES[:button], label: label, emoji: emoji, style: style, custom_id: custom_id, disabled: disabled, url: url }
Expand Down Expand Up @@ -149,7 +149,7 @@ def option(label:, value:, description: nil, emoji: nil, default: nil)
when Integer, String
emoji.to_i.positive? ? { id: emoji } : { name: emoji }
else
emoji.to_h
emoji&.to_h
end

@options << { label: label, value: value, description: description, emoji: emoji, default: default }
Expand Down

0 comments on commit edad88d

Please sign in to comment.