Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple embeds #194

Closed
wants to merge 12 commits into from
Closed

Conversation

Dakurei
Copy link
Contributor

@Dakurei Dakurei commented Nov 30, 2022

Summary

Fixes the problem preventing the creation and editing of messages with multiple embeds

(Based on PR #193)


Fixed

Fix #132

Dakurei and others added 12 commits March 24, 2023 09:44
  In this case, @message contains a Hash instead of a Message, preventing to call the .components method on it. So we instantiate a Message object if it is a Hash.
  + string_select (old select_menu)
  + user_select
  + role_select
  + mentionable_select
  + channel_select
  Was used as a debugging tool to see why the Webhook#update test was failing 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
  Currently, it is impossible to access more than the first 1000 bans in the list because of these missing arguments.
  https://discord.com/developers/docs/resources/guild#get-guild-bans
data.delete(:channel)
update_webhook(data)
update_webhook(**data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is data being spread here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had noticed that this is a problem that affects Ruby 3+.
Without this, the test suite concerning webhooks does not pass, at least without modifying the test directly

@@ -14,7 +14,7 @@ def self.from_data(data, bot)
ActionRow.new(data, bot)
when Webhooks::View::COMPONENT_TYPES[:button]
Button.new(data, bot)
when Webhooks::View::COMPONENT_TYPES[:select_menu]
when Webhooks::View::COMPONENT_TYPES[:string_select]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not supporting the other select types?

end

# Event for when a user interacts with a select menu component.
class SelectMenuEvent < ComponentEvent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be removed and should be the base for all other select events

end
end

# Event handler for a select menu component.
class SelectMenuEventHandler < ComponentEventHandler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise this should be the base for other select menu event handlers

@@ -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}' }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be double quotes

@swarley
Copy link
Member

swarley commented Mar 26, 2023

Closed in favor of #209

@swarley swarley closed this Mar 26, 2023
@Dakurei Dakurei deleted the support_multiple_embeds branch March 26, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multiple embeds in Message#edit
2 participants