discordrb
discordrb copied to clipboard
Component data class does not support all components available in builder
Summary
I'm using the Components::View builder to provide additional inputs after a slash command.
bot.application_command(:example) do |event|
message = event.respond(
ephemeral: true,
wait: true,
components: Discordrb::Components::View.new do |builder|
builder.row do |row|
row.user_select(
custom_id: SecureRandom.uuid,
placeholder: 'users',
min_values: 10,
max_values: 10
)
end
end
)
end
Upon completion of the user select, the message
has the component, but it's nil
.
row = message.components
row.components.count
# => 1
row.components.first
# => nil
I have reason to believe it is because of #self.from_data which doesn't include all of the types available in the builder.
The component types which are missing:
- user_select
- role_select
- mentionable_select
- channel_select
Maybe I'm misunderstanding, but how should I get the value of these types of components?
Environment
Ruby version:
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin21]
Discordrb version:
Gemfile
gem 'discordrb', github: 'shardlab/discordrb', branch: 'main'
Gemfile.lock
GIT
remote: https://github.com/shardlab/discordrb.git
revision: 4551619ecdfacf438ad1dd18b55e1906effaf80a
branch: main
specs:
discordrb (3.4.2)
discordrb-webhooks (~> 3.4.2)
ffi (>= 1.9.24)
opus-ruby
rest-client (>= 2.0.0)
websocket-client-simple (>= 0.3.0)
discordrb-webhooks (3.4.2)
rest-client (>= 2.0.0)