Skip to content

Commit

Permalink
Bugfix - Webhook#update method cannot be used in Ruby 3+
Browse files Browse the repository at this point in the history
  + update_webhook(**data) will solve the problem in Ruby 3+
  + The addition of "if data.key?(:channel)" fixes a bug also present in Ruby 2.7
  • Loading branch information
Dakurei committed Dec 3, 2022
1 parent 4fcab9b commit 591d127
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/discordrb/data/webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def name=(name)
def update(data)
# Only pass a value for avatar if the key is defined as sending nil will delete the
data[:avatar] = avatarise(data[:avatar]) if data.key?(:avatar)
data[:channel_id] = data[:channel].resolve_id
data[:channel_id] = data[:channel]&.resolve_id
data.delete(:channel)
update_webhook(data)
update_webhook(**data)
end

# Deletes the webhook.
Expand Down

0 comments on commit 591d127

Please sign in to comment.