onyxcord 3.2.4 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/onyxcord/core/version.rb +1 -1
- data/lib/onyxcord/models/component.rb +0 -14
- data/lib/onyxcord/webhooks/modal.rb +0 -44
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a198cb1ead59b05936a681bdf1c83dbf7ffe3b68f223548508e8dde371f2951a
|
|
4
|
+
data.tar.gz: 1c81f3befc93b00e0c685e4d3506bbf52fc406bf729f060ad591dfde7818a59c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6763d7f434e9dbe46a7838a86df33b5f61de198b200006d442af5b899935f76cfd1afc81ca1d3d80c25f6606f2018a946f4488d4bb3ec254449fe0f3620d90a0
|
|
7
|
+
data.tar.gz: 6e4352a1a1b1ba32a770ce2047de68c4b3f677e52ddf9984bd61d17e3d20c560d8f6ce716c8563e51aae0086b980d67a9a31d3830007d7b577dde8353a1d8716
|
|
@@ -485,14 +485,6 @@ module OnyxCord
|
|
|
485
485
|
|
|
486
486
|
# A parent component for interactive modal components.
|
|
487
487
|
class Label
|
|
488
|
-
# Methods from the wrapped interactive component that should remain
|
|
489
|
-
# available for legacy modal code that iterates over event.components.
|
|
490
|
-
DELEGATED_COMPONENT_METHODS = %i[
|
|
491
|
-
custom_id
|
|
492
|
-
value
|
|
493
|
-
values
|
|
494
|
-
].freeze
|
|
495
|
-
|
|
496
488
|
# @return [Integer] the numeric identifier of the label.
|
|
497
489
|
attr_reader :id
|
|
498
490
|
|
|
@@ -513,12 +505,6 @@ module OnyxCord
|
|
|
513
505
|
@description = data['description']
|
|
514
506
|
@component = Components.from_data(data['component'], @bot)
|
|
515
507
|
end
|
|
516
|
-
|
|
517
|
-
DELEGATED_COMPONENT_METHODS.each do |name|
|
|
518
|
-
define_method(name) do
|
|
519
|
-
@component.public_send(name) if @component.respond_to?(name)
|
|
520
|
-
end
|
|
521
|
-
end
|
|
522
508
|
end
|
|
523
509
|
|
|
524
510
|
# A surface that allows users to upload files in a modal.
|
|
@@ -39,53 +39,9 @@ class OnyxCord::Webhooks::Modal
|
|
|
39
39
|
@components << LabelBuilder.new(...)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
# Add a legacy action row to the modal.
|
|
43
|
-
def row(id: nil)
|
|
44
|
-
@components << LegacyRowBuilder.new(id: id) { |row| yield row }
|
|
45
|
-
end
|
|
46
|
-
|
|
47
42
|
# Add a text display component to the view.
|
|
48
43
|
# @see Webhooks::View::TextDisplayBuilder#initialize
|
|
49
44
|
def text_display(...)
|
|
50
45
|
@components << OnyxCord::Webhooks::View::TextDisplayBuilder.new(...)
|
|
51
46
|
end
|
|
52
|
-
|
|
53
|
-
class LegacyRowBuilder
|
|
54
|
-
def initialize(id: nil)
|
|
55
|
-
@id = id
|
|
56
|
-
@components = []
|
|
57
|
-
|
|
58
|
-
yield self if block_given?
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def text_input(style:, custom_id:, id: nil, min_length: nil, max_length: nil, required: nil, value: nil, placeholder: nil, label: nil)
|
|
62
|
-
@components << {
|
|
63
|
-
type: COMPONENT_TYPES[:text_input],
|
|
64
|
-
custom_id: custom_id,
|
|
65
|
-
id: id,
|
|
66
|
-
label: label,
|
|
67
|
-
style: LabelBuilder::TEXT_INPUT_STYLES[style] || style,
|
|
68
|
-
min_length: min_length,
|
|
69
|
-
max_length: max_length,
|
|
70
|
-
required: required,
|
|
71
|
-
value: value,
|
|
72
|
-
placeholder: placeholder
|
|
73
|
-
}.compact
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def file_upload(custom_id:, id: nil, min_values: nil, max_values: nil, required: nil)
|
|
77
|
-
@components << {
|
|
78
|
-
type: COMPONENT_TYPES[:file_upload],
|
|
79
|
-
custom_id: custom_id,
|
|
80
|
-
id: id,
|
|
81
|
-
min_values: min_values,
|
|
82
|
-
max_values: max_values,
|
|
83
|
-
required: required
|
|
84
|
-
}.compact
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def to_h
|
|
88
|
-
{ type: COMPONENT_TYPES[:action_row], id: @id, components: @components }.compact
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
47
|
end
|