From 591d1277d265d5d57db2fa77ae311f792044d8a5 Mon Sep 17 00:00:00 2001 From: Maxime Palanchini Date: Wed, 16 Nov 2022 14:44:01 +0100 Subject: [PATCH] Bugfix - Webhook#update method cannot be used in Ruby 3+ + 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 --- lib/discordrb/data/webhook.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/discordrb/data/webhook.rb b/lib/discordrb/data/webhook.rb index 3c58fd11e..218bb897d 100644 --- a/lib/discordrb/data/webhook.rb +++ b/lib/discordrb/data/webhook.rb @@ -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.