discorb 0.13.4 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +2 -0
  3. data/.github/workflows/build_version.yml +1 -1
  4. data/.github/workflows/codeql-analysis.yml +70 -0
  5. data/.github/workflows/lint-push.yml +20 -0
  6. data/.github/workflows/lint.yml +16 -0
  7. data/.rubocop.yml +74 -0
  8. data/Changelog.md +30 -0
  9. data/Gemfile +7 -3
  10. data/Rakefile +28 -22
  11. data/discorb.gemspec +1 -0
  12. data/docs/events.md +50 -0
  13. data/docs/faq.md +8 -8
  14. data/examples/commands/bookmarker.rb +2 -1
  15. data/examples/commands/hello.rb +1 -0
  16. data/examples/commands/inspect.rb +3 -2
  17. data/examples/components/authorization_button.rb +2 -1
  18. data/examples/components/select_menu.rb +2 -1
  19. data/examples/extension/main.rb +1 -0
  20. data/examples/extension/message_expander.rb +1 -0
  21. data/examples/simple/eval.rb +3 -2
  22. data/examples/simple/ping_pong.rb +1 -0
  23. data/examples/simple/rolepanel.rb +1 -0
  24. data/examples/simple/wait_for_message.rb +4 -3
  25. data/exe/discorb +8 -7
  26. data/lib/discorb/allowed_mentions.rb +71 -0
  27. data/lib/discorb/app_command/command.rb +336 -0
  28. data/lib/discorb/app_command/handler.rb +168 -0
  29. data/lib/discorb/app_command.rb +2 -426
  30. data/lib/discorb/application.rb +16 -7
  31. data/lib/discorb/asset.rb +11 -0
  32. data/lib/discorb/{file.rb → attachment.rb} +55 -33
  33. data/lib/discorb/audit_logs.rb +45 -7
  34. data/lib/discorb/channel.rb +65 -15
  35. data/lib/discorb/client.rb +34 -27
  36. data/lib/discorb/common.rb +19 -27
  37. data/lib/discorb/components/button.rb +105 -0
  38. data/lib/discorb/components/select_menu.rb +143 -0
  39. data/lib/discorb/components/text_input.rb +96 -0
  40. data/lib/discorb/components.rb +11 -276
  41. data/lib/discorb/dictionary.rb +5 -0
  42. data/lib/discorb/embed.rb +73 -40
  43. data/lib/discorb/emoji.rb +48 -5
  44. data/lib/discorb/error.rb +9 -5
  45. data/lib/discorb/event.rb +36 -24
  46. data/lib/discorb/exe/about.rb +1 -0
  47. data/lib/discorb/exe/irb.rb +4 -3
  48. data/lib/discorb/exe/new.rb +6 -7
  49. data/lib/discorb/exe/run.rb +2 -1
  50. data/lib/discorb/exe/setup.rb +8 -5
  51. data/lib/discorb/exe/show.rb +1 -0
  52. data/lib/discorb/extend.rb +19 -14
  53. data/lib/discorb/extension.rb +5 -1
  54. data/lib/discorb/gateway.rb +112 -51
  55. data/lib/discorb/gateway_requests.rb +4 -7
  56. data/lib/discorb/guild.rb +73 -41
  57. data/lib/discorb/guild_template.rb +26 -5
  58. data/lib/discorb/http.rb +38 -18
  59. data/lib/discorb/integration.rb +24 -9
  60. data/lib/discorb/intents.rb +16 -11
  61. data/lib/discorb/interaction/autocomplete.rb +6 -5
  62. data/lib/discorb/interaction/command.rb +66 -12
  63. data/lib/discorb/interaction/components.rb +19 -3
  64. data/lib/discorb/interaction/modal.rb +33 -0
  65. data/lib/discorb/interaction/response.rb +45 -4
  66. data/lib/discorb/interaction/root.rb +16 -0
  67. data/lib/discorb/interaction.rb +2 -1
  68. data/lib/discorb/invite.rb +11 -7
  69. data/lib/discorb/log.rb +5 -5
  70. data/lib/discorb/member.rb +22 -3
  71. data/lib/discorb/message.rb +39 -234
  72. data/lib/discorb/message_meta.rb +186 -0
  73. data/lib/discorb/modules.rb +39 -15
  74. data/lib/discorb/permission.rb +16 -7
  75. data/lib/discorb/presence.rb +45 -9
  76. data/lib/discorb/rate_limit.rb +7 -4
  77. data/lib/discorb/reaction.rb +6 -0
  78. data/lib/discorb/role.rb +12 -0
  79. data/lib/discorb/sticker.rb +22 -14
  80. data/lib/discorb/user.rb +12 -1
  81. data/lib/discorb/utils/colored_puts.rb +1 -0
  82. data/lib/discorb/voice_state.rb +23 -2
  83. data/lib/discorb/webhook.rb +54 -3
  84. data/lib/discorb.rb +5 -2
  85. data/sig/discorb.rbs +838 -702
  86. data/template-replace/scripts/arrow.rb +1 -0
  87. data/template-replace/scripts/favicon.rb +1 -0
  88. data/template-replace/scripts/index.rb +2 -1
  89. data/template-replace/scripts/locale_ja.rb +5 -4
  90. data/template-replace/scripts/sidebar.rb +1 -0
  91. data/template-replace/scripts/version.rb +7 -10
  92. data/template-replace/scripts/yard_replace.rb +5 -4
  93. metadata +17 -3
data/sig/discorb.rbs CHANGED
@@ -8,76 +8,6 @@ module Discorb
8
8
  USER_AGENT: untyped
9
9
  Unset: untyped
10
10
 
11
- #
12
- # Represents a attachment file.
13
- class Attachment < Discorb::DiscordModel
14
- # @return [#read] The file content.
15
- attr_reader io: untyped
16
-
17
- # @return [Discorb::Snowflake] The attachment id.
18
- attr_reader id: Discorb::Snowflake
19
-
20
- # @return [String] The attachment filename.
21
- attr_reader filename: String
22
-
23
- # @return [String] The attachment content type.
24
- attr_reader content_type: String
25
-
26
- # @return [Integer] The attachment size in bytes.
27
- attr_reader size: Integer
28
-
29
- # @return [String] The attachment url.
30
- attr_reader url: String
31
-
32
- # @return [String] The attachment proxy url.
33
- attr_reader proxy_url: String
34
-
35
- # @return [Integer] The image height.
36
- # @return [nil] If the attachment is not an image.
37
- attr_reader height: Integer?
38
-
39
- # @return [Integer] The image width.
40
- # @return [nil] If the attachment is not an image.
41
- attr_reader width: Integer?
42
-
43
- # @return [Boolean] whether the file is an image.
44
- attr_reader image?: bool
45
- end
46
-
47
- #
48
- # Represents a file to send as an attachment.
49
- class File
50
- #
51
- # Creates a new file from IO.
52
- #
53
- # @param [#read] io The IO of the file.
54
- # @param [String] filename The filename of the file. If not set, path or object_id of the IO is used.
55
- # @param [String] content_type The content type of the file. If not set, it is guessed from the filename.
56
- # If failed to guess, it is set to `application/octet-stream`.
57
- def initialize: (untyped io, ?String? filename, ?content_type: String?) -> void
58
-
59
- #
60
- # Creates a new file from a string.
61
- #
62
- # @param [String] string The string to create the file from.
63
- # @param [String] filename The filename of the file. object_id of the string is used if not set.
64
- # @param [String] content_type The content type of the file. If not set, it is guessed from the filename.
65
- #
66
- # @return [File] The new file.
67
- def self.from_string: (String string, ?filename: String?, ?content_type: String?) -> File
68
-
69
- def inspect: () -> untyped
70
-
71
- # @return [#read] The IO of the file.
72
- attr_accessor io: untyped
73
-
74
- # @return [String] The filename of the file. If not set, path or object_id of the IO is used.
75
- attr_accessor filename: String
76
-
77
- # @return [String] The content type of the file. If not set, it is guessed from the filename.
78
- attr_accessor content_type: String
79
- end
80
-
81
11
  #
82
12
  # Represents a flag.
83
13
  # @abstract
@@ -295,24 +225,27 @@ module Discorb
295
225
  #
296
226
  # Edit a message.
297
227
  # @async
228
+ # @!macro edit
298
229
  #
299
230
  # @param [#to_s] message_id The message id.
300
231
  # @param [String] content The message content.
301
232
  # @param [Discorb::Embed] embed The embed to send.
302
233
  # @param [Array<Discorb::Embed>] embeds The embeds to send.
303
234
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
235
+ # @param [Array<Discorb::Attachment>] attachments The new attachments.
304
236
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
305
237
  # @param [Boolean] supress Whether to supress embeds.
306
238
  #
307
239
  # @return [Async::Task<void>] The task.
308
240
  def edit_message: (
309
241
  _ToS message_id,
310
- ?String? content,
311
- ?embed: Discorb::Embed?,
312
- ?embeds: ::Array[Discorb::Embed]?,
313
- ?allowed_mentions: Discorb::AllowedMentions?,
314
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
315
- ?supress: bool?
242
+ ?String content,
243
+ ?embed: Discorb::Embed,
244
+ ?embeds: ::Array[Discorb::Embed],
245
+ ?allowed_mentions: Discorb::AllowedMentions,
246
+ ?attachments: ::Array[Discorb::Attachment],
247
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]),
248
+ ?supress: bool
316
249
  ) -> Async::Task[void]
317
250
 
318
251
  #
@@ -487,6 +420,8 @@ module Discorb
487
420
  # @param [Integer] size The size of the image. This is compatible with {Asset#url}, will be ignored.
488
421
  #
489
422
  # @return [String] URL of the avatar.
423
+ #
424
+ # rubocop: disable Lint/UnusedMethodArgument
490
425
  def url: (?image_format: String?, ?size: Integer) -> String
491
426
 
492
427
  def inspect: () -> untyped
@@ -653,12 +588,9 @@ module Discorb
653
588
  ?fields: ::Array[Discorb::Embed::Field]?,
654
589
  ?footer: Discorb::Embed::Footer?,
655
590
  ?image: (Discorb::Embed::Image | String)?,
656
- ?thumbnail: (Discorb::Embed::Thumbnail | String)?,
657
- ?data: untyped
591
+ ?thumbnail: (Discorb::Embed::Thumbnail | String)?
658
592
  ) -> void
659
593
 
660
- def inspect: () -> untyped
661
-
662
594
  #
663
595
  # Convert embed to hash.
664
596
  #
@@ -666,6 +598,8 @@ module Discorb
666
598
  # @return [Hash] Converted embed.
667
599
  def to_hash: () -> ::Hash[untyped, untyped]
668
600
 
601
+ def self.from_hash: (untyped data) -> untyped
602
+
669
603
  # @return [String, nil] The title of embed.
670
604
  attr_accessor title: String?
671
605
 
@@ -916,8 +850,6 @@ module Discorb
916
850
  #
917
851
  # @return [Async::Task<self>] The deleted emoji.
918
852
  def delete!: (?reason: String?) -> Async::Task[self]
919
- # @return [Discorb::Snowflake] The ID of the emoji.
920
- attr_reader id: Discorb::Snowflake
921
853
 
922
854
  # @return [String] The name of the emoji.
923
855
  attr_reader name: String
@@ -1040,7 +972,7 @@ module Discorb
1040
972
  #
1041
973
  # Represents a error because of a cloudflare ban.
1042
974
  class CloudFlareBanError < Discorb::HTTPError
1043
- def initialize: (untyped resp, untyped client) -> void
975
+ def initialize: (untyped _resp, untyped client) -> void
1044
976
  end
1045
977
 
1046
978
  #
@@ -1059,6 +991,8 @@ module Discorb
1059
991
  def initialize: (untyped message) -> void
1060
992
  end
1061
993
 
994
+ #
995
+ # Represents an event in guild.
1062
996
  class ScheduledEvent < Discorb::DiscordModel
1063
997
  # @!visibility private
1064
998
  def initialize: (untyped client, untyped data) -> void
@@ -1972,7 +1906,7 @@ module Discorb
1972
1906
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions that the client is using.
1973
1907
  # @param [Discorb::Intents] intents The intents that the client is currently using.
1974
1908
  # @param [Integer] message_caches The number of messages to cache.
1975
- # @param [#puts] log The IO object to use for logging.
1909
+ # @param [#write] log The IO object to use for logging.
1976
1910
  # @param [Boolean] colorize_log Whether to colorize the log.
1977
1911
  # @param [:debug, :info, :warn, :error, :critical] log_level The log level.
1978
1912
  # @param [Boolean] wait_until_ready Whether to delay event dispatch until ready.
@@ -2093,8 +2027,7 @@ module Discorb
2093
2027
  #
2094
2028
  # @param [Discorb::Activity] activity The activity to update.
2095
2029
  # @param [:online, :idle, :dnd, :invisible] status The status to update.
2096
- # @param [String] afk Whether to set the client as AFK.
2097
- def update_presence: (?Discorb::Activity? activity, ?status: Symbol?, ?afk: String) -> untyped
2030
+ def update_presence: (?Discorb::Activity? activity, ?status: Symbol?) -> untyped
2098
2031
 
2099
2032
  #
2100
2033
  # Method to wait for a event.
@@ -2227,7 +2160,7 @@ module Discorb
2227
2160
  # @note `token` parameter only required if you don't run client.
2228
2161
  def setup_commands: (?String? token, ?guild_ids: (::Array[untyped] | bool)?) -> untyped
2229
2162
 
2230
- def connect_gateway: (untyped reconnect, ?no_close: untyped) -> untyped
2163
+ def connect_gateway: (untyped reconnect) -> untyped
2231
2164
 
2232
2165
  def send_gateway: (untyped opcode, **untyped value) -> untyped
2233
2166
 
@@ -2362,9 +2295,8 @@ module Discorb
2362
2295
  attr_reader id: String
2363
2296
  end
2364
2297
 
2365
- module DefineOr
2366
- end
2367
-
2298
+ #
2299
+ # Represents an endpoint.
2368
2300
  #
2369
2301
  # Represents invite of discord.
2370
2302
  class Invite < Discorb::DiscordModel
@@ -2495,6 +2427,14 @@ module Discorb
2495
2427
  #
2496
2428
  # @return [Async::Task<Discorb::Guild::Ban>] The ban.
2497
2429
  def ban: (?delete_message_days: Integer, ?reason: String?) -> Async::Task[Discorb::Guild::Ban]
2430
+
2431
+ #
2432
+ # Checks if the member can manage the given role.
2433
+ #
2434
+ # @param [Discorb::Role] role The role.
2435
+ #
2436
+ # @return [Boolean] `true` if the member can manage the role.
2437
+ def can_manage?: (Discorb::Role role) -> bool
2498
2438
  # @return [Time] The time the member boosted the guild.
2499
2439
  attr_reader premium_since: Time
2500
2440
 
@@ -2846,8 +2786,8 @@ module Discorb
2846
2786
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
2847
2787
  # @param [Discorb::Message, Discorb::Message::Reference] reference The message to reply to.
2848
2788
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
2849
- # @param [Discorb::File] file The file to send.
2850
- # @param [Array<Discorb::File>] files The files to send.
2789
+ # @param [Discorb::Attachment] attachment The attachment to send.
2790
+ # @param [Array<Discorb::Attachment>] attachments The attachments to send.
2851
2791
  #
2852
2792
  # @return [Async::Task<Discorb::Message>] The message sent.
2853
2793
  def post: (
@@ -2858,31 +2798,34 @@ module Discorb
2858
2798
  ?allowed_mentions: Discorb::AllowedMentions?,
2859
2799
  ?reference: (Discorb::Message | Discorb::Message::Reference)?,
2860
2800
  ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
2861
- ?file: Discorb::File?,
2862
- ?files: ::Array[Discorb::File]?
2801
+ ?attachment: Discorb::Attachment?,
2802
+ ?attachments: ::Array[Discorb::Attachment]?
2863
2803
  ) -> Async::Task[Discorb::Message]
2864
2804
 
2865
2805
  #
2866
2806
  # Edit a message.
2867
2807
  # @async
2808
+ # @!macro edit
2868
2809
  #
2869
2810
  # @param [#to_s] message_id The message id.
2870
2811
  # @param [String] content The message content.
2871
2812
  # @param [Discorb::Embed] embed The embed to send.
2872
2813
  # @param [Array<Discorb::Embed>] embeds The embeds to send.
2873
2814
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
2815
+ # @param [Array<Discorb::Attachment>] attachments The new attachments.
2874
2816
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
2875
2817
  # @param [Boolean] supress Whether to supress embeds.
2876
2818
  #
2877
2819
  # @return [Async::Task<void>] The task.
2878
2820
  def edit_message: (
2879
2821
  _ToS message_id,
2880
- ?String? content,
2881
- ?embed: Discorb::Embed?,
2882
- ?embeds: ::Array[Discorb::Embed]?,
2883
- ?allowed_mentions: Discorb::AllowedMentions?,
2884
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
2885
- ?supress: bool?
2822
+ ?String content,
2823
+ ?embed: Discorb::Embed,
2824
+ ?embeds: ::Array[Discorb::Embed],
2825
+ ?allowed_mentions: Discorb::AllowedMentions,
2826
+ ?attachments: ::Array[Discorb::Attachment],
2827
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]),
2828
+ ?supress: bool
2886
2829
  ) -> Async::Task[void]
2887
2830
 
2888
2831
  #
@@ -2977,8 +2920,9 @@ module Discorb
2977
2920
  # @return [Time] The time when the last pinned message was pinned.
2978
2921
  attr_reader last_pin_timestamp: Time
2979
2922
 
2980
- # @return [Array<Discorb::ThreadChannel>] The threads in the channel.
2981
- attr_reader threads: ::Array[Discorb::ThreadChannel]
2923
+ # @!attribute [r] threads
2924
+ # @return [Array<Discorb::ThreadChannel>] The threads in the channel.
2925
+ attr_reader threads: untyped
2982
2926
  end
2983
2927
 
2984
2928
  #
@@ -2997,8 +2941,8 @@ module Discorb
2997
2941
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
2998
2942
  # @param [Discorb::Message, Discorb::Message::Reference] reference The message to reply to.
2999
2943
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
3000
- # @param [Discorb::File] file The file to send.
3001
- # @param [Array<Discorb::File>] files The files to send.
2944
+ # @param [Discorb::Attachment] attachment The attachment to send.
2945
+ # @param [Array<Discorb::Attachment>] attachments The attachments to send.
3002
2946
  #
3003
2947
  # @return [Async::Task<Discorb::Message>] The message sent.
3004
2948
  def post: (
@@ -3009,31 +2953,34 @@ module Discorb
3009
2953
  ?allowed_mentions: Discorb::AllowedMentions?,
3010
2954
  ?reference: (Discorb::Message | Discorb::Message::Reference)?,
3011
2955
  ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
3012
- ?file: Discorb::File?,
3013
- ?files: ::Array[Discorb::File]?
2956
+ ?attachment: Discorb::Attachment?,
2957
+ ?attachments: ::Array[Discorb::Attachment]?
3014
2958
  ) -> Async::Task[Discorb::Message]
3015
2959
 
3016
2960
  #
3017
2961
  # Edit a message.
3018
2962
  # @async
2963
+ # @!macro edit
3019
2964
  #
3020
2965
  # @param [#to_s] message_id The message id.
3021
2966
  # @param [String] content The message content.
3022
2967
  # @param [Discorb::Embed] embed The embed to send.
3023
2968
  # @param [Array<Discorb::Embed>] embeds The embeds to send.
3024
2969
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
2970
+ # @param [Array<Discorb::Attachment>] attachments The new attachments.
3025
2971
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
3026
2972
  # @param [Boolean] supress Whether to supress embeds.
3027
2973
  #
3028
2974
  # @return [Async::Task<void>] The task.
3029
2975
  def edit_message: (
3030
2976
  _ToS message_id,
3031
- ?String? content,
3032
- ?embed: Discorb::Embed?,
3033
- ?embeds: ::Array[Discorb::Embed]?,
3034
- ?allowed_mentions: Discorb::AllowedMentions?,
3035
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
3036
- ?supress: bool?
2977
+ ?String content,
2978
+ ?embed: Discorb::Embed,
2979
+ ?embeds: ::Array[Discorb::Embed],
2980
+ ?allowed_mentions: Discorb::AllowedMentions,
2981
+ ?attachments: ::Array[Discorb::Attachment],
2982
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]),
2983
+ ?supress: bool
3037
2984
  ) -> Async::Task[void]
3038
2985
 
3039
2986
  #
@@ -3140,6 +3087,10 @@ module Discorb
3140
3087
  ?rtc_region: Symbol,
3141
3088
  ?reason: String?
3142
3089
  ) -> Async::Task[self]
3090
+
3091
+ def voice_states: () -> untyped
3092
+
3093
+ def members: () -> untyped
3143
3094
  def connect: () -> untyped
3144
3095
 
3145
3096
  # @return [Integer] The bitrate of the voice channel.
@@ -3193,6 +3144,14 @@ module Discorb
3193
3144
  # @return [Async::Task<StageInstance>] The current stage instance.
3194
3145
  # @return [Async::Task<nil>] If there is no current stage instance.
3195
3146
  def fetch_stage_instance: () -> Async::Task[StageInstance]
3147
+
3148
+ def voice_states: () -> untyped
3149
+
3150
+ def members: () -> untyped
3151
+
3152
+ def speakers: () -> untyped
3153
+
3154
+ def audiences: () -> untyped
3196
3155
  def connect: () -> untyped
3197
3156
 
3198
3157
  # @return [Integer] The bitrate of the voice channel.
@@ -3271,6 +3230,16 @@ module Discorb
3271
3230
  # @note This method won't unarchive the thread. Use {#unarchive} instead.
3272
3231
  def unlock: (?reason: String?) -> self
3273
3232
 
3233
+ def parent: () -> untyped
3234
+
3235
+ def me: () -> untyped
3236
+
3237
+ def joined?: () -> bool
3238
+
3239
+ def guild: () -> untyped
3240
+
3241
+ def owner: () -> untyped
3242
+
3274
3243
  def inspect: () -> untyped
3275
3244
 
3276
3245
  #
@@ -3305,8 +3274,8 @@ module Discorb
3305
3274
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
3306
3275
  # @param [Discorb::Message, Discorb::Message::Reference] reference The message to reply to.
3307
3276
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
3308
- # @param [Discorb::File] file The file to send.
3309
- # @param [Array<Discorb::File>] files The files to send.
3277
+ # @param [Discorb::Attachment] attachment The attachment to send.
3278
+ # @param [Array<Discorb::Attachment>] attachments The attachments to send.
3310
3279
  #
3311
3280
  # @return [Async::Task<Discorb::Message>] The message sent.
3312
3281
  def post: (
@@ -3317,31 +3286,34 @@ module Discorb
3317
3286
  ?allowed_mentions: Discorb::AllowedMentions?,
3318
3287
  ?reference: (Discorb::Message | Discorb::Message::Reference)?,
3319
3288
  ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
3320
- ?file: Discorb::File?,
3321
- ?files: ::Array[Discorb::File]?
3289
+ ?attachment: Discorb::Attachment?,
3290
+ ?attachments: ::Array[Discorb::Attachment]?
3322
3291
  ) -> Async::Task[Discorb::Message]
3323
3292
 
3324
3293
  #
3325
3294
  # Edit a message.
3326
3295
  # @async
3296
+ # @!macro edit
3327
3297
  #
3328
3298
  # @param [#to_s] message_id The message id.
3329
3299
  # @param [String] content The message content.
3330
3300
  # @param [Discorb::Embed] embed The embed to send.
3331
3301
  # @param [Array<Discorb::Embed>] embeds The embeds to send.
3332
3302
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
3303
+ # @param [Array<Discorb::Attachment>] attachments The new attachments.
3333
3304
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
3334
3305
  # @param [Boolean] supress Whether to supress embeds.
3335
3306
  #
3336
3307
  # @return [Async::Task<void>] The task.
3337
3308
  def edit_message: (
3338
3309
  _ToS message_id,
3339
- ?String? content,
3340
- ?embed: Discorb::Embed?,
3341
- ?embeds: ::Array[Discorb::Embed]?,
3342
- ?allowed_mentions: Discorb::AllowedMentions?,
3343
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
3344
- ?supress: bool?
3310
+ ?String content,
3311
+ ?embed: Discorb::Embed,
3312
+ ?embeds: ::Array[Discorb::Embed],
3313
+ ?allowed_mentions: Discorb::AllowedMentions,
3314
+ ?attachments: ::Array[Discorb::Attachment],
3315
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]),
3316
+ ?supress: bool
3345
3317
  ) -> Async::Task[void]
3346
3318
 
3347
3319
  #
@@ -3452,37 +3424,23 @@ module Discorb
3452
3424
  # @return [Boolean] Whether the thread is archived or not.
3453
3425
  attr_reader archived: bool
3454
3426
 
3455
- # @macro client_cache
3456
- # @return [Discorb::GuildChannel] The parent channel of the thread.
3457
- attr_reader parent: Discorb::GuildChannel?
3458
-
3459
- # @return [Discorb::ThreadChannel::Member] The bot's member in the thread.
3460
- # @return [nil] If the bot is not in the thread.
3461
- attr_reader me: Discorb::ThreadChannel::Member?
3462
-
3463
- # @return [Boolean] Whether the bot is in the thread or not.
3464
- attr_reader joined?: bool
3465
-
3466
- # @macro client_cache
3467
- # @return [Discorb::Guild] The guild of the thread.
3468
- attr_reader guild: Discorb::Guild?
3469
-
3470
- # @macro client_cache
3471
- # @macro members_intent
3472
- # @return [Discorb::Member] The owner of the thread.
3473
- attr_reader owner: Discorb::Member?
3474
-
3427
+ #
3428
+ # Represents a thread in news channel(aka announcement channel).
3475
3429
  class News < Discorb::ThreadChannel
3476
3430
  end
3477
3431
 
3432
+ #
3433
+ # Represents a public thread in text channel.
3478
3434
  class Public < Discorb::ThreadChannel
3479
3435
  end
3480
3436
 
3437
+ #
3438
+ # Represents a private thread in text channel.
3481
3439
  class Private < Discorb::ThreadChannel
3482
3440
  end
3483
3441
 
3484
3442
  #
3485
- # Repre
3443
+ # Represents a member in a thread.
3486
3444
  class Member < Discorb::DiscordModel
3487
3445
  def initialize: (untyped cilent, untyped data) -> void
3488
3446
 
@@ -3501,7 +3459,11 @@ module Discorb
3501
3459
  end
3502
3460
  end
3503
3461
 
3462
+ #
3463
+ # Represents a category in a guild.
3504
3464
  class CategoryChannel < Discorb::GuildChannel
3465
+ def channels: () -> untyped
3466
+
3505
3467
  def text_channels: () -> untyped
3506
3468
 
3507
3469
  def voice_channels: () -> untyped
@@ -3517,34 +3479,37 @@ module Discorb
3517
3479
  def create_news_channel: (*untyped args, **untyped kwargs) -> untyped
3518
3480
 
3519
3481
  def create_stage_channel: (*untyped args, **untyped kwargs) -> untyped
3520
- # Returns the value of attribute channels.
3521
- attr_reader channels: untyped
3522
3482
  end
3523
3483
 
3484
+ #
3485
+ # Represents a DM channel.
3524
3486
  class DMChannel < Discorb::Channel
3525
3487
  include Discorb::Messageable
3526
3488
 
3527
3489
  #
3528
3490
  # Edit a message.
3529
3491
  # @async
3492
+ # @!macro edit
3530
3493
  #
3531
3494
  # @param [#to_s] message_id The message id.
3532
3495
  # @param [String] content The message content.
3533
3496
  # @param [Discorb::Embed] embed The embed to send.
3534
3497
  # @param [Array<Discorb::Embed>] embeds The embeds to send.
3535
3498
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
3499
+ # @param [Array<Discorb::Attachment>] attachments The new attachments.
3536
3500
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
3537
3501
  # @param [Boolean] supress Whether to supress embeds.
3538
3502
  #
3539
3503
  # @return [Async::Task<void>] The task.
3540
3504
  def edit_message: (
3541
3505
  _ToS message_id,
3542
- ?String? content,
3543
- ?embed: Discorb::Embed?,
3544
- ?embeds: ::Array[Discorb::Embed]?,
3545
- ?allowed_mentions: Discorb::AllowedMentions?,
3546
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
3547
- ?supress: bool?
3506
+ ?String content,
3507
+ ?embed: Discorb::Embed,
3508
+ ?embeds: ::Array[Discorb::Embed],
3509
+ ?allowed_mentions: Discorb::AllowedMentions,
3510
+ ?attachments: ::Array[Discorb::Attachment],
3511
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]),
3512
+ ?supress: bool
3548
3513
  ) -> Async::Task[void]
3549
3514
 
3550
3515
  #
@@ -3690,6 +3655,21 @@ module Discorb
3690
3655
  attr_reader fired_by: (Discorb::Member | Discorb::User)?
3691
3656
  end
3692
3657
 
3658
+ #
3659
+ # Represents a `INTEGRATION_DELETE` event.
3660
+ class IntegrationDeleteEvent < Discorb::Gateway::GatewayEvent
3661
+ # @return [Discorb::Snowflake] The ID of the integration.
3662
+ attr_reader id: Discorb::Snowflake
3663
+
3664
+ # @macro client_cache
3665
+ # @return [Discorb::Guild] The guild of the integration.
3666
+ attr_reader guild: Discorb::Guild?
3667
+
3668
+ # @macro client_cache
3669
+ # @return [Discorb::User] The user associated with the integration.
3670
+ attr_reader user: Discorb::User?
3671
+ end
3672
+
3693
3673
  #
3694
3674
  # Represents a `MESSAGE_REACTION_REMOVE_ALL` event.
3695
3675
  class ReactionRemoveAllEvent < Discorb::Gateway::GatewayEvent
@@ -3869,12 +3849,6 @@ module Discorb
3869
3849
  attr_reader guild: Discorb::Guild?
3870
3850
  end
3871
3851
 
3872
- class GuildIntegrationsUpdateEvent < Discorb::Gateway::GatewayEvent
3873
- def initialize: (untyped client, untyped data) -> void
3874
-
3875
- def guild: () -> untyped
3876
- end
3877
-
3878
3852
  #
3879
3853
  # Represents a `TYPING_START` event.
3880
3854
  class TypingStartEvent < Discorb::Gateway::GatewayEvent
@@ -3939,7 +3913,7 @@ module Discorb
3939
3913
  #
3940
3914
  # A module to handle gateway events.
3941
3915
  module Handler
3942
- def connect_gateway: (untyped reconnect, ?no_close: untyped) -> untyped
3916
+ def connect_gateway: (untyped reconnect) -> untyped
3943
3917
 
3944
3918
  def send_gateway: (untyped opcode, **untyped value) -> untyped
3945
3919
 
@@ -3976,9 +3950,13 @@ module Discorb
3976
3950
  # @param dm_messages [Boolean] Whether dm messages related events are enabled.
3977
3951
  # @param dm_reactions [Boolean] Whether dm reactions related events are enabled.
3978
3952
  # @param dm_typing [Boolean] Whether dm typing related events are enabled.
3953
+ # @param message_content [Boolean] Whether message content will be sent with events.
3979
3954
  # @param scheduled_events [Boolean] Whether events related scheduled events are enabled.
3980
3955
  #
3981
3956
  # @note You must enable privileged intents to use `members` and/or `presences` intents.
3957
+ # @note Message Content Intent is not required to use `message_content` intents for now,
3958
+ # this will be required in April 30, 2022. [Learn More](https://support-dev.discord.com/hc/en-us/articles/4404772028055).
3959
+ # You should specify `message_content` intent for preventing unexpected changes in the future.
3982
3960
  def initialize: (
3983
3961
  ?guilds: bool,
3984
3962
  ?members: bool,
@@ -3995,6 +3973,7 @@ module Discorb
3995
3973
  ?dm_messages: bool,
3996
3974
  ?dm_reactions: bool,
3997
3975
  ?dm_typing: bool,
3976
+ ?message_content: bool?,
3998
3977
  ?scheduled_events: bool
3999
3978
  ) -> void
4000
3979
 
@@ -4016,10 +3995,6 @@ module Discorb
4016
3995
  # @param value [Integer] The value of the intent.
4017
3996
  def self.from_value: (Integer value) -> untyped
4018
3997
 
4019
- # Create new intent object with default values.
4020
- # This will return intents without members and presence.
4021
- def self.default: () -> untyped
4022
-
4023
3998
  # Create new intent object with all intents.
4024
3999
  def self.all: () -> untyped
4025
4000
 
@@ -4028,39 +4003,7 @@ module Discorb
4028
4003
  end
4029
4004
 
4030
4005
  #
4031
- # Represents a allowed mentions in a message.
4032
- class AllowedMentions
4033
- #
4034
- # Initializes a new instance of the AllowedMentions class.
4035
- #
4036
- # @param [Boolean] everyone Whether to allow @everyone or @here.
4037
- # @param [Boolean, Array<Discorb::Role>] roles The roles to allow, or false to disable.
4038
- # @param [Boolean, Array<Discorb::User>] users The users to allow, or false to disable.
4039
- # @param [Boolean] replied_user Whether to ping the user that sent the message to reply.
4040
- def initialize: (
4041
- ?everyone: bool?,
4042
- ?roles: (bool | ::Array[Discorb::Role])?,
4043
- ?users: (bool | ::Array[Discorb::User])?,
4044
- ?replied_user: bool?
4045
- ) -> void
4046
-
4047
- def inspect: () -> untyped
4048
-
4049
- # @return [Boolean] Whether to allow @everyone or @here.
4050
- attr_accessor everyone: bool
4051
-
4052
- # @return [Boolean, Array<Discorb::Role>] The roles to allow, or false to disable.
4053
- attr_accessor roles: (bool | ::Array[Discorb::Role])
4054
-
4055
- # @return [Boolean, Array<Discorb::User>] The users to allow, or false to disable.
4056
- attr_accessor users: (bool | ::Array[Discorb::User])
4057
-
4058
- # @return [Boolean] Whether to ping the user that sent the message to reply.
4059
- attr_accessor replied_user: bool
4060
- end
4061
-
4062
- #
4063
- # Represents a message.
4006
+ # Represents a message in Discord.
4064
4007
  class Message < Discorb::DiscordModel
4065
4008
  #
4066
4009
  # Removes the mentions from the message.
@@ -4090,17 +4033,19 @@ module Discorb
4090
4033
  # @param [Discorb::Embed] embed The embed to send.
4091
4034
  # @param [Array<Discorb::Embed>] embeds The embeds to send.
4092
4035
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
4036
+ # @param [Array<Discorb::Attachment>] attachments The new attachments.
4093
4037
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
4094
4038
  # @param [Boolean] supress Whether to supress embeds.
4095
4039
  #
4096
4040
  # @return [Async::Task<void>] The task.
4097
4041
  def edit: (
4098
- ?String? content,
4099
- ?embed: Discorb::Embed?,
4100
- ?embeds: ::Array[Discorb::Embed]?,
4101
- ?allowed_mentions: Discorb::AllowedMentions?,
4102
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
4103
- ?supress: bool?
4042
+ ?String content,
4043
+ ?embed: Discorb::Embed,
4044
+ ?embeds: ::Array[Discorb::Embed],
4045
+ ?allowed_mentions: Discorb::AllowedMentions,
4046
+ ?attachments: ::Array[Discorb::Attachment],
4047
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]),
4048
+ ?supress: bool
4104
4049
  ) -> Async::Task[void]
4105
4050
 
4106
4051
  #
@@ -4201,8 +4146,6 @@ module Discorb
4201
4146
 
4202
4147
  # Meta
4203
4148
  def inspect: () -> untyped
4204
- # @return [Discorb::Snowflake] The ID of the message.
4205
- attr_reader id: Discorb::Snowflake
4206
4149
 
4207
4150
  # @return [Discorb::User, Discorb::Member] The user that sent the message.
4208
4151
  attr_reader author: (Discorb::User | Discorb::Member)
@@ -4412,6 +4355,8 @@ module Discorb
4412
4355
  attr_accessor fail_if_not_exists: bool
4413
4356
  end
4414
4357
 
4358
+ #
4359
+ # Represents a sticker.
4415
4360
  class Sticker
4416
4361
  def initialize: (untyped data) -> void
4417
4362
 
@@ -4467,8 +4412,8 @@ module Discorb
4467
4412
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
4468
4413
  # @param [Discorb::Message, Discorb::Message::Reference] reference The message to reply to.
4469
4414
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
4470
- # @param [Discorb::File] file The file to send.
4471
- # @param [Array<Discorb::File>] files The files to send.
4415
+ # @param [Discorb::Attachment] attachment The attachment to send.
4416
+ # @param [Array<Discorb::Attachment>] attachments The attachments to send.
4472
4417
  #
4473
4418
  # @return [Async::Task<Discorb::Message>] The message sent.
4474
4419
  def post: (
@@ -4479,31 +4424,34 @@ module Discorb
4479
4424
  ?allowed_mentions: Discorb::AllowedMentions?,
4480
4425
  ?reference: (Discorb::Message | Discorb::Message::Reference)?,
4481
4426
  ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
4482
- ?file: Discorb::File?,
4483
- ?files: ::Array[Discorb::File]?
4427
+ ?attachment: Discorb::Attachment?,
4428
+ ?attachments: ::Array[Discorb::Attachment]?
4484
4429
  ) -> Async::Task[Discorb::Message]
4485
4430
 
4486
4431
  #
4487
4432
  # Edit a message.
4488
4433
  # @async
4434
+ # @!macro edit
4489
4435
  #
4490
4436
  # @param [#to_s] message_id The message id.
4491
4437
  # @param [String] content The message content.
4492
4438
  # @param [Discorb::Embed] embed The embed to send.
4493
4439
  # @param [Array<Discorb::Embed>] embeds The embeds to send.
4494
4440
  # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions.
4441
+ # @param [Array<Discorb::Attachment>] attachments The new attachments.
4495
4442
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
4496
4443
  # @param [Boolean] supress Whether to supress embeds.
4497
4444
  #
4498
4445
  # @return [Async::Task<void>] The task.
4499
4446
  def edit_message: (
4500
4447
  _ToS message_id,
4501
- ?String? content,
4502
- ?embed: Discorb::Embed?,
4503
- ?embeds: ::Array[Discorb::Embed]?,
4504
- ?allowed_mentions: Discorb::AllowedMentions?,
4505
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
4506
- ?supress: bool?
4448
+ ?String content,
4449
+ ?embed: Discorb::Embed,
4450
+ ?embeds: ::Array[Discorb::Embed],
4451
+ ?allowed_mentions: Discorb::AllowedMentions,
4452
+ ?attachments: ::Array[Discorb::Attachment],
4453
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]),
4454
+ ?supress: bool
4507
4455
  ) -> Async::Task[void]
4508
4456
 
4509
4457
  #
@@ -4993,6 +4941,8 @@ module Discorb
4993
4941
  attr_reader end: Time
4994
4942
  end
4995
4943
 
4944
+ #
4945
+ # Represents the party of an activity.
4996
4946
  class Party < Discorb::DiscordModel
4997
4947
  # @return [String] The id of the party.
4998
4948
  attr_reader id: String
@@ -5009,13 +4959,13 @@ module Discorb
5009
4959
  class Asset < Discorb::DiscordModel
5010
4960
  def initialize: (untyped data) -> void
5011
4961
 
5012
- # @return [String] The large image ID of the asset.
4962
+ # @return [String] The large image ID or URL of the asset.
5013
4963
  attr_reader large_image: String
5014
4964
 
5015
4965
  # @return [String] The large text of the activity.
5016
4966
  attr_reader large_text: String
5017
4967
 
5018
- # @return [String] The small image ID of the activity.
4968
+ # @return [String] The small image ID or URL of the activity.
5019
4969
  attr_reader small_image: String
5020
4970
 
5021
4971
  # @return [String] The small text of the activity.
@@ -5116,127 +5066,82 @@ module Discorb
5116
5066
 
5117
5067
  def self.included: (untyped base) -> untyped
5118
5068
 
5119
- module ClassMethods
5120
- include Discorb::ApplicationCommand::Handler
5069
+ #
5121
5070
 
5122
- #
5123
- # Define a new event.
5124
- #
5125
- # @param [Symbol] event_name The name of the event.
5126
- # @param [Symbol] id The id of the event. Used to delete the event.
5127
- # @param [Hash] metadata Other metadata.
5128
- #
5129
- # @return [Discorb::EventHandler] The event.
5130
- def event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::EventHandler
5071
+ end
5131
5072
 
5132
- #
5133
- # Define a new once event.
5134
- #
5135
- # @param [Symbol] event_name The name of the event.
5136
- # @param [Symbol] id The id of the event. Used to delete the event.
5137
- # @param [Hash] metadata Other metadata.
5138
- # @param [Proc] block The block to execute when the event is triggered.
5139
- #
5140
- # @return [Discorb::EventHandler] The event.
5141
- def once_event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::EventHandler
5073
+ #
5074
+ # Represents a attachment file.
5075
+ class Attachment
5076
+ #
5077
+ # Creates a new attachment.
5078
+ #
5079
+ # @param [#read, String] source The Source of the attachment.
5080
+ # @param [String] filename The filename of the attachment. If not set, path or object_id of the IO is used.
5081
+ # @param [String] description The description of the attachment.
5082
+ # @param [String] content_type The content type of the attachment. If not set, it is guessed from the filename.
5083
+ # If failed to guess, it is set to `application/octet-stream`.
5084
+ # @param [Boolean] will_close Whether the IO will be closed after the attachment is sent.
5085
+ def initialize: (
5086
+ (untyped | String) source,
5087
+ ?String? filename,
5088
+ ?description: String?,
5089
+ ?content_type: String?,
5090
+ ?will_close: bool
5091
+ ) -> void
5142
5092
 
5143
- def self.extended: (untyped klass) -> untyped
5093
+ #
5094
+ # Creates a new file from a string.
5095
+ #
5096
+ # @param [String] string The string to create the file from.
5097
+ # @param [String] filename The filename of the file. object_id of the string is used if not set.
5098
+ # @param [String] content_type The content type of the file. If not set, it is guessed from the filename.
5099
+ #
5100
+ # @return [File] The new file.
5101
+ def self.from_string: (
5102
+ String string,
5103
+ ?String? filename,
5104
+ ?content_type: String?,
5105
+ ?description: untyped
5106
+ ) -> File
5144
5107
 
5145
- #
5146
- # Add new top-level command.
5147
- #
5148
- # @param [String] command_name Command name.
5149
- # @param [String] description Command description.
5150
- # @param [Hash{String => Hash{:description => String, :optional => Boolean, :type => Object}}] options Command options.
5151
- # The key is the option name, the value is a hash with the following keys:
5152
- #
5153
- # | Key | Type | Description |
5154
- # | --- | --- | --- |
5155
- # | `:description` | `String` | Description of the option. |
5156
- # | `:required` | Whether the argument is required. `optional` will be used if not specified. |
5157
- # | `:optional` | Whether the argument is optional. `required` will be used if not specified. |
5158
- # | `:type` | `Object` | Type of the option. |
5159
- # | `:choice` | `Hash{String => String, Integer, Float}` | Type of the option. |
5160
- # | `:default` | `Object` | Default value of the option. |
5161
- # | `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
5162
- # | `:autocomplete` | `Proc` | Autocomplete function. |
5163
- # | `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
5164
- #
5165
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5166
- # @param [Proc] block Command block.
5167
- #
5168
- # @return [Discorb::ApplicationCommand::Command::SlashCommand] Command object.
5169
- #
5170
- # @see file:docs/application_command.md#register-slash-command Application Comamnds: Register Slash Command
5171
- # @see file:docs/cli/setup.md CLI: setup
5172
- def slash: (
5173
- String command_name,
5174
- String description,
5175
- ?::Hash[String, String | Integer | Float] options,
5176
- ?guild_ids: (::Array[untyped] | bool)?
5177
- ) -> Discorb::ApplicationCommand::Command::SlashCommand
5108
+ # @return [#read] The file content.
5109
+ attr_reader io: untyped
5178
5110
 
5179
- #
5180
- # Add new command with group.
5181
- #
5182
- # @param [String] command_name Command name.
5183
- # @param [String] description Command description.
5184
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5185
- #
5186
- # @yield Block to yield with the command.
5187
- # @yieldparam [Discorb::ApplicationCommand::Command::GroupCommand] group Group command.
5188
- #
5189
- # @return [Discorb::ApplicationCommand::Command::GroupCommand] Command object.
5190
- #
5191
- # @see file:docs/application_command.md Application Commands
5192
- # @see file:docs/cli/setup.md CLI: setup
5193
- def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommand::Command::GroupCommand group) -> void } -> Discorb::ApplicationCommand::Command::GroupCommand
5111
+ # @return [String] The attachment filename.
5112
+ attr_reader filename: String
5194
5113
 
5195
- #
5196
- # Add message context menu command.
5197
- #
5198
- # @param [String] command_name Command name.
5199
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5200
- # @param [Proc] block Command block.
5201
- # @yield [interaction, message] Block to execute.
5202
- # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
5203
- # @yieldparam [Discorb::Message] message Message object.
5204
- #
5205
- # @return [Discorb::ApplicationCommand::Command] Command object.
5206
- def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command
5114
+ # @return [String] The attachment content type.
5115
+ attr_reader content_type: String
5207
5116
 
5208
- #
5209
- # Add user context menu command.
5210
- #
5211
- # @param [String] command_name Command name.
5212
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5213
- # @param [Proc] block Command block.
5214
- # @yield [interaction, user] Block to execute.
5215
- # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
5216
- # @yieldparam [Discorb::User] user User object.
5217
- #
5218
- # @return [Discorb::ApplicationCommand::Command] Command object.
5219
- def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command
5117
+ # @return [String] The attachment description.
5118
+ attr_reader description: String
5220
5119
 
5221
- #
5222
- # Setup commands.
5223
- # @async
5224
- # @see Client#initialize
5225
- #
5226
- # @param [String] token Bot token.
5227
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to use as default. If `false` is given, it will be global command.
5228
- #
5229
- # @note `token` parameter only required if you don't run client.
5230
- def setup_commands: (?String? token, ?guild_ids: (::Array[untyped] | bool)?) -> untyped
5120
+ # @return [Discorb::Snowflake] The attachment id.
5121
+ attr_reader id: Discorb::Snowflake
5122
+
5123
+ # @return [Integer] The attachment size in bytes.
5124
+ attr_reader size: Integer
5231
5125
 
5232
- # @return [Hash{Symbol => Array<Discorb::EventHandler>}] The events of the extension.
5233
- attr_reader events: ::Hash[Symbol, ::Array[Discorb::EventHandler]]
5126
+ # @return [String] The attachment url.
5127
+ attr_reader url: String
5234
5128
 
5235
- # @return [Array<Discorb::ApplicationCommand::Command>] The commands of the extension.
5236
- attr_reader commands: ::Array[Discorb::ApplicationCommand::Command]
5129
+ # @return [String] The attachment proxy url.
5130
+ attr_reader proxy_url: String
5237
5131
 
5132
+ # @return [Integer] The image height.
5133
+ # @return [nil] If the attachment is not an image.
5134
+ attr_reader height: Integer?
5238
5135
 
5239
- end
5136
+ # @return [Integer] The image width.
5137
+ # @return [nil] If the attachment is not an image.
5138
+ attr_reader width: Integer?
5139
+
5140
+ # @return [:client, :discord] The attachment was created by.
5141
+ attr_reader created_by: Symbol
5142
+
5143
+ # @return [Boolean] whether the file is an image.
5144
+ attr_reader image?: bool
5240
5145
  end
5241
5146
 
5242
5147
  #
@@ -5439,154 +5344,7 @@ module Discorb
5439
5344
  end
5440
5345
 
5441
5346
  #
5442
- # Represents a button component.
5443
- class Button < Discorb::Component
5444
- #
5445
- # Initialize a new button.
5446
- #
5447
- # @param [String] label The label of the button.
5448
- # @param [:primary, :secondary, :success, :danger, :link] style The style of the button.
5449
- # @param [Discorb::Emoji] emoji The emoji of the button.
5450
- # @param [String] custom_id The custom ID of the button.
5451
- # @param [String] url The URL of the button.
5452
- # @param [Boolean] disabled Whether the button is disabled.
5453
- def initialize: (
5454
- String label,
5455
- ?Symbol style,
5456
- ?emoji: Discorb::Emoji?,
5457
- ?custom_id: String?,
5458
- ?url: String?,
5459
- ?disabled: bool
5460
- ) -> void
5461
-
5462
- #
5463
- # Converts the button to a hash.
5464
- #
5465
- # @see https://discord.com/developers/docs/interactions/message-components#button-object-button-structure Official Discord API docs
5466
- # @return [Hash] A hash representation of the button.
5467
- def to_hash: () -> ::Hash[untyped, untyped]
5468
-
5469
- def inspect: () -> untyped
5470
-
5471
- def hash_emoji: (untyped emoji) -> untyped
5472
-
5473
- # @return [String] The label of the button.
5474
- attr_accessor label: String
5475
-
5476
- # @return [:primary, :secondary, :success, :danger, :link] The style of the button.
5477
- attr_accessor style: Symbol
5478
-
5479
- # @return [Discorb::Emoji] The emoji of the button.
5480
- attr_accessor emoji: Discorb::Emoji
5481
-
5482
- # @return [String] The custom ID of the button.
5483
- # Won't be used if the style is `:link`.
5484
- attr_accessor custom_id: String
5485
-
5486
- # @return [String] The URL of the button.
5487
- # Only used when the style is `:link`.
5488
- attr_accessor url: String
5489
-
5490
- # @return [Boolean] Whether the button is disabled.
5491
- attr_accessor disabled: bool
5492
- end
5493
-
5494
- #
5495
- # Represents a select menu component.
5496
- class SelectMenu < Discorb::Component
5497
- #
5498
- # Initialize a new select menu.
5499
- #
5500
- # @param [String, Symbol] custom_id Custom ID of the select menu.
5501
- # @param [Array<Discorb::SelectMenu::Option>] options The options of the select menu.
5502
- # @param [String] placeholder The placeholder of the select menu.
5503
- # @param [Integer] min_values The minimum number of values.
5504
- # @param [Integer] max_values The maximum number of values.
5505
- def initialize: (
5506
- (String | Symbol) custom_id,
5507
- ::Array[Discorb::SelectMenu::Option] options,
5508
- ?placeholder: String?,
5509
- ?min_values: Integer,
5510
- ?max_values: Integer
5511
- ) -> void
5512
-
5513
- #
5514
- # Converts the select menu to a hash.
5515
- #
5516
- # @see https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure Official Discord API docs
5517
- # @return [Hash] A hash representation of the select menu.
5518
- def to_hash: () -> ::Hash[untyped, untyped]
5519
-
5520
- def inspect: () -> untyped
5521
-
5522
- def hash_emoji: (untyped emoji) -> untyped
5523
-
5524
- # @return [String] The custom ID of the select menu.
5525
- attr_accessor custom_id: String
5526
-
5527
- # @return [Array<SelectMenu::Option>] The options of the select menu.
5528
- attr_accessor options: ::Array[SelectMenu::Option]
5529
-
5530
- # @return [Integer] The minimum number of values.
5531
- attr_accessor min_values: Integer
5532
-
5533
- # @return [Integer] The maximum number of values.
5534
- attr_accessor max_values: Integer
5535
-
5536
- # @return [Boolean] Whether the select menu is disabled.
5537
- attr_accessor disabled: bool
5538
-
5539
- #
5540
- # Represents an option of a select menu.
5541
- class Option
5542
- #
5543
- # Initialize a new option.
5544
- #
5545
- # @param [String] label The label of the option.
5546
- # @param [String] value The value of the option.
5547
- # @param [String] description The description of the option.
5548
- # @param [Discorb::Emoji] emoji The emoji of the option.
5549
- # @param [Boolean] default Whether the option is default.
5550
- def initialize: (
5551
- String label,
5552
- String value,
5553
- ?description: String?,
5554
- ?emoji: Discorb::Emoji?,
5555
- ?default: bool
5556
- ) -> void
5557
-
5558
- #
5559
- # Converts the option to a hash.
5560
- #
5561
- # @see https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure Official Discord API docs
5562
- # @return [Hash] Hash representation of the option.
5563
- def to_hash: () -> ::Hash[untyped, untyped]
5564
-
5565
- #
5566
- # Creates a new option from a hash.
5567
- #
5568
- # @param [Hash] data A hash representing the option.
5569
- #
5570
- # @return [Discorb::SelectMenu::Option] A new option.
5571
- def self.from_hash: (::Hash[untyped, untyped] data) -> Discorb::SelectMenu::Option
5572
-
5573
- # @return [String] The label of the option.
5574
- attr_accessor label: String
5575
-
5576
- # @return [String] The value of the option.
5577
- attr_accessor value: String
5578
-
5579
- # @return [String] The description of the option.
5580
- attr_accessor description: String
5581
-
5582
- # @return [Discorb::Emoji] The emoji of the option.
5583
- attr_accessor emoji: Discorb::Emoji
5584
-
5585
- # @return [Boolean] Whether the option is default.
5586
- attr_accessor default: bool
5587
- end
5588
- end
5589
-
5347
+ # Extended hash class. This is used for storing pair of ID and object.
5590
5348
  class Dictionary[K, V]
5591
5349
  #
5592
5350
  # Initialize a new Dictionary.
@@ -5752,194 +5510,10 @@ module Discorb
5752
5510
  #
5753
5511
  # Class to handle rate limiting.
5754
5512
  #
5755
- # Handles application commands.
5756
- module ApplicationCommand
5757
- #
5758
- # Module to handle application commands.
5759
- module Handler
5760
- #
5761
- # Add new top-level command.
5762
- #
5763
- # @param [String] command_name Command name.
5764
- # @param [String] description Command description.
5765
- # @param [Hash{String => Hash{:description => String, :optional => Boolean, :type => Object}}] options Command options.
5766
- # The key is the option name, the value is a hash with the following keys:
5767
- #
5768
- # | Key | Type | Description |
5769
- # | --- | --- | --- |
5770
- # | `:description` | `String` | Description of the option. |
5771
- # | `:required` | Whether the argument is required. `optional` will be used if not specified. |
5772
- # | `:optional` | Whether the argument is optional. `required` will be used if not specified. |
5773
- # | `:type` | `Object` | Type of the option. |
5774
- # | `:choice` | `Hash{String => String, Integer, Float}` | Type of the option. |
5775
- # | `:default` | `Object` | Default value of the option. |
5776
- # | `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
5777
- # | `:autocomplete` | `Proc` | Autocomplete function. |
5778
- # | `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
5779
- #
5780
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5781
- # @param [Proc] block Command block.
5782
- #
5783
- # @return [Discorb::ApplicationCommand::Command::SlashCommand] Command object.
5784
- #
5785
- # @see file:docs/application_command.md#register-slash-command Application Comamnds: Register Slash Command
5786
- # @see file:docs/cli/setup.md CLI: setup
5787
- def slash: (
5788
- String command_name,
5789
- String description,
5790
- ?::Hash[String, String | Integer | Float] options,
5791
- ?guild_ids: (::Array[untyped] | bool)?
5792
- ) -> Discorb::ApplicationCommand::Command::SlashCommand
5793
-
5794
- #
5795
- # Add new command with group.
5796
- #
5797
- # @param [String] command_name Command name.
5798
- # @param [String] description Command description.
5799
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5800
- #
5801
- # @yield Block to yield with the command.
5802
- # @yieldparam [Discorb::ApplicationCommand::Command::GroupCommand] group Group command.
5803
- #
5804
- # @return [Discorb::ApplicationCommand::Command::GroupCommand] Command object.
5805
- #
5806
- # @see file:docs/application_command.md Application Commands
5807
- # @see file:docs/cli/setup.md CLI: setup
5808
- def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommand::Command::GroupCommand group) -> void } -> Discorb::ApplicationCommand::Command::GroupCommand
5809
-
5810
- #
5811
- # Add message context menu command.
5812
- #
5813
- # @param [String] command_name Command name.
5814
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5815
- # @param [Proc] block Command block.
5816
- # @yield [interaction, message] Block to execute.
5817
- # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
5818
- # @yieldparam [Discorb::Message] message Message object.
5819
- #
5820
- # @return [Discorb::ApplicationCommand::Command] Command object.
5821
- def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command
5822
-
5823
- #
5824
- # Add user context menu command.
5825
- #
5826
- # @param [String] command_name Command name.
5827
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
5828
- # @param [Proc] block Command block.
5829
- # @yield [interaction, user] Block to execute.
5830
- # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
5831
- # @yieldparam [Discorb::User] user User object.
5832
- #
5833
- # @return [Discorb::ApplicationCommand::Command] Command object.
5834
- def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command
5835
-
5836
- #
5837
- # Setup commands.
5838
- # @async
5839
- # @see Client#initialize
5840
- #
5841
- # @param [String] token Bot token.
5842
- # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to use as default. If `false` is given, it will be global command.
5843
- #
5844
- # @note `token` parameter only required if you don't run client.
5845
- def setup_commands: (?String? token, ?guild_ids: (::Array[untyped] | bool)?) -> untyped
5846
- end
5847
-
5848
- #
5849
- # Represents a application command.
5850
- # @abstract
5851
- class Command < Discorb::DiscordModel
5852
- # @return [String] The name of the command.
5853
- attr_reader name: String
5854
-
5855
- # @return [Array<#to_s>] The guild ids that the command is enabled in.
5856
- attr_reader guild_ids: ::Array[untyped]
5857
-
5858
- # @return [Proc] The block of the command.
5859
- attr_reader block: Proc
5860
-
5861
- # @return [:chat_input, :user, :message] The type of the command.
5862
- attr_reader type: Symbol
5863
-
5864
- # @return [Integer] The raw type of the command.
5865
- attr_reader type_raw: Integer
5866
-
5867
- # @return [Discorb::Dictionary{Discorb::Snowflake, :global => Discorb::Snowflake}] The ID mapping.
5868
- attr_reader id_map: Discorb::Dictionary[Discorb::Snowflake, Symbol, Discorb::Snowflake]
5869
-
5870
- #
5871
- # Represents the slash command.
5872
- class SlashCommand < Discorb::ApplicationCommand::Command
5873
- #
5874
- # Returns the commands name.
5875
- #
5876
- # @return [String] The name of the command.
5877
- def to_s: () -> String
5878
-
5879
- # @return [String] The description of the command.
5880
- attr_reader description: String
5881
-
5882
- # @return [Hash{String => Hash}] The options of the command.
5883
- attr_reader options: ::Hash[String, ::Hash[untyped, untyped]]
5884
- end
5885
-
5886
- #
5887
- # Represents the command with subcommands.
5888
- class GroupCommand < Discorb::ApplicationCommand::Command
5889
- #
5890
- # Add new subcommand.
5891
- #
5892
- # @param (see Discorb::ApplicationCommand::Handler#slash)
5893
- # @return [Discorb::ApplicationCommand::Command::SlashCommand] The added subcommand.
5894
- def slash: (String command_name, String description, ?::Hash[String, String | Integer | Float] options) -> Discorb::ApplicationCommand::Command::SlashCommand
5895
-
5896
- #
5897
- # Add new subcommand group.
5898
- #
5899
- # @param [String] command_name Group name.
5900
- # @param [String] description Group description.
5901
- #
5902
- # @yield Block to yield with the command.
5903
- # @yieldparam [Discorb::ApplicationCommand::Command::SubcommandGroup] group Group command.
5904
- #
5905
- # @return [Discorb::ApplicationCommand::Command::SubcommandGroup] Command object.
5906
- #
5907
- # @see file:docs/application_command.md Application Commands
5908
- def group: (String command_name, String description) ?{ (Discorb::ApplicationCommand::Command::SubcommandGroup group) -> void } -> Discorb::ApplicationCommand::Command::SubcommandGroup
5909
-
5910
- #
5911
- # Returns the command name.
5912
- #
5913
- # @return [String] The command name.
5914
- def to_s: () -> String
5915
-
5916
- # @return [Array<Discorb::ApplicationCommand::Command::SlashCommand, Discorb::ApplicationCommand::Command::SubcommandGroup>] The subcommands of the command.
5917
- attr_reader commands: ::Array[(Discorb::ApplicationCommand::Command::SlashCommand | Discorb::ApplicationCommand::Command::SubcommandGroup)]
5918
-
5919
- # @return [String] The description of the command.
5920
- attr_reader description: String
5921
- end
5922
-
5923
- #
5924
- # Represents the subcommand group.
5925
- class SubcommandGroup < Discorb::ApplicationCommand::Command::GroupCommand
5926
- #
5927
- # Add new subcommand.
5928
- # @param (see Discorb::ApplicationCommand::Handler#slash)
5929
- # @return [Discorb::ApplicationCommand::Command::SlashCommand] The added subcommand.
5930
- def slash: (String command_name, String description, ?::Hash[String, String | Integer | Float] options) -> Discorb::ApplicationCommand::Command::SlashCommand
5931
-
5932
- # @return [Array<Discorb::ApplicationCommand::Command::SlashCommand>] The subcommands of the command.
5933
- attr_reader commands: ::Array[Discorb::ApplicationCommand::Command::SlashCommand]
5934
- end
5935
- end
5936
- end
5937
-
5938
- #
5939
- # Represents a Discord application.
5940
- class Application < Discorb::DiscordModel
5941
- # @return [Discorb::Snowflake] The application's ID.
5942
- attr_reader id: Discorb::Snowflake
5513
+ # Represents a Discord application.
5514
+ class Application < Discorb::DiscordModel
5515
+ # @return [Discorb::Snowflake] The application's ID.
5516
+ attr_reader id: Discorb::Snowflake
5943
5517
 
5944
5518
  # @return [String] The application's name.
5945
5519
  attr_reader name: String
@@ -6109,8 +5683,34 @@ module Discorb
6109
5683
  # @return [String] The name of the account.
6110
5684
  attr_reader name: String
6111
5685
  end
5686
+
5687
+ #
5688
+ # Represents an application for an integration.
5689
+ class Application < Discorb::DiscordModel
5690
+ # @return [Discorb::Snowflake] The ID of the application.
5691
+ attr_reader id: Discorb::Snowflake
5692
+
5693
+ # @return [String] The name of the application.
5694
+ attr_reader name: String
5695
+
5696
+ # @return [Asset] The icon of the application.
5697
+ # @return [nil] If the application has no icon.
5698
+ attr_reader icon: Asset?
5699
+
5700
+ # @return [String] The description of the application.
5701
+ attr_reader description: String
5702
+
5703
+ # @return [String] The summary of the application.
5704
+ attr_reader summary: String
5705
+
5706
+ # @return [Discorb::User] The bot user associated with the application.
5707
+ # @return [nil] If the application has no bot user.
5708
+ attr_reader bot: Discorb::User?
5709
+ end
6112
5710
  end
6113
5711
 
5712
+ #
5713
+ # Represents a state of user in voice channel.
6114
5714
  class VoiceState < Discorb::DiscordModel
6115
5715
  # @return [Discorb::Snowflake] The ID of the guild this voice state is for.
6116
5716
  attr_reader session_id: Discorb::Snowflake
@@ -6380,6 +5980,38 @@ module Discorb
6380
5980
  end
6381
5981
  end
6382
5982
 
5983
+ #
5984
+ # Represents a allowed mentions in a message.
5985
+ class AllowedMentions
5986
+ #
5987
+ # Initializes a new instance of the AllowedMentions class.
5988
+ #
5989
+ # @param [Boolean] everyone Whether to allow @everyone or @here.
5990
+ # @param [Boolean, Array<Discorb::Role>] roles The roles to allow, or false to disable.
5991
+ # @param [Boolean, Array<Discorb::User>] users The users to allow, or false to disable.
5992
+ # @param [Boolean] replied_user Whether to ping the user that sent the message to reply.
5993
+ def initialize: (
5994
+ ?everyone: bool?,
5995
+ ?roles: (bool | ::Array[Discorb::Role])?,
5996
+ ?users: (bool | ::Array[Discorb::User])?,
5997
+ ?replied_user: bool?
5998
+ ) -> void
5999
+
6000
+ def inspect: () -> untyped
6001
+
6002
+ # @return [Boolean] Whether to allow @everyone or @here.
6003
+ attr_accessor everyone: bool
6004
+
6005
+ # @return [Boolean, Array<Discorb::Role>] The roles to allow, or false to disable.
6006
+ attr_accessor roles: (bool | ::Array[Discorb::Role])
6007
+
6008
+ # @return [Boolean, Array<Discorb::User>] The users to allow, or false to disable.
6009
+ attr_accessor users: (bool | ::Array[Discorb::User])
6010
+
6011
+ # @return [Boolean] Whether to ping the user that sent the message to reply.
6012
+ attr_accessor replied_user: bool
6013
+ end
6014
+
6383
6015
  #
6384
6016
  # Represents an activity for Gateway Command.
6385
6017
  class Activity
@@ -6401,7 +6033,7 @@ module Discorb
6401
6033
  end
6402
6034
 
6403
6035
  #
6404
- # Represents a user interaction with the bot.
6036
+ # Represents an interaction of Discord.
6405
6037
  class Interaction < Discorb::DiscordModel
6406
6038
  # @return [Discorb::Snowflake] The ID of the interaction.
6407
6039
  attr_reader id: Discorb::Snowflake
@@ -6435,7 +6067,7 @@ module Discorb
6435
6067
 
6436
6068
  #
6437
6069
  # A module for response with source.
6438
- module SourceResponse
6070
+ module SourceResponder
6439
6071
  #
6440
6072
  # Response with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`(`5`).
6441
6073
  #
@@ -6459,7 +6091,7 @@ module Discorb
6459
6091
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
6460
6092
  # @param [Boolean] ephemeral Whether to make the response ephemeral.
6461
6093
  #
6462
- # @return [Discorb::Interaction::SourceResponse::CallbackMessage, Discorb::Webhook::Message] The callback message.
6094
+ # @return [Discorb::Interaction::SourceResponder::CallbackMessage, Discorb::Webhook::Message] The callback message.
6463
6095
  def post: (
6464
6096
  ?String? content,
6465
6097
  ?tts: bool,
@@ -6468,8 +6100,10 @@ module Discorb
6468
6100
  ?allowed_mentions: Discorb::AllowedMentions?,
6469
6101
  ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
6470
6102
  ?ephemeral: bool
6471
- ) -> (Discorb::Interaction::SourceResponse::CallbackMessage | Discorb::Webhook::Message)
6103
+ ) -> (Discorb::Interaction::SourceResponder::CallbackMessage | Discorb::Webhook::Message)
6472
6104
 
6105
+ #
6106
+ # Represents of a callback message of interaction.
6473
6107
  class CallbackMessage
6474
6108
  #
6475
6109
  # Edits the callback message.
@@ -6505,7 +6139,7 @@ module Discorb
6505
6139
 
6506
6140
  #
6507
6141
  # A module for response with update.
6508
- module UpdateResponse
6142
+ module UpdateResponder
6509
6143
  #
6510
6144
  # Response with `DEFERRED_UPDATE_MESSAGE`(`6`).
6511
6145
  # @async
@@ -6539,50 +6173,363 @@ module Discorb
6539
6173
  ?ephemeral: bool
6540
6174
  ) -> Async::Task[void]
6541
6175
  end
6176
+
6177
+ #
6178
+ # A module for response with modal.
6179
+ module ModalResponder
6180
+ #
6181
+ # Response with `MODAL`(`9`).
6182
+ #
6183
+ # @param [String] title The title of the modal.
6184
+ # @param [String] custom_id The custom id of the modal.
6185
+ # @param [Array<Discorb::TextInput>] components The text inputs to send.
6186
+ #
6187
+ # @return [Async::Task<void>] The task.
6188
+ def show_modal: (String title, String custom_id, ::Array[Discorb::TextInput] components) -> Async::Task[void]
6189
+ end
6542
6190
  end
6543
6191
 
6544
6192
  #
6545
- # Represents a command interaction.
6546
- class CommandInteraction < Discorb::Interaction
6547
- include Discorb::Interaction::SourceResponse
6548
- #
6549
- # Response with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`(`5`).
6550
- #
6551
- # @async
6193
+ # Represents a button component.
6194
+ class Button < Discorb::Component
6552
6195
  #
6553
- # @param [Boolean] ephemeral Whether to make the response ephemeral.
6196
+ # Initialize a new button.
6554
6197
  #
6555
- # @return [Async::Task<void>] The task.
6556
- def defer_source: (?ephemeral: bool) -> Async::Task[void]
6198
+ # @param [String] label The label of the button.
6199
+ # @param [:primary, :secondary, :success, :danger, :link] style The style of the button.
6200
+ # @param [Discorb::Emoji] emoji The emoji of the button.
6201
+ # @param [String] custom_id The custom ID of the button.
6202
+ # @param [String] url The URL of the button.
6203
+ # @param [Boolean] disabled Whether the button is disabled.
6204
+ def initialize: (
6205
+ String label,
6206
+ ?Symbol style,
6207
+ ?emoji: Discorb::Emoji?,
6208
+ ?custom_id: String?,
6209
+ ?url: String?,
6210
+ ?disabled: bool
6211
+ ) -> void
6557
6212
 
6558
6213
  #
6559
- # Response with `CHANNEL_MESSAGE_WITH_SOURCE`(`4`).
6214
+ # Converts the button to a hash.
6560
6215
  #
6561
- # @async
6216
+ # @see https://discord.com/developers/docs/interactions/message-components#button-object-button-structure Official Discord API docs
6217
+ # @return [Hash] A hash representation of the button.
6218
+ def to_hash: () -> ::Hash[untyped, untyped]
6219
+
6220
+ def inspect: () -> untyped
6221
+
6562
6222
  #
6563
- # @param [String] content The content of the response.
6564
- # @param [Boolean] tts Whether to send the message as text-to-speech.
6565
- # @param [Discorb::Embed] embed The embed to send.
6566
- # @param [Array<Discorb::Embed>] embeds The embeds to send. (max: 10)
6567
- # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
6568
- # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
6569
- # @param [Boolean] ephemeral Whether to make the response ephemeral.
6223
+ # Creates a new button from a hash.
6570
6224
  #
6571
- # @return [Discorb::Interaction::SourceResponse::CallbackMessage, Discorb::Webhook::Message] The callback message.
6572
- def post: (
6573
- ?String? content,
6574
- ?tts: bool,
6575
- ?embed: Discorb::Embed?,
6576
- ?embeds: ::Array[Discorb::Embed]?,
6577
- ?allowed_mentions: Discorb::AllowedMentions?,
6578
- ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
6579
- ?ephemeral: bool
6580
- ) -> (Discorb::Interaction::SourceResponse::CallbackMessage | Discorb::Webhook::Message)
6581
-
6225
+ # @param [Hash] data The hash to create the button from.
6582
6226
  #
6583
- # Represents a slash command interaction.
6584
- class SlashCommand < Discorb::CommandInteraction
6585
- end
6227
+ # @return [Discorb::Button] The created button.
6228
+ def self.from_hash: (::Hash[untyped, untyped] data) -> Discorb::Button
6229
+
6230
+ # @return [String] The label of the button.
6231
+ attr_accessor label: String
6232
+
6233
+ # @return [:primary, :secondary, :success, :danger, :link] The style of the button.
6234
+ attr_accessor style: Symbol
6235
+
6236
+ # @return [Discorb::Emoji] The emoji of the button.
6237
+ attr_accessor emoji: Discorb::Emoji
6238
+
6239
+ # @return [String] The custom ID of the button.
6240
+ # Won't be used if the style is `:link`.
6241
+ attr_accessor custom_id: String
6242
+
6243
+ # @return [String] The URL of the button.
6244
+ # Only used when the style is `:link`.
6245
+ attr_accessor url: String
6246
+
6247
+ # @return [Boolean] Whether the button is disabled.
6248
+ attr_accessor disabled: bool
6249
+ end
6250
+
6251
+ #
6252
+ # Represents a modal interaction.
6253
+ class ModalInteraction < Discorb::Interaction
6254
+ include Discorb::Interaction::SourceResponder
6255
+ #
6256
+ # Response with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`(`5`).
6257
+ #
6258
+ # @async
6259
+ #
6260
+ # @param [Boolean] ephemeral Whether to make the response ephemeral.
6261
+ #
6262
+ # @return [Async::Task<void>] The task.
6263
+ def defer_source: (?ephemeral: bool) -> Async::Task[void]
6264
+
6265
+ #
6266
+ # Response with `CHANNEL_MESSAGE_WITH_SOURCE`(`4`).
6267
+ #
6268
+ # @async
6269
+ #
6270
+ # @param [String] content The content of the response.
6271
+ # @param [Boolean] tts Whether to send the message as text-to-speech.
6272
+ # @param [Discorb::Embed] embed The embed to send.
6273
+ # @param [Array<Discorb::Embed>] embeds The embeds to send. (max: 10)
6274
+ # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
6275
+ # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
6276
+ # @param [Boolean] ephemeral Whether to make the response ephemeral.
6277
+ #
6278
+ # @return [Discorb::Interaction::SourceResponder::CallbackMessage, Discorb::Webhook::Message] The callback message.
6279
+ def post: (
6280
+ ?String? content,
6281
+ ?tts: bool,
6282
+ ?embed: Discorb::Embed?,
6283
+ ?embeds: ::Array[Discorb::Embed]?,
6284
+ ?allowed_mentions: Discorb::AllowedMentions?,
6285
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
6286
+ ?ephemeral: bool
6287
+ ) -> (Discorb::Interaction::SourceResponder::CallbackMessage | Discorb::Webhook::Message)
6288
+
6289
+ # @return [String] The custom id of the modal.
6290
+ attr_reader custom_id: String
6291
+
6292
+ # @return [{String => String}] The contents of the modal.
6293
+ attr_reader contents: ::Hash[String, String]
6294
+ end
6295
+
6296
+ #
6297
+ # Handles application commands.
6298
+ module ApplicationCommand
6299
+ #
6300
+ # Represents a application command.
6301
+ # @abstract
6302
+ class Command < Discorb::DiscordModel
6303
+ # @return [String] The name of the command.
6304
+ attr_reader name: String
6305
+
6306
+ # @return [Array<#to_s>] The guild ids that the command is enabled in.
6307
+ attr_reader guild_ids: ::Array[untyped]
6308
+
6309
+ # @return [Proc] The block of the command.
6310
+ attr_reader block: Proc
6311
+
6312
+ # @return [:chat_input, :user, :message] The type of the command.
6313
+ attr_reader type: Symbol
6314
+
6315
+ # @return [Integer] The raw type of the command.
6316
+ attr_reader type_raw: Integer
6317
+
6318
+ # @return [Discorb::Dictionary{Discorb::Snowflake, :global => Discorb::Snowflake}] The ID mapping.
6319
+ attr_reader id_map: Discorb::Dictionary[Discorb::Snowflake, Symbol, Discorb::Snowflake]
6320
+
6321
+ #
6322
+ # Represents the slash command.
6323
+ class SlashCommand < Discorb::ApplicationCommand::Command
6324
+ #
6325
+ # Returns the commands name.
6326
+ #
6327
+ # @return [String] The name of the command.
6328
+ def to_s: () -> String
6329
+
6330
+ # @return [String] The description of the command.
6331
+ attr_reader description: String
6332
+
6333
+ # @return [Hash{String => Hash}] The options of the command.
6334
+ attr_reader options: ::Hash[String, ::Hash[untyped, untyped]]
6335
+ end
6336
+
6337
+ #
6338
+ # Represents the command with subcommands.
6339
+ class GroupCommand < Discorb::ApplicationCommand::Command
6340
+ #
6341
+ # Add new subcommand.
6342
+ #
6343
+ # @param (see Discorb::ApplicationCommand::Handler#slash)
6344
+ # @return [Discorb::ApplicationCommand::Command::SlashCommand] The added subcommand.
6345
+ def slash: (String command_name, String description, ?::Hash[String, String | Integer | Float] options) -> Discorb::ApplicationCommand::Command::SlashCommand
6346
+
6347
+ #
6348
+ # Add new subcommand group.
6349
+ #
6350
+ # @param [String] command_name Group name.
6351
+ # @param [String] description Group description.
6352
+ #
6353
+ # @yield Block to yield with the command.
6354
+ # @yieldparam [Discorb::ApplicationCommand::Command::SubcommandGroup] group Group command.
6355
+ #
6356
+ # @return [Discorb::ApplicationCommand::Command::SubcommandGroup] Command object.
6357
+ #
6358
+ # @see file:docs/application_command.md Application Commands
6359
+ def group: (String command_name, String description) ?{ (Discorb::ApplicationCommand::Command::SubcommandGroup group) -> void } -> Discorb::ApplicationCommand::Command::SubcommandGroup
6360
+
6361
+ #
6362
+ # Returns the command name.
6363
+ #
6364
+ # @return [String] The command name.
6365
+ def to_s: () -> String
6366
+
6367
+ # @return [Array<Discorb::ApplicationCommand::Command::SlashCommand, Discorb::ApplicationCommand::Command::SubcommandGroup>] The subcommands of the command.
6368
+ attr_reader commands: ::Array[(Discorb::ApplicationCommand::Command::SlashCommand | Discorb::ApplicationCommand::Command::SubcommandGroup)]
6369
+
6370
+ # @return [String] The description of the command.
6371
+ attr_reader description: String
6372
+ end
6373
+
6374
+ #
6375
+ # Represents the subcommand group.
6376
+ class SubcommandGroup < Discorb::ApplicationCommand::Command::GroupCommand
6377
+ #
6378
+ # Add new subcommand.
6379
+ # @param (see Discorb::ApplicationCommand::Handler#slash)
6380
+ # @return [Discorb::ApplicationCommand::Command::SlashCommand] The added subcommand.
6381
+ def slash: (String command_name, String description, ?::Hash[String, String | Integer | Float] options) -> Discorb::ApplicationCommand::Command::SlashCommand
6382
+
6383
+ # @return [Array<Discorb::ApplicationCommand::Command::SlashCommand>] The subcommands of the command.
6384
+ attr_reader commands: ::Array[Discorb::ApplicationCommand::Command::SlashCommand]
6385
+ end
6386
+ end
6387
+
6388
+ #
6389
+ # Module to handle application commands.
6390
+ module Handler
6391
+ #
6392
+ # Add new top-level command.
6393
+ #
6394
+ # @param [String] command_name Command name.
6395
+ # @param [String] description Command description.
6396
+ # @param [Hash{String => Hash{:description => String, :optional => Boolean, :type => Object}}] options Command options.
6397
+ # The key is the option name, the value is a hash with the following keys:
6398
+ #
6399
+ # | Key | Type | Description |
6400
+ # | --- | --- | --- |
6401
+ # | `:description` | `String` | Description of the option. |
6402
+ # | `:required` | Whether the argument is required. `optional` will be used if not specified. |
6403
+ # | `:optional` | Whether the argument is optional. `required` will be used if not specified. |
6404
+ # | `:type` | `Object` | Type of the option. |
6405
+ # | `:choice` | `Hash{String => String, Integer, Float}` | Type of the option. |
6406
+ # | `:default` | `Object` | Default value of the option. |
6407
+ # | `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
6408
+ # | `:autocomplete` | `Proc` | Autocomplete function. |
6409
+ # | `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
6410
+ #
6411
+ # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
6412
+ # @param [Proc] block Command block.
6413
+ #
6414
+ # @return [Discorb::ApplicationCommand::Command::SlashCommand] Command object.
6415
+ #
6416
+ # @see file:docs/application_command.md#register-slash-command Application Comamnds: Register Slash Command
6417
+ # @see file:docs/cli/setup.md CLI: setup
6418
+ def slash: (
6419
+ String command_name,
6420
+ String description,
6421
+ ?::Hash[String, String | Integer | Float] options,
6422
+ ?guild_ids: (::Array[untyped] | bool)?
6423
+ ) -> Discorb::ApplicationCommand::Command::SlashCommand
6424
+
6425
+ #
6426
+ # Add new command with group.
6427
+ #
6428
+ # @param [String] command_name Command name.
6429
+ # @param [String] description Command description.
6430
+ # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
6431
+ #
6432
+ # @yield Block to yield with the command.
6433
+ # @yieldparam [Discorb::ApplicationCommand::Command::GroupCommand] group Group command.
6434
+ #
6435
+ # @return [Discorb::ApplicationCommand::Command::GroupCommand] Command object.
6436
+ #
6437
+ # @see file:docs/application_command.md Application Commands
6438
+ # @see file:docs/cli/setup.md CLI: setup
6439
+ def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommand::Command::GroupCommand group) -> void } -> Discorb::ApplicationCommand::Command::GroupCommand
6440
+
6441
+ #
6442
+ # Add message context menu command.
6443
+ #
6444
+ # @param [String] command_name Command name.
6445
+ # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
6446
+ # @param [Proc] block Command block.
6447
+ # @yield [interaction, message] Block to execute.
6448
+ # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
6449
+ # @yieldparam [Discorb::Message] message Message object.
6450
+ #
6451
+ # @return [Discorb::ApplicationCommand::Command] Command object.
6452
+ def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command
6453
+
6454
+ #
6455
+ # Add user context menu command.
6456
+ #
6457
+ # @param [String] command_name Command name.
6458
+ # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
6459
+ # @param [Proc] block Command block.
6460
+ # @yield [interaction, user] Block to execute.
6461
+ # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
6462
+ # @yieldparam [Discorb::User] user User object.
6463
+ #
6464
+ # @return [Discorb::ApplicationCommand::Command] Command object.
6465
+ def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command
6466
+
6467
+ #
6468
+ # Setup commands.
6469
+ # @async
6470
+ # @see Client#initialize
6471
+ #
6472
+ # @param [String] token Bot token.
6473
+ # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to use as default. If `false` is given, it will be global command.
6474
+ #
6475
+ # @note `token` parameter only required if you don't run client.
6476
+ def setup_commands: (?String? token, ?guild_ids: (::Array[untyped] | bool)?) -> untyped
6477
+ end
6478
+ end
6479
+
6480
+ #
6481
+ # Represents a command interaction.
6482
+ class CommandInteraction < Discorb::Interaction
6483
+ include Discorb::Interaction::SourceResponder
6484
+ include Discorb::Interaction::ModalResponder
6485
+ #
6486
+ # Response with `MODAL`(`9`).
6487
+ #
6488
+ # @param [String] title The title of the modal.
6489
+ # @param [String] custom_id The custom id of the modal.
6490
+ # @param [Array<Discorb::TextInput>] components The text inputs to send.
6491
+ #
6492
+ # @return [Async::Task<void>] The task.
6493
+ def show_modal: (String title, String custom_id, ::Array[Discorb::TextInput] components) -> Async::Task[void]
6494
+
6495
+ #
6496
+ # Response with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`(`5`).
6497
+ #
6498
+ # @async
6499
+ #
6500
+ # @param [Boolean] ephemeral Whether to make the response ephemeral.
6501
+ #
6502
+ # @return [Async::Task<void>] The task.
6503
+ def defer_source: (?ephemeral: bool) -> Async::Task[void]
6504
+
6505
+ #
6506
+ # Response with `CHANNEL_MESSAGE_WITH_SOURCE`(`4`).
6507
+ #
6508
+ # @async
6509
+ #
6510
+ # @param [String] content The content of the response.
6511
+ # @param [Boolean] tts Whether to send the message as text-to-speech.
6512
+ # @param [Discorb::Embed] embed The embed to send.
6513
+ # @param [Array<Discorb::Embed>] embeds The embeds to send. (max: 10)
6514
+ # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
6515
+ # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
6516
+ # @param [Boolean] ephemeral Whether to make the response ephemeral.
6517
+ #
6518
+ # @return [Discorb::Interaction::SourceResponder::CallbackMessage, Discorb::Webhook::Message] The callback message.
6519
+ def post: (
6520
+ ?String? content,
6521
+ ?tts: bool,
6522
+ ?embed: Discorb::Embed?,
6523
+ ?embeds: ::Array[Discorb::Embed]?,
6524
+ ?allowed_mentions: Discorb::AllowedMentions?,
6525
+ ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
6526
+ ?ephemeral: bool
6527
+ ) -> (Discorb::Interaction::SourceResponder::CallbackMessage | Discorb::Webhook::Message)
6528
+
6529
+ #
6530
+ # Represents a slash command interaction.
6531
+ class SlashCommand < Discorb::CommandInteraction
6532
+ end
6586
6533
 
6587
6534
  #
6588
6535
  # Represents a user context menu interaction.
@@ -6597,12 +6544,192 @@ module Discorb
6597
6544
  end
6598
6545
  end
6599
6546
 
6547
+ #
6548
+ # Represents a text input component.
6549
+ class TextInput < Discorb::Component
6550
+ STYLES: untyped
6551
+
6552
+ #
6553
+ # Initialize a new text input component.
6554
+ #
6555
+ # @param [String] label The label of the text input.
6556
+ # @param [String] custom_id The custom id of the text input.
6557
+ # @param [:short, :paragraph] style The style of the text input.
6558
+ # @param [Integer, nil] min_length The minimum length of the text input.
6559
+ # @param [Integer, nil] max_length The maximum length of the text input.
6560
+ # @param [Boolean] required Whether the text input is required.
6561
+ # @param [String, nil] value The prefilled value of the text input.
6562
+ # @param [String, nil] placeholder The placeholder of the text input.
6563
+ def initialize: (
6564
+ String label,
6565
+ String custom_id,
6566
+ Symbol style,
6567
+ ?min_length: Integer?,
6568
+ ?max_length: Integer?,
6569
+ ?required: bool,
6570
+ ?value: String?,
6571
+ ?placeholder: String?
6572
+ ) -> void
6573
+
6574
+ #
6575
+ # Converts the select menu to a hash.
6576
+ #
6577
+ # @see https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure Official Discord API docs
6578
+ # @return [Hash] A hash representation of the text input.
6579
+ def to_hash: () -> ::Hash[untyped, untyped]
6580
+
6581
+ #
6582
+ # Creates a new text input from a hash.
6583
+ #
6584
+ # @param [Hash] data The hash to create the text input from.
6585
+ #
6586
+ # @return [Discorb::TextInput] The created text input.
6587
+ def self.from_hash: (::Hash[untyped, untyped] data) -> Discorb::TextInput
6588
+
6589
+ # @return [String] The label of the text input.
6590
+ attr_accessor label: String
6591
+
6592
+ # @return [String] The custom id of the text input.
6593
+ attr_accessor custom_id: String
6594
+
6595
+ # @return [:short, :paragraph] The style of the text input.
6596
+ attr_accessor style: Symbol
6597
+
6598
+ # @return [Integer, nil] The minimum length of the text input.
6599
+ attr_accessor min_length: Integer?
6600
+
6601
+ # @return [Integer, nil] The maximum length of the text input.
6602
+ attr_accessor max_length: Integer?
6603
+
6604
+ # @return [Boolean] Whether the text input is required.
6605
+ attr_accessor required: bool
6606
+
6607
+ # @return [String, nil] The prefilled value of the text input.
6608
+ attr_accessor value: String?
6609
+
6610
+ # @return [String, nil] The placeholder of the text input.
6611
+ attr_accessor placeholder: String?
6612
+ end
6613
+
6614
+ #
6615
+ # Represents a select menu component.
6616
+ class SelectMenu < Discorb::Component
6617
+ #
6618
+ # Initialize a new select menu.
6619
+ #
6620
+ # @param [String, Symbol] custom_id Custom ID of the select menu.
6621
+ # @param [Array<Discorb::SelectMenu::Option>] options The options of the select menu.
6622
+ # @param [String] placeholder The placeholder of the select menu.
6623
+ # @param [Integer] min_values The minimum number of values.
6624
+ # @param [Integer] max_values The maximum number of values.
6625
+ def initialize: (
6626
+ (String | Symbol) custom_id,
6627
+ ::Array[Discorb::SelectMenu::Option] options,
6628
+ ?placeholder: String?,
6629
+ ?min_values: Integer,
6630
+ ?max_values: Integer
6631
+ ) -> void
6632
+
6633
+ #
6634
+ # Converts the select menu to a hash.
6635
+ #
6636
+ # @see https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure Official Discord API docs
6637
+ # @return [Hash] A hash representation of the select menu.
6638
+ def to_hash: () -> ::Hash[untyped, untyped]
6639
+
6640
+ def inspect: () -> untyped
6641
+
6642
+ #
6643
+ # Creates a new select menu from a hash.
6644
+ #
6645
+ # @param [Hash] data The hash to create the select menu from.
6646
+ #
6647
+ # @return [Discorb::SelectMenu] The created select menu.
6648
+ def self.from_hash: (::Hash[untyped, untyped] data) -> Discorb::SelectMenu
6649
+
6650
+ # @return [String] The custom ID of the select menu.
6651
+ attr_accessor custom_id: String
6652
+
6653
+ # @return [Array<SelectMenu::Option>] The options of the select menu.
6654
+ attr_accessor options: ::Array[SelectMenu::Option]
6655
+
6656
+ # @return [Integer] The minimum number of values.
6657
+ attr_accessor min_values: Integer
6658
+
6659
+ # @return [Integer] The maximum number of values.
6660
+ attr_accessor max_values: Integer
6661
+
6662
+ # @return [Boolean] Whether the select menu is disabled.
6663
+ attr_accessor disabled: bool
6664
+
6665
+ #
6666
+ # Represents an option of a select menu.
6667
+ class Option
6668
+ #
6669
+ # Initialize a new option.
6670
+ #
6671
+ # @param [String] label The label of the option.
6672
+ # @param [String] value The value of the option.
6673
+ # @param [String] description The description of the option.
6674
+ # @param [Discorb::Emoji] emoji The emoji of the option.
6675
+ # @param [Boolean] default Whether the option is default.
6676
+ def initialize: (
6677
+ String label,
6678
+ String value,
6679
+ ?description: String?,
6680
+ ?emoji: Discorb::Emoji?,
6681
+ ?default: bool
6682
+ ) -> void
6683
+
6684
+ #
6685
+ # Converts the option to a hash.
6686
+ #
6687
+ # @see https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure Official Discord API docs
6688
+ # @return [Hash] Hash representation of the option.
6689
+ def to_hash: () -> ::Hash[untyped, untyped]
6690
+
6691
+ #
6692
+ # Creates a new option from a hash.
6693
+ #
6694
+ # @param [Hash] data A hash representing the option.
6695
+ #
6696
+ # @return [Discorb::SelectMenu::Option] A new option.
6697
+ def self.from_hash: (::Hash[untyped, untyped] data) -> Discorb::SelectMenu::Option
6698
+
6699
+ # @return [String] The label of the option.
6700
+ attr_accessor label: String
6701
+
6702
+ # @return [String] The value of the option.
6703
+ attr_accessor value: String
6704
+
6705
+ # @return [String] The description of the option.
6706
+ attr_accessor description: String
6707
+
6708
+ # @return [Discorb::Emoji] The emoji of the option.
6709
+ attr_accessor emoji: Discorb::Emoji
6710
+
6711
+ # @return [Boolean] Whether the option is default.
6712
+ attr_accessor default: bool
6713
+ end
6714
+ end
6715
+
6600
6716
  #
6601
6717
  # Represents a message component interaction.
6602
6718
  # @abstract
6603
6719
  class MessageComponentInteraction < Discorb::Interaction
6604
- include Discorb::Interaction::SourceResponse
6605
- include Discorb::Interaction::UpdateResponse
6720
+ include Discorb::Interaction::SourceResponder
6721
+ include Discorb::Interaction::UpdateResponder
6722
+ include Discorb::Interaction::ModalResponder
6723
+
6724
+ #
6725
+ # Response with `MODAL`(`9`).
6726
+ #
6727
+ # @param [String] title The title of the modal.
6728
+ # @param [String] custom_id The custom id of the modal.
6729
+ # @param [Array<Discorb::TextInput>] components The text inputs to send.
6730
+ #
6731
+ # @return [Async::Task<void>] The task.
6732
+ def show_modal: (String title, String custom_id, ::Array[Discorb::TextInput] components) -> Async::Task[void]
6606
6733
 
6607
6734
  #
6608
6735
  # Response with `DEFERRED_UPDATE_MESSAGE`(`6`).
@@ -6660,7 +6787,7 @@ module Discorb
6660
6787
  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
6661
6788
  # @param [Boolean] ephemeral Whether to make the response ephemeral.
6662
6789
  #
6663
- # @return [Discorb::Interaction::SourceResponse::CallbackMessage, Discorb::Webhook::Message] The callback message.
6790
+ # @return [Discorb::Interaction::SourceResponder::CallbackMessage, Discorb::Webhook::Message] The callback message.
6664
6791
  def post: (
6665
6792
  ?String? content,
6666
6793
  ?tts: bool,
@@ -6669,7 +6796,7 @@ module Discorb
6669
6796
  ?allowed_mentions: Discorb::AllowedMentions?,
6670
6797
  ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?,
6671
6798
  ?ephemeral: bool
6672
- ) -> (Discorb::Interaction::SourceResponse::CallbackMessage | Discorb::Webhook::Message)
6799
+ ) -> (Discorb::Interaction::SourceResponder::CallbackMessage | Discorb::Webhook::Message)
6673
6800
 
6674
6801
  # @return [String] The content of the response.
6675
6802
  attr_reader custom_id: String
@@ -6704,6 +6831,7 @@ module Discorb
6704
6831
  end
6705
6832
  end
6706
6833
 
6834
+ # rubocop: disable Style/Documentation
6707
6835
  class Time
6708
6836
  #
6709
6837
  # Format a time object to a Discord formatted string.
@@ -6712,4 +6840,12 @@ class Time
6712
6840
  #
6713
6841
  # @return [String] The formatted time.
6714
6842
  def to_df: (?("f" | "F" | "d" | "D" | "t" | "T" | "R")? _type) -> String
6843
+ end
6844
+
6845
+ class Async::Task[R]
6846
+ #
6847
+ # Wait the task.
6848
+ #
6849
+ # @return [R] The result of the task.
6850
+ def wait: -> R
6715
6851
  end