discorb 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +1 -3
- data/.github/workflows/validate.yml +21 -0
- data/Changelog.md +10 -0
- data/Gemfile +6 -0
- data/Rakefile +210 -98
- data/Steepfile +28 -0
- data/docs/events.md +42 -6
- data/docs/tutorial.md +7 -7
- data/docs/voice_events.md +2 -2
- data/examples/commands/message.rb +12 -7
- data/examples/commands/permission.rb +2 -1
- data/examples/commands/slash.rb +23 -19
- data/examples/commands/user.rb +15 -12
- data/examples/components/authorization_button.rb +2 -1
- data/examples/components/select_menu.rb +4 -1
- data/examples/extension/main.rb +1 -0
- data/examples/extension/message_expander.rb +1 -0
- data/examples/sig/commands/message.rbs +5 -0
- data/examples/simple/eval.rb +1 -0
- data/examples/simple/ping_pong.rb +1 -0
- data/examples/simple/rolepanel.rb +16 -5
- data/examples/simple/shard.rb +2 -1
- data/examples/simple/wait_for_message.rb +3 -0
- data/exe/discorb +3 -3
- data/lib/discorb/allowed_mentions.rb +1 -1
- data/lib/discorb/app_command/command.rb +12 -13
- data/lib/discorb/app_command/handler.rb +20 -6
- data/lib/discorb/audit_logs.rb +6 -2
- data/lib/discorb/automod.rb +269 -0
- data/lib/discorb/channel/guild.rb +2 -1
- data/lib/discorb/channel/stage.rb +1 -1
- data/lib/discorb/channel/text.rb +11 -20
- data/lib/discorb/channel/thread.rb +15 -11
- data/lib/discorb/client.rb +12 -10
- data/lib/discorb/color.rb +37 -60
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/dictionary.rb +1 -1
- data/lib/discorb/embed.rb +4 -3
- data/lib/discorb/emoji.rb +2 -2
- data/lib/discorb/exe/about.rb +1 -1
- data/lib/discorb/exe/new.rb +1 -5
- data/lib/discorb/extension.rb +0 -4
- data/lib/discorb/flag.rb +2 -2
- data/lib/discorb/gateway.rb +21 -582
- data/lib/discorb/gateway_events.rb +638 -0
- data/lib/discorb/guild.rb +136 -17
- data/lib/discorb/guild_template.rb +1 -1
- data/lib/discorb/http.rb +47 -25
- data/lib/discorb/intents.rb +27 -18
- data/lib/discorb/interaction/command.rb +14 -10
- data/lib/discorb/interaction/response.rb +74 -14
- data/lib/discorb/member.rb +3 -3
- data/lib/discorb/message.rb +13 -11
- data/lib/discorb/message_meta.rb +2 -3
- data/lib/discorb/modules.rb +3 -2
- data/lib/discorb/presence.rb +4 -2
- data/lib/discorb/reaction.rb +2 -2
- data/lib/discorb/role.rb +1 -1
- data/lib/discorb/sticker.rb +3 -3
- data/lib/discorb/user.rb +2 -2
- data/lib/discorb/voice_state.rb +5 -5
- data/lib/discorb/webhook.rb +15 -6
- data/lib/discorb.rb +2 -2
- data/rbs_collection.lock.yaml +88 -96
- data/rbs_collection.yaml +21 -17
- data/sig/async.rbs +11 -5
- data/sig/discorb/activity.rbs +23 -0
- data/sig/discorb/allowed_mentions.rbs +44 -0
- data/sig/discorb/app_command/base.rbs +282 -0
- data/sig/discorb/app_command/handler.rbs +171 -0
- data/sig/discorb/application.rbs +142 -0
- data/sig/discorb/asset.rbs +32 -0
- data/sig/discorb/attachment.rbs +91 -0
- data/sig/discorb/audit_log.rbs +231 -0
- data/sig/discorb/automod.rbs +128 -0
- data/sig/discorb/avatar.rbs +26 -0
- data/sig/discorb/channel/base.rbs +179 -0
- data/sig/discorb/channel/category.rbs +56 -0
- data/sig/discorb/channel/container.rbs +29 -0
- data/sig/discorb/channel/dm.rbs +14 -0
- data/sig/discorb/channel/news.rbs +20 -0
- data/sig/discorb/channel/stage.rbs +77 -0
- data/sig/discorb/channel/text.rbs +158 -0
- data/sig/discorb/channel/thread.rbs +185 -0
- data/sig/discorb/channel/voice.rbs +41 -0
- data/sig/discorb/client.rbs +2495 -0
- data/sig/discorb/color.rbs +142 -0
- data/sig/discorb/component/base.rbs +28 -0
- data/sig/discorb/component/button.rbs +65 -0
- data/sig/discorb/component/select_menu.rbs +107 -0
- data/sig/discorb/component/text_input.rbs +69 -0
- data/sig/discorb/connectable.rbs +8 -0
- data/sig/discorb/custom_emoji.rbs +90 -0
- data/sig/discorb/dictionary.rbs +85 -0
- data/sig/discorb/discord_model.rbs +15 -0
- data/sig/discorb/embed.rbs +279 -0
- data/sig/discorb/emoji.rbs +13 -0
- data/sig/discorb/error.rbs +73 -0
- data/sig/discorb/event_handler.rbs +27 -0
- data/sig/discorb/extension.rbs +1734 -0
- data/sig/discorb/flag.rbs +72 -0
- data/sig/discorb/gateway.rbs +481 -0
- data/sig/discorb/guild.rbs +870 -0
- data/sig/discorb/guild_template.rbs +174 -0
- data/sig/discorb/http.rbs +147 -0
- data/sig/discorb/image.rbs +20 -0
- data/sig/discorb/integration.rbs +118 -0
- data/sig/discorb/intents.rbs +97 -0
- data/sig/discorb/interaction/autocomplete.rbs +9 -0
- data/sig/discorb/interaction/base.rbs +66 -0
- data/sig/discorb/interaction/command.rbs +66 -0
- data/sig/discorb/interaction/message_component.rbs +140 -0
- data/sig/discorb/interaction/modal.rbs +50 -0
- data/sig/discorb/interaction/responder.rbs +157 -0
- data/sig/discorb/invite.rbs +86 -0
- data/sig/discorb/member.rbs +187 -0
- data/sig/discorb/message.rbs +469 -0
- data/sig/discorb/messageable.rbs +153 -0
- data/sig/discorb/partial_emoji.rbs +35 -0
- data/sig/discorb/permissions.rbs +149 -0
- data/sig/discorb/presence.rbs +237 -0
- data/sig/discorb/reaction.rbs +33 -0
- data/sig/discorb/role.rbs +145 -0
- data/sig/discorb/scheduled_event.rbs +148 -0
- data/sig/discorb/shard.rbs +62 -0
- data/sig/discorb/snowflake.rbs +56 -0
- data/sig/discorb/stage_instance.rbs +63 -0
- data/sig/discorb/sticker.rbs +116 -0
- data/sig/discorb/system_channel_flag.rbs +17 -0
- data/sig/discorb/unicode_emoji.rbs +49 -0
- data/sig/discorb/user.rbs +93 -0
- data/sig/discorb/utils.rbs +8 -0
- data/sig/discorb/voice_region.rbs +30 -0
- data/sig/discorb/voice_state.rbs +71 -0
- data/sig/discorb/webhook.rbs +327 -0
- data/sig/discorb/welcome_screen.rbs +78 -0
- data/sig/discorb.rbs +5 -8661
- data/sig/manifest.yaml +3 -0
- data/sig/override.rbs +19 -0
- metadata +80 -3
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Represents an embed of discord.
|
|
4
|
+
class Embed
|
|
5
|
+
#
|
|
6
|
+
# Initialize a new Embed object.
|
|
7
|
+
#
|
|
8
|
+
# @param [String] title The title of embed.
|
|
9
|
+
# @param [String] description The description of embed.
|
|
10
|
+
# @param [Discorb::Color, Integer] color The color of embed.
|
|
11
|
+
# @param [String] url The url of embed.
|
|
12
|
+
# @param [Time] timestamp The timestamp of embed.
|
|
13
|
+
# @param [Discorb::Embed::Author] author The author field of embed.
|
|
14
|
+
# @param [Array<Discorb::Embed::Field>] fields The fields of embed.
|
|
15
|
+
# @param [Discorb::Embed::Footer] footer The footer of embed.
|
|
16
|
+
# @param [Discorb::Embed::Image, String] image The image of embed.
|
|
17
|
+
# @param [Discorb::Embed::Thumbnail, String] thumbnail The thumbnail of embed.
|
|
18
|
+
def initialize: (
|
|
19
|
+
?String? title,
|
|
20
|
+
?String? description,
|
|
21
|
+
?color: (Discorb::Color | Integer)?,
|
|
22
|
+
?url: String?,
|
|
23
|
+
?timestamp: Time?,
|
|
24
|
+
?author: Discorb::Embed::Author?,
|
|
25
|
+
?fields: ::Array[Discorb::Embed::Field]?,
|
|
26
|
+
?footer: Discorb::Embed::Footer?,
|
|
27
|
+
?image: (Discorb::Embed::Image | String)?,
|
|
28
|
+
?thumbnail: (Discorb::Embed::Thumbnail | String)?
|
|
29
|
+
) -> void
|
|
30
|
+
|
|
31
|
+
#
|
|
32
|
+
# Initialize embed from hash.
|
|
33
|
+
# @private
|
|
34
|
+
#
|
|
35
|
+
# @param [Hash] data The hash data to initialize embed.
|
|
36
|
+
def initialize_hash: (Discorb::json data) -> untyped
|
|
37
|
+
|
|
38
|
+
def inspect: -> String
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# Convert embed to hash.
|
|
42
|
+
#
|
|
43
|
+
# @see https://discord.com/developers/docs/resources/channel#embed-object-embed-structure Offical Discord API Docs
|
|
44
|
+
# @return [Hash] Converted embed.
|
|
45
|
+
def to_hash: -> Discorb::json
|
|
46
|
+
|
|
47
|
+
def self.from_hash: (untyped data) -> untyped
|
|
48
|
+
|
|
49
|
+
# @return [String, nil] The title of embed.
|
|
50
|
+
attr_accessor title: String?
|
|
51
|
+
|
|
52
|
+
# @return [String, nil] The description of embed.
|
|
53
|
+
attr_accessor description: String?
|
|
54
|
+
|
|
55
|
+
# @return [String, nil] The url of embed.
|
|
56
|
+
attr_accessor url: String?
|
|
57
|
+
|
|
58
|
+
# @return [Time, nil] The timestamp of embed.
|
|
59
|
+
attr_accessor timestamp: Time?
|
|
60
|
+
|
|
61
|
+
# @return [Discorb::Color, nil] The color of embed.
|
|
62
|
+
attr_accessor color: Discorb::Color?
|
|
63
|
+
|
|
64
|
+
# @return [Discorb::Embed::Author, nil] The author of embed.
|
|
65
|
+
attr_accessor author: Discorb::Embed::Author?
|
|
66
|
+
|
|
67
|
+
# @return [Array<Discorb::Embed::Field>] The fields of embed.
|
|
68
|
+
attr_accessor fields: ::Array[Discorb::Embed::Field]
|
|
69
|
+
|
|
70
|
+
# @return [Discorb::Embed::Footer, nil] The footer of embed.
|
|
71
|
+
attr_accessor footer: Discorb::Embed::Footer?
|
|
72
|
+
|
|
73
|
+
# @return [Symbol] The type of embed.
|
|
74
|
+
attr_reader type: Symbol
|
|
75
|
+
|
|
76
|
+
# @return [Discorb::Embed::Image] The image of embed.
|
|
77
|
+
attr_accessor image: Discorb::Embed::Image?
|
|
78
|
+
|
|
79
|
+
# @return [Discorb::Embed::Thumbnail] The thumbnail of embed.
|
|
80
|
+
attr_accessor thumbnail: Discorb::Embed::Thumbnail?
|
|
81
|
+
|
|
82
|
+
#
|
|
83
|
+
# Represents an entry in embed.
|
|
84
|
+
# @abstract
|
|
85
|
+
# @private
|
|
86
|
+
class Entry
|
|
87
|
+
def inspect: -> String
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
#
|
|
91
|
+
# Represents an author of embed.
|
|
92
|
+
class Author < Discorb::Embed::Entry
|
|
93
|
+
#
|
|
94
|
+
# Initialize a new Author object.
|
|
95
|
+
#
|
|
96
|
+
# @param [String] name The name of author.
|
|
97
|
+
# @param [String] url The url of author.
|
|
98
|
+
# @param [String] icon The icon url of author.
|
|
99
|
+
def initialize: (String name, ?url: String?, ?icon: String?) -> void
|
|
100
|
+
|
|
101
|
+
#
|
|
102
|
+
# Convert author to hash.
|
|
103
|
+
#
|
|
104
|
+
# @see https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
|
|
105
|
+
# Offical Discord API Docs
|
|
106
|
+
# @return [Hash] Converted author.
|
|
107
|
+
def to_hash: -> Discorb::json
|
|
108
|
+
|
|
109
|
+
# @return [String] The name of author.
|
|
110
|
+
attr_accessor name: String
|
|
111
|
+
|
|
112
|
+
# @return [String, nil] The url of author.
|
|
113
|
+
attr_accessor url: String?
|
|
114
|
+
|
|
115
|
+
# @return [String, nil] The icon url of author.
|
|
116
|
+
attr_accessor icon: String?
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
#
|
|
120
|
+
# Represemts a footer of embed.
|
|
121
|
+
class Footer < Discorb::Embed::Entry
|
|
122
|
+
#
|
|
123
|
+
# Initialize a new Footer object.
|
|
124
|
+
#
|
|
125
|
+
# @param [String] text The text of footer.
|
|
126
|
+
# @param [String] icon The icon url of footer.
|
|
127
|
+
def initialize: (String text, ?icon: String?) -> void
|
|
128
|
+
|
|
129
|
+
#
|
|
130
|
+
# Convert footer to hash.
|
|
131
|
+
#
|
|
132
|
+
# @see https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
|
|
133
|
+
# Offical Discord API Docs
|
|
134
|
+
# @return [Hash] Converted footer.
|
|
135
|
+
def to_hash: -> Discorb::json
|
|
136
|
+
|
|
137
|
+
# Returns the value of attribute text.
|
|
138
|
+
attr_accessor text: untyped
|
|
139
|
+
|
|
140
|
+
# Returns the value of attribute icon.
|
|
141
|
+
attr_accessor icon: untyped
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
#
|
|
145
|
+
# Represents a field of embed.
|
|
146
|
+
class Field < Discorb::Embed::Entry
|
|
147
|
+
#
|
|
148
|
+
# Initialize a new Field object.
|
|
149
|
+
#
|
|
150
|
+
# @param [String] name The name of field.
|
|
151
|
+
# @param [String] value The value of field.
|
|
152
|
+
# @param [Boolean] inline Whether the field is inline.
|
|
153
|
+
def initialize: (String name, String value, ?inline: bool) -> void
|
|
154
|
+
|
|
155
|
+
#
|
|
156
|
+
# Convert field to hash.
|
|
157
|
+
#
|
|
158
|
+
# @see https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
|
|
159
|
+
# Offical Discord API Docs
|
|
160
|
+
# @return [Hash] Converted field.
|
|
161
|
+
def to_hash: -> Discorb::json
|
|
162
|
+
|
|
163
|
+
# @return [String] The name of field.
|
|
164
|
+
attr_accessor name: String
|
|
165
|
+
|
|
166
|
+
# @return [String] The value of field.
|
|
167
|
+
attr_accessor value: String
|
|
168
|
+
|
|
169
|
+
# @return [Boolean] Whether the field is inline.
|
|
170
|
+
attr_accessor inline: bool
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
#
|
|
174
|
+
# Represents an image of embed.
|
|
175
|
+
class Image < Discorb::Embed::Entry
|
|
176
|
+
#
|
|
177
|
+
# Initialize a new Image object.
|
|
178
|
+
#
|
|
179
|
+
# @param [String] url URL of image.
|
|
180
|
+
def initialize: (String url) -> void
|
|
181
|
+
|
|
182
|
+
#
|
|
183
|
+
# Convert image to hash for sending.
|
|
184
|
+
#
|
|
185
|
+
# @see https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
|
|
186
|
+
# Offical Discord API Docs
|
|
187
|
+
# @return [Hash] Converted image.
|
|
188
|
+
def to_hash: -> Discorb::json
|
|
189
|
+
|
|
190
|
+
# @return [String] The url of image.
|
|
191
|
+
attr_accessor url: String
|
|
192
|
+
|
|
193
|
+
# @return [String] The proxy url of image.
|
|
194
|
+
# @return [nil] The Image object wasn't created from gateway.
|
|
195
|
+
attr_reader proxy_url: String?
|
|
196
|
+
|
|
197
|
+
# @return [Integer] The height of image.
|
|
198
|
+
# @return [nil] The Image object wasn't created from gateway.
|
|
199
|
+
attr_reader height: Integer?
|
|
200
|
+
|
|
201
|
+
# @return [Integer] The width of image.
|
|
202
|
+
# @return [nil] The Image object wasn't created from gateway.
|
|
203
|
+
attr_reader width: Integer?
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
#
|
|
207
|
+
# Represents a thumbnail of embed.
|
|
208
|
+
class Thumbnail < Discorb::Embed::Entry
|
|
209
|
+
#
|
|
210
|
+
# Initialize a new Thumbnail object.
|
|
211
|
+
#
|
|
212
|
+
# @param [String] url URL of thumbnail.
|
|
213
|
+
def initialize: (String url) -> void
|
|
214
|
+
|
|
215
|
+
#
|
|
216
|
+
# Convert thumbnail to hash for sending.
|
|
217
|
+
#
|
|
218
|
+
# @see https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
|
|
219
|
+
# Offical Discord API Docs
|
|
220
|
+
# @return [Hash] Converted thumbnail.
|
|
221
|
+
def to_hash: -> Discorb::json
|
|
222
|
+
|
|
223
|
+
# @return [String] The url of thumbnail.
|
|
224
|
+
attr_accessor url: String
|
|
225
|
+
|
|
226
|
+
# @return [String] The proxy url of thumbnail.
|
|
227
|
+
# @return [nil] The Thumbnail object wasn't created from gateway.
|
|
228
|
+
attr_reader proxy_url: String?
|
|
229
|
+
|
|
230
|
+
# @return [Integer] The height of thumbnail.
|
|
231
|
+
# @return [nil] The Thumbnail object wasn't created from gateway.
|
|
232
|
+
attr_reader height: Integer?
|
|
233
|
+
|
|
234
|
+
# @return [Integer] The width of thumbnail.
|
|
235
|
+
# @return [nil] The Thumbnail object wasn't created from gateway.
|
|
236
|
+
attr_reader width: Integer?
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
#
|
|
240
|
+
# Represents a video of embed.
|
|
241
|
+
class Video < Discorb::Embed::Entry
|
|
242
|
+
#
|
|
243
|
+
# Initialize a new Video object.
|
|
244
|
+
# @private
|
|
245
|
+
#
|
|
246
|
+
# @param [Hash] data The data of video.
|
|
247
|
+
def initialize: (Discorb::json data) -> void
|
|
248
|
+
|
|
249
|
+
# @return [String] The url of video.
|
|
250
|
+
attr_reader url: String
|
|
251
|
+
|
|
252
|
+
# @return [String] The proxy url of video.
|
|
253
|
+
attr_reader proxy_url: String
|
|
254
|
+
|
|
255
|
+
# @return [Integer] The height of video.
|
|
256
|
+
attr_reader height: Integer
|
|
257
|
+
|
|
258
|
+
# @return [Integer] The width of video.
|
|
259
|
+
attr_reader width: Integer
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
#
|
|
263
|
+
# Represents a provider of embed.
|
|
264
|
+
class Provider < Discorb::Embed::Entry
|
|
265
|
+
#
|
|
266
|
+
# Initialize a new Provider object.
|
|
267
|
+
# @private
|
|
268
|
+
#
|
|
269
|
+
# @param [Hash] data The data of provider.
|
|
270
|
+
def initialize: (Discorb::json data) -> void
|
|
271
|
+
|
|
272
|
+
# @return [String] The name of provider.
|
|
273
|
+
attr_reader name: String
|
|
274
|
+
|
|
275
|
+
# @return [String] The url of provider.
|
|
276
|
+
attr_reader url: String
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Error class for Discorb.
|
|
4
|
+
# @abstract
|
|
5
|
+
class DiscorbError < StandardError
|
|
6
|
+
def enumerate_errors: (untyped hash) -> untyped
|
|
7
|
+
|
|
8
|
+
def _recr_items: (untyped key, untyped item, untyped res) -> untyped
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# Represents a HTTP error.
|
|
13
|
+
# @abstract
|
|
14
|
+
class HTTPError < Discorb::DiscorbError
|
|
15
|
+
#
|
|
16
|
+
# Initialize a new instance of the HTTPError class.
|
|
17
|
+
# @private
|
|
18
|
+
def initialize: (untyped resp, untyped data) -> void
|
|
19
|
+
|
|
20
|
+
# @return [String] the JSON response code.
|
|
21
|
+
# @see https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes
|
|
22
|
+
attr_reader code: String
|
|
23
|
+
|
|
24
|
+
# @return [Net::HTTPResponse] the HTTP response.
|
|
25
|
+
attr_reader response: Net::HTTPResponse
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
# Represents a 400 error.
|
|
30
|
+
class BadRequestError < Discorb::HTTPError
|
|
31
|
+
#
|
|
32
|
+
# Initialize a new instance of the BadRequestError class.
|
|
33
|
+
# @private
|
|
34
|
+
def initialize: (untyped resp, untyped data) -> void
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#
|
|
38
|
+
# Represents a 401 error.
|
|
39
|
+
class UnauthorizedError < Discorb::HTTPError
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
#
|
|
43
|
+
# Represents a 403 error.
|
|
44
|
+
class ForbiddenError < Discorb::HTTPError
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
#
|
|
48
|
+
# Represents a 404 error.
|
|
49
|
+
class NotFoundError < Discorb::HTTPError
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# Represents a error because of a cloudflare ban.
|
|
54
|
+
class CloudFlareBanError < Discorb::HTTPError
|
|
55
|
+
def initialize: (untyped _resp, untyped client) -> void
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# Represents a error in client-side.
|
|
60
|
+
class ClientError < Discorb::DiscorbError
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
#
|
|
64
|
+
# Represents a timeout error.
|
|
65
|
+
class TimeoutError < Discorb::DiscorbError
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
#
|
|
69
|
+
# Represents a warning.
|
|
70
|
+
class NotSupportedWarning < Discorb::DiscorbError
|
|
71
|
+
def initialize: (untyped message) -> void
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Represents a event handler.
|
|
4
|
+
# This class shouldn't be instantiated directly.
|
|
5
|
+
# Use {Client#on} instead.
|
|
6
|
+
class EventHandler
|
|
7
|
+
def initialize: (untyped block, Symbol? id, untyped metadata) -> void
|
|
8
|
+
|
|
9
|
+
def inspect: -> String
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# Calls the block associated with the event.
|
|
13
|
+
def call: -> untyped
|
|
14
|
+
|
|
15
|
+
# @return [Proc] the block to be called.
|
|
16
|
+
attr_reader block: ^(*untyped) -> void
|
|
17
|
+
|
|
18
|
+
# @return [Symbol] the event id.
|
|
19
|
+
attr_reader id: Symbol?
|
|
20
|
+
|
|
21
|
+
# @return [Hash] the event metadata.
|
|
22
|
+
attr_reader metadata: ::Hash[untyped, untyped]
|
|
23
|
+
|
|
24
|
+
# @return [Boolean] whether the event is once or not.
|
|
25
|
+
attr_reader once: bool
|
|
26
|
+
end
|
|
27
|
+
end
|