discorb 0.17.1 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +1 -3
  3. data/.github/workflows/validate.yml +21 -0
  4. data/Changelog.md +10 -0
  5. data/Gemfile +6 -0
  6. data/Rakefile +210 -98
  7. data/Steepfile +28 -0
  8. data/docs/events.md +42 -6
  9. data/docs/tutorial.md +7 -7
  10. data/docs/voice_events.md +2 -2
  11. data/examples/commands/message.rb +12 -7
  12. data/examples/commands/permission.rb +2 -1
  13. data/examples/commands/slash.rb +23 -19
  14. data/examples/commands/user.rb +15 -12
  15. data/examples/components/authorization_button.rb +2 -1
  16. data/examples/components/select_menu.rb +4 -1
  17. data/examples/extension/main.rb +1 -0
  18. data/examples/extension/message_expander.rb +1 -0
  19. data/examples/sig/commands/message.rbs +5 -0
  20. data/examples/simple/eval.rb +1 -0
  21. data/examples/simple/ping_pong.rb +1 -0
  22. data/examples/simple/rolepanel.rb +16 -5
  23. data/examples/simple/shard.rb +2 -1
  24. data/examples/simple/wait_for_message.rb +3 -0
  25. data/exe/discorb +3 -3
  26. data/lib/discorb/allowed_mentions.rb +1 -1
  27. data/lib/discorb/app_command/command.rb +12 -13
  28. data/lib/discorb/app_command/handler.rb +20 -6
  29. data/lib/discorb/audit_logs.rb +6 -2
  30. data/lib/discorb/automod.rb +269 -0
  31. data/lib/discorb/channel/guild.rb +2 -1
  32. data/lib/discorb/channel/stage.rb +1 -1
  33. data/lib/discorb/channel/text.rb +11 -20
  34. data/lib/discorb/channel/thread.rb +15 -11
  35. data/lib/discorb/client.rb +12 -10
  36. data/lib/discorb/color.rb +37 -60
  37. data/lib/discorb/common.rb +1 -1
  38. data/lib/discorb/dictionary.rb +1 -1
  39. data/lib/discorb/embed.rb +4 -3
  40. data/lib/discorb/emoji.rb +2 -2
  41. data/lib/discorb/exe/about.rb +1 -1
  42. data/lib/discorb/exe/new.rb +1 -5
  43. data/lib/discorb/extension.rb +0 -4
  44. data/lib/discorb/flag.rb +2 -2
  45. data/lib/discorb/gateway.rb +21 -582
  46. data/lib/discorb/gateway_events.rb +638 -0
  47. data/lib/discorb/guild.rb +136 -17
  48. data/lib/discorb/guild_template.rb +1 -1
  49. data/lib/discorb/http.rb +47 -25
  50. data/lib/discorb/intents.rb +27 -18
  51. data/lib/discorb/interaction/command.rb +14 -10
  52. data/lib/discorb/interaction/response.rb +74 -14
  53. data/lib/discorb/member.rb +3 -3
  54. data/lib/discorb/message.rb +13 -11
  55. data/lib/discorb/message_meta.rb +2 -3
  56. data/lib/discorb/modules.rb +3 -2
  57. data/lib/discorb/presence.rb +4 -2
  58. data/lib/discorb/reaction.rb +2 -2
  59. data/lib/discorb/role.rb +1 -1
  60. data/lib/discorb/sticker.rb +3 -3
  61. data/lib/discorb/user.rb +2 -2
  62. data/lib/discorb/voice_state.rb +5 -5
  63. data/lib/discorb/webhook.rb +15 -6
  64. data/lib/discorb.rb +2 -2
  65. data/rbs_collection.lock.yaml +88 -96
  66. data/rbs_collection.yaml +21 -17
  67. data/sig/async.rbs +11 -5
  68. data/sig/discorb/activity.rbs +23 -0
  69. data/sig/discorb/allowed_mentions.rbs +44 -0
  70. data/sig/discorb/app_command/base.rbs +282 -0
  71. data/sig/discorb/app_command/handler.rbs +171 -0
  72. data/sig/discorb/application.rbs +142 -0
  73. data/sig/discorb/asset.rbs +32 -0
  74. data/sig/discorb/attachment.rbs +91 -0
  75. data/sig/discorb/audit_log.rbs +231 -0
  76. data/sig/discorb/automod.rbs +128 -0
  77. data/sig/discorb/avatar.rbs +26 -0
  78. data/sig/discorb/channel/base.rbs +179 -0
  79. data/sig/discorb/channel/category.rbs +56 -0
  80. data/sig/discorb/channel/container.rbs +29 -0
  81. data/sig/discorb/channel/dm.rbs +14 -0
  82. data/sig/discorb/channel/news.rbs +20 -0
  83. data/sig/discorb/channel/stage.rbs +77 -0
  84. data/sig/discorb/channel/text.rbs +158 -0
  85. data/sig/discorb/channel/thread.rbs +185 -0
  86. data/sig/discorb/channel/voice.rbs +41 -0
  87. data/sig/discorb/client.rbs +2495 -0
  88. data/sig/discorb/color.rbs +142 -0
  89. data/sig/discorb/component/base.rbs +28 -0
  90. data/sig/discorb/component/button.rbs +65 -0
  91. data/sig/discorb/component/select_menu.rbs +107 -0
  92. data/sig/discorb/component/text_input.rbs +69 -0
  93. data/sig/discorb/connectable.rbs +8 -0
  94. data/sig/discorb/custom_emoji.rbs +90 -0
  95. data/sig/discorb/dictionary.rbs +85 -0
  96. data/sig/discorb/discord_model.rbs +15 -0
  97. data/sig/discorb/embed.rbs +279 -0
  98. data/sig/discorb/emoji.rbs +13 -0
  99. data/sig/discorb/error.rbs +73 -0
  100. data/sig/discorb/event_handler.rbs +27 -0
  101. data/sig/discorb/extension.rbs +1734 -0
  102. data/sig/discorb/flag.rbs +72 -0
  103. data/sig/discorb/gateway.rbs +481 -0
  104. data/sig/discorb/guild.rbs +870 -0
  105. data/sig/discorb/guild_template.rbs +174 -0
  106. data/sig/discorb/http.rbs +147 -0
  107. data/sig/discorb/image.rbs +20 -0
  108. data/sig/discorb/integration.rbs +118 -0
  109. data/sig/discorb/intents.rbs +97 -0
  110. data/sig/discorb/interaction/autocomplete.rbs +9 -0
  111. data/sig/discorb/interaction/base.rbs +66 -0
  112. data/sig/discorb/interaction/command.rbs +66 -0
  113. data/sig/discorb/interaction/message_component.rbs +140 -0
  114. data/sig/discorb/interaction/modal.rbs +50 -0
  115. data/sig/discorb/interaction/responder.rbs +157 -0
  116. data/sig/discorb/invite.rbs +86 -0
  117. data/sig/discorb/member.rbs +187 -0
  118. data/sig/discorb/message.rbs +469 -0
  119. data/sig/discorb/messageable.rbs +153 -0
  120. data/sig/discorb/partial_emoji.rbs +35 -0
  121. data/sig/discorb/permissions.rbs +149 -0
  122. data/sig/discorb/presence.rbs +237 -0
  123. data/sig/discorb/reaction.rbs +33 -0
  124. data/sig/discorb/role.rbs +145 -0
  125. data/sig/discorb/scheduled_event.rbs +148 -0
  126. data/sig/discorb/shard.rbs +62 -0
  127. data/sig/discorb/snowflake.rbs +56 -0
  128. data/sig/discorb/stage_instance.rbs +63 -0
  129. data/sig/discorb/sticker.rbs +116 -0
  130. data/sig/discorb/system_channel_flag.rbs +17 -0
  131. data/sig/discorb/unicode_emoji.rbs +49 -0
  132. data/sig/discorb/user.rbs +93 -0
  133. data/sig/discorb/utils.rbs +8 -0
  134. data/sig/discorb/voice_region.rbs +30 -0
  135. data/sig/discorb/voice_state.rbs +71 -0
  136. data/sig/discorb/webhook.rbs +327 -0
  137. data/sig/discorb/welcome_screen.rbs +78 -0
  138. data/sig/discorb.rbs +5 -8661
  139. data/sig/manifest.yaml +3 -0
  140. data/sig/override.rbs +19 -0
  141. metadata +80 -3
@@ -0,0 +1,29 @@
1
+ module Discorb
2
+ #
3
+ # Module for container of channels.
4
+ module ChannelContainer
5
+ #
6
+ # Returns text channels.
7
+ #
8
+ # @return [Array<Discorb::TextChannel>] The text channels.
9
+ def text_channels: -> ::Array[Discorb::TextChannel]
10
+
11
+ #
12
+ # Returns voice channels.
13
+ #
14
+ # @return [Array<Discorb::VoiceChannel>] The voice channels.
15
+ def voice_channels: -> ::Array[Discorb::VoiceChannel]
16
+
17
+ #
18
+ # Returns news channels.
19
+ #
20
+ # @return [Array<Discorb::NewsChannel>] The news channels.
21
+ def news_channels: -> ::Array[Discorb::NewsChannel]
22
+
23
+ #
24
+ # Returns stage channels.
25
+ #
26
+ # @return [Array<Discorb::StageChannel>] The stage channels.
27
+ def stage_channels: -> ::Array[Discorb::StageChannel]
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ module Discorb
2
+ #
3
+ # Represents a DM channel.
4
+ class DMChannel < Discorb::Channel
5
+ include Discorb::Messageable
6
+
7
+ #
8
+ # Returns the channel id to request.
9
+ # @private
10
+ #
11
+ # @return [Async::Task<Discorb::Snowflake>] A task that resolves to the channel id.
12
+ def channel_id: -> Async::Task[Discorb::Snowflake]
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ module Discorb
2
+ #
3
+ # Represents a news channel (announcement channel).
4
+ class NewsChannel < Discorb::TextChannel
5
+ DEFAULT_AUTO_ARCHIVE_DURATION: untyped
6
+
7
+ #
8
+ # Follow the existing announcement channel from self.
9
+ # @async
10
+ #
11
+ # @param [Discorb::TextChannel] target The channel to follow to.
12
+ # @param [String] reason The reason of following the channel.
13
+ #
14
+ # @return [Async::Task<void>] The task.
15
+ def follow_to: (
16
+ Discorb::TextChannel target,
17
+ ?reason: String?
18
+ ) -> Async::Task[void]
19
+ end
20
+ end
@@ -0,0 +1,77 @@
1
+ module Discorb
2
+ #
3
+ # Represents a stage channel.
4
+ class StageChannel < Discorb::GuildChannel
5
+ include Discorb::Connectable
6
+
7
+ #
8
+ # Initialize a new stage channel.
9
+ # @private
10
+ def initialize: -> void
11
+
12
+ def stage_instance: -> untyped
13
+
14
+ #
15
+ # Edit the stage channel.
16
+ # @async
17
+ # @macro edit
18
+ #
19
+ # @param [String] name The name of the stage channel.
20
+ # @param [Integer] position The position of the stage channel.
21
+ # @param [Integer] bitrate The bitrate of the stage channel.
22
+ # @param [Symbol] rtc_region The region of the stage channel.
23
+ # @param [String] reason The reason of editing the stage channel.
24
+ #
25
+ # @return [Async::Task<self>] The edited stage channel.
26
+ def edit: (
27
+ ?name: String,
28
+ ?position: Integer,
29
+ ?bitrate: Integer,
30
+ ?rtc_region: Symbol,
31
+ ?reason: String?
32
+ ) -> Async::Task[self]
33
+
34
+ #
35
+ # Start a stage instance.
36
+ # @async
37
+ #
38
+ # @param [String] topic The topic of the stage instance.
39
+ # @param [Boolean] public Whether the stage instance is public or not.
40
+ # @param [String] reason The reason of starting the stage instance.
41
+ #
42
+ # @return [Async::Task<Discorb::StageInstance>] The started stage instance.
43
+ def start: (
44
+ String topic,
45
+ ?public: bool,
46
+ ?reason: String?
47
+ ) -> Async::Task[Discorb::StageInstance]
48
+
49
+ #
50
+ # Fetch a current stage instance.
51
+ # @async
52
+ #
53
+ # @return [Async::Task<StageInstance>] The current stage instance.
54
+ # @return [Async::Task<nil>] If there is no current stage instance.
55
+ def fetch_stage_instance: -> Async::Task[StageInstance]
56
+
57
+ def voice_states: -> Array[Discorb::VoiceState]
58
+
59
+ def members: -> Array[Discorb::Member]
60
+
61
+ def speakers: -> Array[Discorb::Member]
62
+
63
+ def audiences: -> Array[Discorb::Member]
64
+
65
+ # @return [Integer] The bitrate of the voice channel.
66
+ attr_reader bitrate: Integer
67
+
68
+ # @return [Integer] The user limit of the voice channel.
69
+ attr_reader user_limit: Integer
70
+
71
+ #
72
+ # @private
73
+ # @return [Discorb::Dictionary{Discorb::Snowflake => StageInstance}]
74
+ # The stage instances associated with the stage channel.
75
+ attr_reader stage_instances: Discorb::Dictionary[Discorb::Snowflake, StageInstance]
76
+ end
77
+ end
@@ -0,0 +1,158 @@
1
+ module Discorb
2
+ #
3
+ # Represents a text channel.
4
+ class TextChannel < Discorb::GuildChannel
5
+ include Discorb::Messageable
6
+
7
+ #
8
+ # Edits the channel.
9
+ # @async
10
+ # @macro edit
11
+ #
12
+ # @param [String] name The name of the channel.
13
+ # @param [Integer] position The position of the channel.
14
+ # @param [Discorb::CategoryChannel, nil] category The parent of channel. Specify `nil` to remove the parent.
15
+ # @param [Discorb::CategoryChannel, nil] parent Alias of `category`.
16
+ # @param [String] topic The topic of the channel.
17
+ # @param [Boolean] nsfw Whether the channel is nsfw.
18
+ # @param [Boolean] announce Whether the channel is announce channel.
19
+ # @param [Integer] rate_limit_per_user The rate limit per user (Slowmode) in the channel.
20
+ # @param [Integer] slowmode Alias of `rate_limit_per_user`.
21
+ # @param [Integer] default_auto_archive_duration The default auto archive duration of the channel.
22
+ # @param [Integer] archive_in Alias of `default_auto_archive_duration`.
23
+ # @param [String] reason The reason of editing the channel.
24
+ #
25
+ # @return [Async::Task<self>] The edited channel.
26
+ def edit: (
27
+ ?name: String,
28
+ ?position: Integer,
29
+ ?category: Discorb::CategoryChannel?,
30
+ ?parent: Discorb::CategoryChannel?,
31
+ ?topic: String,
32
+ ?nsfw: bool,
33
+ ?announce: bool,
34
+ ?rate_limit_per_user: Integer,
35
+ ?slowmode: Integer,
36
+ ?default_auto_archive_duration: 60 | 1440 | 4320 | 10080,
37
+ ?archive_in: Integer,
38
+ ?reason: String?
39
+ ) -> Async::Task[self]
40
+
41
+ #
42
+ # Create webhook in the channel.
43
+ # @async
44
+ #
45
+ # @param [String] name The name of the webhook.
46
+ # @param [Discorb::Image] avatar The avatar of the webhook.
47
+ #
48
+ # @return [Async::Task<Discorb::Webhook::IncomingWebhook>] The created webhook.
49
+ def create_webhook: (
50
+ String name,
51
+ ?avatar: Discorb::Image?
52
+ ) -> Async::Task[Discorb::Webhook::IncomingWebhook]
53
+
54
+ #
55
+ # Fetch webhooks in the channel.
56
+ # @async
57
+ #
58
+ # @return [Async::Task<Array<Discorb::Webhook>>] The webhooks in the channel.
59
+ def fetch_webhooks: -> Async::Task[::Array[Discorb::Webhook]]
60
+
61
+ #
62
+ # Bulk delete messages in the channel.
63
+ # @async
64
+ #
65
+ # @param [Discorb::Message] messages The messages to delete.
66
+ # @param [Boolean] force Whether to ignore the validation for message (14 days limit).
67
+ #
68
+ # @return [Async::Task<void>] The task.
69
+ def delete_messages!:
70
+ (*Discorb::Message messages, ?force: bool) -> Async::Task[void]
71
+ | (*Array[Discorb::Message] messages, ?force: bool) -> Async::Task[void]
72
+
73
+ #
74
+ # Follow the existing announcement channel.
75
+ # @async
76
+ #
77
+ # @param [Discorb::NewsChannel] target The channel to follow.
78
+ # @param [String] reason The reason of following the channel.
79
+ #
80
+ # @return [Async::Task<void>] The task.
81
+ def follow_from: (
82
+ Discorb::NewsChannel target,
83
+ ?reason: String?
84
+ ) -> Async::Task[void]
85
+
86
+ #
87
+ # Start thread in the channel.
88
+ # @async
89
+ #
90
+ # @param [String] name The name of the thread.
91
+ # @param [Discorb::Message] message The message to start the thread.
92
+ # @param [:hour, :day, :three_days, :week] auto_archive_duration The duration of auto-archiving.
93
+ # @param [Boolean] public Whether the thread is public.
94
+ # @param [Integer] rate_limit_per_user The rate limit per user.
95
+ # @param [Integer] slowmode Alias of `rate_limit_per_user`.
96
+ # @param [String] reason The reason of starting the thread.
97
+ #
98
+ # @return [Async::Task<Discorb::ThreadChannel>] The started thread.
99
+ def start_thread: (
100
+ String name,
101
+ ?message: Discorb::Message?,
102
+ ?auto_archive_duration: Symbol?,
103
+ ?public: bool,
104
+ ?rate_limit_per_user: Integer?,
105
+ ?slowmode: Integer?,
106
+ ?reason: String?
107
+ ) -> Async::Task[Discorb::ThreadChannel]
108
+
109
+ #
110
+ # Fetch archived threads in the channel.
111
+ # @async
112
+ #
113
+ # @return [Async::Task<Array<Discorb::ThreadChannel>>] The archived threads in the channel.
114
+ def fetch_archived_public_threads: -> Async::Task[::Array[Discorb::ThreadChannel]]
115
+
116
+ #
117
+ # Fetch archived private threads in the channel.
118
+ # @async
119
+ #
120
+ # @return [Async::Task<Array<Discorb::ThreadChannel>>] The archived private threads in the channel.
121
+ def fetch_archived_private_threads: -> Async::Task[::Array[Discorb::ThreadChannel]]
122
+
123
+ #
124
+ # Fetch joined archived private threads in the channel.
125
+ # @async
126
+ #
127
+ # @param [Integer] limit The limit of threads to fetch.
128
+ # @param [Time] before <description>
129
+ #
130
+ # @return [Async::Task<Array<Discorb::ThreadChannel>>] The joined archived private threads in the channel.
131
+ def fetch_joined_archived_private_threads: (
132
+ ?limit: Integer?,
133
+ ?before: Time?
134
+ ) -> Async::Task[::Array[Discorb::ThreadChannel]]
135
+
136
+ # @return [String] The topic of the channel.
137
+ attr_reader topic: String
138
+
139
+ # @return [Boolean] Whether the channel is nsfw.
140
+ attr_reader nsfw: bool
141
+
142
+ # @return [Discorb::Snowflake] The id of the last message.
143
+ attr_reader last_message_id: Discorb::Snowflake
144
+
145
+ # @return [Integer] The rate limit per user (Slowmode) in the channel.
146
+ attr_reader rate_limit_per_user: Integer
147
+
148
+ # @return [Time] The time when the last pinned message was pinned.
149
+ attr_reader last_pin_timestamp: Time
150
+
151
+ # @return [Integer] The default value of duration of auto archive.
152
+ attr_reader default_auto_archive_duration: 60 | 1440 | 4320 | 10080
153
+
154
+ # @!attribute [r] threads
155
+ # @return [Array<Discorb::ThreadChannel>] The threads in the channel.
156
+ attr_reader threads: untyped
157
+ end
158
+ end
@@ -0,0 +1,185 @@
1
+ module Discorb
2
+ #
3
+ # Represents a thread.
4
+ # @abstract
5
+ class ThreadChannel < Discorb::Channel
6
+ include Discorb::Messageable
7
+
8
+ #
9
+ # Initialize a new thread channel.
10
+ # @private
11
+ #
12
+ # @param [Discorb::Client] client The client.
13
+ # @param [Hash] data The data of the thread channel.
14
+ # @param [Boolean] no_cache Whether to disable the cache.
15
+ def initialize: (
16
+ Discorb::Client client,
17
+ Discorb::json data,
18
+ ?no_cache: bool
19
+ ) -> void
20
+
21
+ #
22
+ # Edit the thread.
23
+ # @async
24
+ # @macro edit
25
+ #
26
+ # @param [String] name The name of the thread.
27
+ # @param [Boolean] archived Whether the thread is archived or not.
28
+ # @param [Integer] auto_archive_duration The auto archive duration in seconds.
29
+ # @param [Integer] archive_in Alias of `auto_archive_duration`.
30
+ # @param [Boolean] locked Whether the thread is locked or not.
31
+ # @param [String] reason The reason of editing the thread.
32
+ #
33
+ # @return [Async::Task<self>] The edited thread.
34
+ #
35
+ # @see #archive
36
+ # @see #lock
37
+ # @see #unarchive
38
+ # @see #unlock
39
+ def edit: (
40
+ ?name: String,
41
+ ?archived: bool,
42
+ ?auto_archive_duration: Integer,
43
+ ?archive_in: Integer,
44
+ ?locked: bool,
45
+ ?reason: String?
46
+ ) -> Async::Task[self]
47
+
48
+ #
49
+ # Helper method to archive the thread.
50
+ #
51
+ # @param [String] reason The reason of archiving the thread.
52
+ #
53
+ # @return [Async::Task<self>] The archived thread.
54
+ def archive: (?reason: String?) -> Async::Task[self]
55
+
56
+ #
57
+ # Helper method to lock the thread.
58
+ #
59
+ # @param [String] reason The reason of locking the thread.
60
+ #
61
+ # @return [Async::Task<self>] The locked thread.
62
+ def lock: (?reason: String?) -> Async::Task[self]
63
+
64
+ #
65
+ # Helper method to unarchive the thread.
66
+ #
67
+ # @param [String] reason The reason of unarchiving the thread.
68
+ #
69
+ # @return [Async::Task<self>] The unarchived thread.
70
+ def unarchive: (?reason: String?) -> Async::Task[self]
71
+
72
+ #
73
+ # Helper method to unlock the thread.
74
+ #
75
+ # @param [String] reason The reason of unlocking the thread.
76
+ #
77
+ # @return [Async::Task<self>] The unlocked thread.
78
+ #
79
+ # @note This method won't unarchive the thread. Use {#unarchive} instead.
80
+ def unlock: (?reason: String?) -> Async::Task[self]
81
+
82
+ def parent: -> untyped
83
+
84
+ def me: -> untyped
85
+
86
+ def joined?: -> bool
87
+
88
+ def guild: -> untyped
89
+
90
+ def owner: -> untyped
91
+
92
+ def inspect: -> String
93
+
94
+ #
95
+ # Add a member to the thread.
96
+ #
97
+ # @param [Discorb::Member, :me] member The member to add. If `:me` is given, the bot will be added.
98
+ #
99
+ # @return [Async::Task<void>] The task.
100
+ def add_member: (?Discorb::Member | Symbol member) -> Async::Task[void]
101
+
102
+ #
103
+ # Remove a member from the thread.
104
+ #
105
+ # @param [Discorb::Member, :me] member The member to remove. If `:me` is given, the bot will be removed.
106
+ #
107
+ # @return [Async::Task<void>] The task.
108
+ def remove_member: (?Discorb::Member | Symbol member) -> Async::Task[void]
109
+
110
+ #
111
+ # Fetch members in the thread.
112
+ #
113
+ # @return [Array<Discorb::ThreadChannel::Member>] The members in the thread.
114
+ def fetch_members: -> ::Array[Discorb::ThreadChannel::Member]
115
+
116
+ # @return [Discorb::Snowflake] The ID of the channel.
117
+ # @note This ID is same as the starter message's ID
118
+ attr_reader id: Discorb::Snowflake
119
+
120
+ # @return [String] The name of the thread.
121
+ attr_reader name: String
122
+
123
+ # @return [Integer] The number of messages in the thread.
124
+ # @note This will stop counting at 50.
125
+ attr_reader message_count: Integer
126
+
127
+ # @return [Integer] The number of recipients in the thread.
128
+ # @note This will stop counting at 50.
129
+ attr_reader member_count: Integer
130
+
131
+ # @return [Integer] The rate limit per user (slowmode) in the thread.
132
+ attr_reader rate_limit_per_user: Integer
133
+
134
+ # @return [Array<Discorb::ThreadChannel::Member>] The members of the thread.
135
+ attr_reader members: ::Array[Discorb::ThreadChannel::Member]
136
+
137
+ # @return [Time] The time the thread was archived.
138
+ # @return [nil] If the thread is not archived.
139
+ attr_reader archived_timestamp: Time?
140
+
141
+ # @return [Integer] Auto archive duration in seconds.
142
+ attr_reader auto_archive_duration: Integer
143
+
144
+ # @return [Boolean] Whether the thread is archived or not.
145
+ attr_reader archived: bool
146
+
147
+ #
148
+ # Represents a thread in news channel(aka announcement channel).
149
+ class News < Discorb::ThreadChannel
150
+ end
151
+
152
+ #
153
+ # Represents a public thread in text channel.
154
+ class Public < Discorb::ThreadChannel
155
+ end
156
+
157
+ #
158
+ # Represents a private thread in text channel.
159
+ class Private < Discorb::ThreadChannel
160
+ end
161
+
162
+ #
163
+ # Represents a member in a thread.
164
+ class Member < Discorb::DiscordModel
165
+ def initialize: (
166
+ Discorb::Client client,
167
+ Discorb::json data,
168
+ _ToS guild_id
169
+ ) -> void
170
+
171
+ def thread: -> Discorb::ThreadChannel
172
+
173
+ def member: -> Discorb::Member
174
+
175
+ def id: -> Discorb::Snowflake
176
+
177
+ def user: -> Discorb::User
178
+
179
+ def inspect: -> String
180
+
181
+ # Returns the value of attribute joined_at.
182
+ attr_reader joined_at: Time
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,41 @@
1
+ module Discorb
2
+ #
3
+ # Represents a voice channel.
4
+ class VoiceChannel < Discorb::GuildChannel
5
+ include Discorb::Connectable
6
+ include Discorb::Messageable
7
+
8
+ #
9
+ # Edit the voice channel.
10
+ # @async
11
+ # @macro edit
12
+ #
13
+ # @param [String] name The name of the voice channel.
14
+ # @param [Integer] position The position of the voice channel.
15
+ # @param [Integer] bitrate The bitrate of the voice channel.
16
+ # @param [Integer] user_limit The user limit of the voice channel.
17
+ # @param [Symbol] rtc_region The region of the voice channel.
18
+ # @param [String] reason The reason of editing the voice channel.
19
+ #
20
+ # @return [Async::Task<self>] The edited voice channel.
21
+ def edit: (
22
+ ?name: String,
23
+ ?position: Integer,
24
+ ?bitrate: Integer,
25
+ ?user_limit: Integer,
26
+ ?rtc_region: Symbol,
27
+ ?reason: String?
28
+ ) -> Async::Task[self]
29
+
30
+ def voice_states: -> Array[Discorb::VoiceState]
31
+
32
+ def members: -> Array[Discorb::Member]
33
+
34
+ # @return [Integer] The bitrate of the voice channel.
35
+ attr_reader bitrate: Integer
36
+
37
+ # @return [Integer] The user limit of the voice channel.
38
+ # @return [nil] If the user limit is not set.
39
+ attr_reader user_limit: Integer?
40
+ end
41
+ end