From ceb8112922f544832b6119bb1f05b673625164bc Mon Sep 17 00:00:00 2001 From: PixeL Date: Thu, 29 Dec 2022 00:51:58 -0600 Subject: [PATCH 1/3] Fix rubocop infractions --- examples/modals.rb | 6 +++--- lib/discordrb/data/interaction.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/modals.rb b/examples/modals.rb index 17095e048..9cbe26be9 100644 --- a/examples/modals.rb +++ b/examples/modals.rb @@ -3,9 +3,9 @@ require 'discordrb' require 'securerandom' -bot = Discordrb::Bot.new(token: ENV['DISCORDRB_TOKEN']) -bot.register_application_command(:modal_test, 'Test out a spiffy modal', server_id: ENV['DISCORDRB_SERVER_ID']) -bot.register_application_command(:modal_await_test, 'Test out the await style', server_id: ENV['DISCORDRB_SERVER_ID']) +bot = Discordrb::Bot.new(token: ENV.fetch['DISCORDRB_TOKEN']) +bot.register_application_command(:modal_test, 'Test out a spiffy modal', server_id: ENV.fetch['DISCORDRB_SERVER_ID']) +bot.register_application_command(:modal_await_test, 'Test out the await style', server_id: ENV.fetch['DISCORDRB_SERVER_ID']) bot.application_command :modal_test do |event| event.show_modal(title: 'Test modal', custom_id: 'test1234') do |modal| diff --git a/lib/discordrb/data/interaction.rb b/lib/discordrb/data/interaction.rb index 313d2fd59..c170aeed3 100644 --- a/lib/discordrb/data/interaction.rb +++ b/lib/discordrb/data/interaction.rb @@ -289,7 +289,7 @@ def text_inputs # @return [TextInput, Button, SelectMenu] def get_component(custom_id) top_level = @components.flat_map(&:components) || [] - message_level = @message&.components&.flat_map { |r| r.components } || [] + message_level = @message&.components&.flat_map(&:components) || [] components = top_level.concat(message_level) components.find { |component| component.custom_id == custom_id } end From b82d2a0d64973ffdfd7c32390befa157644872e5 Mon Sep 17 00:00:00 2001 From: PixeL Date: Thu, 29 Dec 2022 00:52:06 -0600 Subject: [PATCH 2/3] Fix rspec infraction related to emoji --- spec/api/channel_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/api/channel_spec.rb b/spec/api/channel_spec.rb index 65a31e814..ea57238fd 100644 --- a/spec/api/channel_spec.rb +++ b/spec/api/channel_spec.rb @@ -55,7 +55,7 @@ describe '.delete_all_emoji_reactions' do let(:message_id) { double('message_id', to_s: 'message_id') } - let(:emoji) { "\u{1F525}" } + let(:emoji) { '\u{1F525}' } before do allow(Discordrb::API).to receive(:request) From 8774a5b0d4eb969b4e65fe29163a84ee23e9fed4 Mon Sep 17 00:00:00 2001 From: PixeL Date: Thu, 29 Dec 2022 01:10:34 -0600 Subject: [PATCH 3/3] Fix webhook spec failing --- spec/data/webhook_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/data/webhook_spec.rb b/spec/data/webhook_spec.rb index 3a498e5a4..89c1c6d9c 100644 --- a/spec/data/webhook_spec.rb +++ b/spec/data/webhook_spec.rb @@ -101,7 +101,7 @@ describe '#update' do it 'calls update_webhook' do - expect(webhook).to receive(:update_webhook).with(avatar: avatar_string, channel_id: edited_webhook_channel_id.to_i, name: edited_webhook_name, reason: reason) + expect(webhook).to receive(:update_webhook).with(hash_including(avatar: avatar_string, channel_id: edited_webhook_channel_id.to_i, name: edited_webhook_name, reason: reason)) webhook.update(avatar: avatar_string, channel: edited_webhook_channel_id, name: edited_webhook_name, reason: reason) end end