discorb 0.0.6 → 0.2.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/Changelog.md +32 -1
- data/Gemfile +0 -1
- data/Gemfile.lock +1 -2
- data/README.md +1 -1
- data/docs/application_command.md +251 -0
- data/docs/discord_irb.md +39 -0
- data/docs/events.md +60 -64
- data/docs/extension.md +53 -0
- data/docs/voice_events.md +32 -32
- data/examples/commands/bookmarker.rb +41 -0
- data/examples/commands/hello.rb +9 -0
- data/examples/commands/inspect.rb +24 -0
- data/examples/components/authorization_button.rb +3 -3
- data/examples/components/select_menu.rb +3 -3
- data/examples/extension/message_expander.rb +1 -1
- data/examples/simple/eval.rb +2 -2
- data/examples/simple/ping_pong.rb +1 -1
- data/examples/simple/rolepanel.rb +3 -3
- data/examples/simple/wait_for_message.rb +1 -1
- data/exe/discord-irb +60 -0
- data/lib/discorb/asset.rb +34 -0
- data/lib/discorb/channel.rb +4 -4
- data/lib/discorb/client.rb +58 -16
- data/lib/discorb/command.rb +393 -0
- data/lib/discorb/common.rb +5 -5
- data/lib/discorb/dictionary.rb +1 -1
- data/lib/discorb/embed.rb +7 -7
- data/lib/discorb/emoji.rb +6 -1
- data/lib/discorb/emoji_table.rb +9 -2
- data/lib/discorb/error.rb +4 -1
- data/lib/discorb/extension.rb +5 -2
- data/lib/discorb/gateway.rb +490 -481
- data/lib/discorb/http.rb +1 -1
- data/lib/discorb/interaction.rb +131 -19
- data/lib/discorb/log.rb +1 -1
- data/lib/discorb/member.rb +10 -1
- data/lib/discorb/message.rb +33 -6
- data/lib/discorb/modules.rb +77 -4
- data/lib/discorb/user.rb +8 -3
- data/lib/discorb/webhook.rb +14 -3
- data/lib/discorb.rb +7 -7
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bdf66383e4ecb0161c962e9621861a07f49c515ce7754c8f7b630a80acbf009
|
4
|
+
data.tar.gz: 7035f001fd4ffb4523f9ca5b64c9cda440bd3d7e755174264c9f9cd74f8928a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8101e84ffd48fdf3c20cbef1fe31365f0f606e05d6a031fe38a8810dd51dc5abbccf86416268a07a74b1a57e8623c2c888c9077973f3f44c7e5b15c8fa3aa0c
|
7
|
+
data.tar.gz: 39b55c52514f0c80149f7a4453ea489bd1fb9baf440cfb6fcecd1956d6837d3a666566edeecf2da35e254eab73a7e5c279c225b9937ee2259c1b605b6b94b549
|
data/Changelog.md
CHANGED
@@ -14,4 +14,35 @@
|
|
14
14
|
|
15
15
|
## v0.0.4
|
16
16
|
|
17
|
-
- Fix: Fix NoMethodError by webhook message
|
17
|
+
- Fix: Fix NoMethodError by webhook message
|
18
|
+
- Add: Add `#author` to webhook message
|
19
|
+
- Fix: Add `#bot?` to webhook author
|
20
|
+
|
21
|
+
## v0.0.5
|
22
|
+
|
23
|
+
- Fix: Fix GitHub link
|
24
|
+
- Change: Internet to HTTP
|
25
|
+
|
26
|
+
## v0.0.6
|
27
|
+
|
28
|
+
- Fix: Fix error in client without members intent
|
29
|
+
- Add: Add ThreadChannel::News
|
30
|
+
- Add: Add official discord link
|
31
|
+
|
32
|
+
## v0.0.7
|
33
|
+
|
34
|
+
- Fix: Fix `member_xxx` event
|
35
|
+
|
36
|
+
## 0.0.8
|
37
|
+
|
38
|
+
- Delete: Delete task parameter
|
39
|
+
|
40
|
+
## 0.1.0
|
41
|
+
|
42
|
+
- Add: Add `User#created_at`
|
43
|
+
- Add: Add `Member#to_s_user`
|
44
|
+
- Add: Add `DefaultAvatar`
|
45
|
+
- Add: Suppot application commands
|
46
|
+
- Add: Add `Client#ping`
|
47
|
+
- Add: Allow `String` for `Embed#initialize`
|
48
|
+
- Change: Change log format
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -0,0 +1,251 @@
|
|
1
|
+
# @title Application Commands
|
2
|
+
|
3
|
+
# Application Commands
|
4
|
+
|
5
|
+
## What is an application command?
|
6
|
+
|
7
|
+
> Application commands are commands that an application can register to Discord. They provide users a first-class way of interacting directly with your application that feels deeply integrated into Discord.
|
8
|
+
|
9
|
+
From: [Discord API docs](https://discord.com/developers/docs/interactions/application-commands#application-commands)
|
10
|
+
|
11
|
+
## How do I register an application command?
|
12
|
+
|
13
|
+
Use {Discorb::Command::Handler#slash}, {Discorb::Command::Handler#group} for slash commands, {Discorb::Command::Handler#user_command} for user menu commands, and {Discorb::Command::Handler#message_command} for message menu commands.
|
14
|
+
|
15
|
+
### Note
|
16
|
+
|
17
|
+
To register a global command, it will take 1 hour to be registered.
|
18
|
+
Guild commands will be registered immediately.
|
19
|
+
|
20
|
+
### Register Slash Commands
|
21
|
+
|
22
|
+
This example registers a slash command that says "Hello, world!" when the user types `/hello`.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require "discorb"
|
26
|
+
|
27
|
+
client = Discorb::Client.new
|
28
|
+
|
29
|
+
client.slash("hello", "Greet for you") do |interaction|
|
30
|
+
interaction.post("Hello World!", ephemeral: true)
|
31
|
+
end
|
32
|
+
|
33
|
+
client.run(ENV["DISCORD_BOT_TOKEN"])
|
34
|
+
```
|
35
|
+
|
36
|
+
{Discorb::Command::Handler#slash} takes 5 arguments:
|
37
|
+
|
38
|
+
| Argument | Description |
|
39
|
+
|---------|-------------|
|
40
|
+
| `command_name` | The name of the command. |
|
41
|
+
| `description` | The description of the command. |
|
42
|
+
| `options` | A hash of options. |
|
43
|
+
| `guild_ids` | The ID of the guild to register the command in. |
|
44
|
+
| `block` | A block that will be called when the command is invoked. |
|
45
|
+
|
46
|
+
In `options`, hash should be like this:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
{
|
50
|
+
"Name" => {
|
51
|
+
type: :string,
|
52
|
+
required: true,
|
53
|
+
description: "The description of the command."
|
54
|
+
}
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
| Key | Description |
|
59
|
+
| --- | --- |
|
60
|
+
| `type` | The type of the argument. |
|
61
|
+
| `required` | Whether the argument is required. |
|
62
|
+
| `description` | The description of the argument. |
|
63
|
+
| `choices` | The choices of the argument. |
|
64
|
+
|
65
|
+
`choices` should be unspecified if you don't want to use it.
|
66
|
+
`choices` is hash like this:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
{
|
70
|
+
"vocaloid" => {
|
71
|
+
required: true,
|
72
|
+
description: "The vocaloid which you like."
|
73
|
+
type: :string,
|
74
|
+
choices: {
|
75
|
+
"Hatsune Miku" => "miku",
|
76
|
+
"Kagamine Rin" => "rin",
|
77
|
+
"Kagamine Len" => "len",
|
78
|
+
"Megurine Luka" => "luka",
|
79
|
+
"MEIKO" => "meiko",
|
80
|
+
"KAITO" => "kaito",
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
# Note: This aritcle is written in 8/31.
|
86
|
+
```
|
87
|
+
|
88
|
+
The key will be displayed in the user menu, and the value will be used as the argument.
|
89
|
+
|
90
|
+
In `type`, You must use one of the following:
|
91
|
+
|
92
|
+
| Name | Description | Aliases|
|
93
|
+
| --- | --- | --- |
|
94
|
+
| `:string` | String argument. | `:str` |
|
95
|
+
| `:integer` | Integer argument. | `:int` |
|
96
|
+
| `:float` | Float argument. | None |
|
97
|
+
| `:boolean` | Boolean argument. | `:bool` |
|
98
|
+
| `:user` | User argument. | `:member` |
|
99
|
+
| `:channel` | Channel argument. | None |
|
100
|
+
| `:role` | Role argument. | None |
|
101
|
+
|
102
|
+
### Group Slash Commands
|
103
|
+
|
104
|
+
To register a group of slash commands, use {Discorb::Command::Handler#slash_group}.
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
group = client.slash_group("settings", "Set settings of bot.")
|
108
|
+
|
109
|
+
group.slash("message_expand", "Whether bot should expand message.", {
|
110
|
+
"enabled" => {
|
111
|
+
type: :boolean,
|
112
|
+
description: "Whether bot should expand message."
|
113
|
+
}
|
114
|
+
}) do |interaction|
|
115
|
+
# ...
|
116
|
+
end
|
117
|
+
|
118
|
+
group.slash("bump_alert", "Whether bot should notify DISBOARD bump.", {
|
119
|
+
"enabled" => {
|
120
|
+
type: :boolean,
|
121
|
+
description: "Whether bot should notify DISBOARD bump."
|
122
|
+
}
|
123
|
+
}) do |interaction|
|
124
|
+
# ...
|
125
|
+
end
|
126
|
+
```
|
127
|
+
|
128
|
+
You can make subcommand group by using {Discorb::Command::GroupCommand#group}.
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
group = client.slash_group("permission", "Set/Get command permissions.")
|
132
|
+
|
133
|
+
group_user = group.group("user", "Set/Get user's command permissions.")
|
134
|
+
|
135
|
+
group_user.slash("set", "Set user's command permissions.", {
|
136
|
+
"user_id" => {
|
137
|
+
type: :user,
|
138
|
+
description: "The user."
|
139
|
+
},
|
140
|
+
"value" => {
|
141
|
+
type: :boolean,
|
142
|
+
description: "Whether the user can use the command."
|
143
|
+
}
|
144
|
+
}) do |interaction, user|
|
145
|
+
# ...
|
146
|
+
end
|
147
|
+
|
148
|
+
group_user.slash("get", "Set user's command permissions.", {
|
149
|
+
"user_id" => {
|
150
|
+
type: :user,
|
151
|
+
description: "The user."
|
152
|
+
},
|
153
|
+
}) do |interaction, user|
|
154
|
+
# ...
|
155
|
+
end
|
156
|
+
|
157
|
+
group_user = group.group("user", "Set/Get user's command permissions.")
|
158
|
+
|
159
|
+
group_user.slash("set", "Set user's command permissions.", {
|
160
|
+
"user_id" => {
|
161
|
+
type: :user,
|
162
|
+
description: "The user."
|
163
|
+
},
|
164
|
+
"value" => {
|
165
|
+
type: :boolean,
|
166
|
+
description: "Whether the user can use the command."
|
167
|
+
}
|
168
|
+
}) do |interaction, user|
|
169
|
+
# ...
|
170
|
+
end
|
171
|
+
|
172
|
+
group_user.slash("get", "Set user's command permissions.", {
|
173
|
+
"user_id" => {
|
174
|
+
type: :user,
|
175
|
+
description: "The user."
|
176
|
+
},
|
177
|
+
}) do |interaction, user|
|
178
|
+
# ...
|
179
|
+
end
|
180
|
+
|
181
|
+
group_role = group.group("role", "Set/Get role's command permissions.")
|
182
|
+
|
183
|
+
group_role.slash("set", "Set role's command permissions.", {
|
184
|
+
"role_id" => {
|
185
|
+
type: :role,
|
186
|
+
description: "The role."
|
187
|
+
},
|
188
|
+
"value" => {
|
189
|
+
type: :boolean,
|
190
|
+
description: "Whether the role can use the command."
|
191
|
+
}
|
192
|
+
}) do |interaction, role|
|
193
|
+
# ...
|
194
|
+
end
|
195
|
+
|
196
|
+
group_role.slash("get", "Set role's command permissions.", {
|
197
|
+
"role_id" => {
|
198
|
+
type: :role,
|
199
|
+
description: "The role."
|
200
|
+
},
|
201
|
+
}) do |interaction, role|
|
202
|
+
# ...
|
203
|
+
end
|
204
|
+
|
205
|
+
```
|
206
|
+
|
207
|
+
### Register User Context Menu Command
|
208
|
+
|
209
|
+
```ruby
|
210
|
+
client.user_command("hello") do |interaction, user|
|
211
|
+
interaction.post("Hello, #{user.name}!")
|
212
|
+
end
|
213
|
+
```
|
214
|
+
{Discorb::Command::Handler#user_command} takes 3 arguments:
|
215
|
+
|
216
|
+
| Parameter | Description |
|
217
|
+
| --- | --- |
|
218
|
+
| `command_name` | The name of the command. |
|
219
|
+
| `guild_ids` | The ID of the guild to register the command in. |
|
220
|
+
| `block` | A block that will be called when the command is invoked. |
|
221
|
+
|
222
|
+
`block` will be called with two arguments:
|
223
|
+
|
224
|
+
| Parameter | Description |
|
225
|
+
| --- | --- |
|
226
|
+
| `interaction` | The interaction object. |
|
227
|
+
| `user` | The user object. |
|
228
|
+
|
229
|
+
|
230
|
+
### Register Message Context Menu Command
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
client.message_command("Bookmark") do |interaction, message|
|
234
|
+
# ...
|
235
|
+
end
|
236
|
+
```
|
237
|
+
|
238
|
+
{Discorb::Command::Handler#message_command} takes 3 arguments:
|
239
|
+
|
240
|
+
| Parameter | Description |
|
241
|
+
| --- | --- |
|
242
|
+
| `command_name` | The name of the command. |
|
243
|
+
| `guild_ids` | The ID of the guild to register the command in. |
|
244
|
+
| `block` | A block that will be called when the command is invoked. |
|
245
|
+
|
246
|
+
`block` will be called with two arguments:
|
247
|
+
|
248
|
+
| Parameter | Description |
|
249
|
+
| --- | --- |
|
250
|
+
| `interaction` | The interaction object. |
|
251
|
+
| `message` | The message object. |
|
data/docs/discord_irb.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# @title discord-irb
|
2
|
+
|
3
|
+
# discord-irb
|
4
|
+
|
5
|
+
discord-irb is a command line tool for interacting with the Discord API.
|
6
|
+
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
```
|
11
|
+
$ bundle exec discord-irb
|
12
|
+
```
|
13
|
+
|
14
|
+
To start.
|
15
|
+
|
16
|
+
### Load a token
|
17
|
+
|
18
|
+
discord-irb will load a token from...
|
19
|
+
1. the `DISCORD_BOT_TOKEN` environment variable
|
20
|
+
2. the `DISCORD_TOKEN` environment variable
|
21
|
+
3. `token` file in the current directory(customizable with `-f` option)
|
22
|
+
4. your input
|
23
|
+
|
24
|
+
### Arguments
|
25
|
+
|
26
|
+
#### `-i`, `--intents`
|
27
|
+
|
28
|
+
Intents to use.
|
29
|
+
Specify intents with integers.
|
30
|
+
|
31
|
+
#### `-t`, `--token-file`
|
32
|
+
|
33
|
+
Token file to load.
|
34
|
+
|
35
|
+
### Variables
|
36
|
+
|
37
|
+
#### `message`
|
38
|
+
|
39
|
+
Last message received.
|
data/docs/events.md
CHANGED
@@ -9,7 +9,7 @@ You can register event handlers with {Client#on}.
|
|
9
9
|
Alternatively, you can use {Client#once} to register a one-time event handler.
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
client.on :message do |
|
12
|
+
client.on :message do |event|
|
13
13
|
puts event.message.content
|
14
14
|
end
|
15
15
|
```
|
@@ -18,13 +18,9 @@ This example will print the content of every message received.
|
|
18
18
|
|
19
19
|
## Event reference
|
20
20
|
|
21
|
-
### Note
|
22
|
-
|
23
|
-
`Async::Task` object will be passed to the event handler in the first argument: `task`.
|
24
|
-
|
25
21
|
### Client events
|
26
22
|
|
27
|
-
#### `event_receive(
|
23
|
+
#### `event_receive(event_name, data)`
|
28
24
|
Fires when a event is received.
|
29
25
|
|
30
26
|
| Parameter | Type | Description |
|
@@ -32,17 +28,17 @@ Fires when a event is received.
|
|
32
28
|
|`event_name`| Symbol | The name of the event. |
|
33
29
|
|`data` | Hash | The data of the event. |
|
34
30
|
|
35
|
-
#### `ready(
|
31
|
+
#### `ready()`
|
36
32
|
|
37
33
|
Fires when the client is ready.
|
38
34
|
|
39
|
-
#### `resumed(
|
35
|
+
#### `resumed()`
|
40
36
|
|
41
37
|
Fires when the client is resumed connection.
|
42
38
|
|
43
39
|
### Guild events
|
44
40
|
|
45
|
-
#### `guild_join(
|
41
|
+
#### `guild_join(guild)`
|
46
42
|
|
47
43
|
Fires when client joins a guild.
|
48
44
|
|
@@ -50,7 +46,7 @@ Fires when client joins a guild.
|
|
50
46
|
| ---------- | ----- | ----------- |
|
51
47
|
|`guild` | {Discorb::Guild} | The guild that was joined. |
|
52
48
|
|
53
|
-
#### `guild_available(
|
49
|
+
#### `guild_available(guild)`
|
54
50
|
|
55
51
|
Fires when a guild becomes available.
|
56
52
|
|
@@ -58,7 +54,7 @@ Fires when a guild becomes available.
|
|
58
54
|
| ---------- | ----- | ----------- |
|
59
55
|
|`guild` | {Discorb::Guild} | The guild that became available. |
|
60
56
|
|
61
|
-
#### `guild_update(
|
57
|
+
#### `guild_update(before, after)`
|
62
58
|
|
63
59
|
Fires when client updates a guild.
|
64
60
|
|
@@ -67,7 +63,7 @@ Fires when client updates a guild.
|
|
67
63
|
|`before` | {Discorb::Guild} | The guild before the update. |
|
68
64
|
|`after` | {Discorb::Guild} | The guild after the update. |
|
69
65
|
|
70
|
-
#### `guild_leave(
|
66
|
+
#### `guild_leave(guild)`
|
71
67
|
|
72
68
|
Fires when client leaves a guild.
|
73
69
|
|
@@ -75,7 +71,7 @@ Fires when client leaves a guild.
|
|
75
71
|
| ---------- | ----- | ----------- |
|
76
72
|
|`guild` | {Discorb::Guild} | The guild that was left. |
|
77
73
|
|
78
|
-
#### `guild_destroy(
|
74
|
+
#### `guild_destroy(guild)`
|
79
75
|
|
80
76
|
Fires when guild is destroyed.
|
81
77
|
|
@@ -83,7 +79,7 @@ Fires when guild is destroyed.
|
|
83
79
|
| ---------- | ----- | ----------- |
|
84
80
|
|`guild` | {Discorb::Guild} | The guild that was destroyed. |
|
85
81
|
|
86
|
-
#### `guild_integrations_update(
|
82
|
+
#### `guild_integrations_update(guild)`
|
87
83
|
|
88
84
|
Fires when guild integrations are updated.
|
89
85
|
|
@@ -91,7 +87,7 @@ Fires when guild integrations are updated.
|
|
91
87
|
| ---------- | ----- | ----------- |
|
92
88
|
|`guild` | {Discorb::Guild} | The guild that integrations were updated for. |
|
93
89
|
|
94
|
-
#### `guild_ban_add(
|
90
|
+
#### `guild_ban_add(guild, user)`
|
95
91
|
|
96
92
|
Fires when a user is banned from a guild.
|
97
93
|
|
@@ -101,7 +97,7 @@ Fires when a user is banned from a guild.
|
|
101
97
|
|`guild` | {Discorb::Guild} | The guild that the user was banned from. |
|
102
98
|
|`user` | {Discorb::User} | The user that was banned. |
|
103
99
|
|
104
|
-
#### `guild_ban_remove(
|
100
|
+
#### `guild_ban_remove(guild, user)`
|
105
101
|
|
106
102
|
Fires when a user is unbanned from a guild.
|
107
103
|
|
@@ -112,7 +108,7 @@ Fires when a user is unbanned from a guild.
|
|
112
108
|
|
113
109
|
### Channel events
|
114
110
|
|
115
|
-
#### `channel_create(
|
111
|
+
#### `channel_create(channel)`
|
116
112
|
|
117
113
|
Fires when a channel is created.
|
118
114
|
|
@@ -120,7 +116,7 @@ Fires when a channel is created.
|
|
120
116
|
| ---------- | ----- | ----------- |
|
121
117
|
|`channel` | {Discorb::Channel} | The channel that was created. |
|
122
118
|
|
123
|
-
#### `channel_update(
|
119
|
+
#### `channel_update(before, after)`
|
124
120
|
|
125
121
|
Fires when a channel is updated.
|
126
122
|
|
@@ -129,7 +125,7 @@ Fires when a channel is updated.
|
|
129
125
|
|`before` | {Discorb::Channel} | The channel before the update. |
|
130
126
|
|`after` | {Discorb::Channel} | The channel after the update. |
|
131
127
|
|
132
|
-
#### `channel_delete(
|
128
|
+
#### `channel_delete(channel)`
|
133
129
|
|
134
130
|
Fires when a channel is deleted.
|
135
131
|
|
@@ -137,7 +133,7 @@ Fires when a channel is deleted.
|
|
137
133
|
| ---------- | ----- | ----------- |
|
138
134
|
|`channel` | {Discorb::Channel} | The channel that was deleted. |
|
139
135
|
|
140
|
-
#### `webhooks_update(
|
136
|
+
#### `webhooks_update(event)`
|
141
137
|
|
142
138
|
Fires when a webhook is updated.
|
143
139
|
|
@@ -145,7 +141,7 @@ Fires when a webhook is updated.
|
|
145
141
|
| ---------- | ----- | ----------- |
|
146
142
|
|`event` | {Discorb::WebhooksUpdateEvent} | The webhook update event. |
|
147
143
|
|
148
|
-
#### `thread_new(
|
144
|
+
#### `thread_new(thread)`
|
149
145
|
|
150
146
|
Fires when a thread is created.
|
151
147
|
|
@@ -153,7 +149,7 @@ Fires when a thread is created.
|
|
153
149
|
| ---------- | ----- | ----------- |
|
154
150
|
|`thread` | {Discorb::ThreadChannel} | The thread that was created. |
|
155
151
|
|
156
|
-
#### `thread_join(
|
152
|
+
#### `thread_join(thread)`
|
157
153
|
|
158
154
|
Fires when client joins a thread.
|
159
155
|
|
@@ -162,7 +158,7 @@ Fires when client joins a thread.
|
|
162
158
|
|`thread` | {Discorb::ThreadChannel} | The thread that was joined. |
|
163
159
|
|
164
160
|
|
165
|
-
#### `thread_delete(
|
161
|
+
#### `thread_delete(thread)`
|
166
162
|
|
167
163
|
Fires when a thread is deleted.
|
168
164
|
|
@@ -170,7 +166,7 @@ Fires when a thread is deleted.
|
|
170
166
|
| ---------- | ----- | ----------- |
|
171
167
|
|`thread` | {Discorb::ThreadChannel} | The thread that was deleted. |
|
172
168
|
|
173
|
-
#### `thread_update(
|
169
|
+
#### `thread_update(before, after)`
|
174
170
|
|
175
171
|
Fires when a thread is updated.
|
176
172
|
|
@@ -179,7 +175,7 @@ Fires when a thread is updated.
|
|
179
175
|
|`before` | {Discorb::ThreadChannel} | The thread before the update. |
|
180
176
|
|`after` | {Discorb::ThreadChannel} | The thread after the update. |
|
181
177
|
|
182
|
-
#### `thread_members_update(
|
178
|
+
#### `thread_members_update(thread, added, removed)`
|
183
179
|
|
184
180
|
Fires when a thread's members are updated.
|
185
181
|
|
@@ -189,7 +185,7 @@ Fires when a thread's members are updated.
|
|
189
185
|
|`added` | Array<{ThreadChannel::Member}> | An array of {Discorb::ThreadChannel::Member} objects that were added to the thread. |
|
190
186
|
|`removed` | Array<{ThreadChannel::Member}> | An array of {Discorb::ThreadChannel::Member} objects that were removed from the thread. |
|
191
187
|
|
192
|
-
#### `thread_member_update(
|
188
|
+
#### `thread_member_update(before, after)`
|
193
189
|
|
194
190
|
Fires when a thread member is updated.
|
195
191
|
|
@@ -201,7 +197,7 @@ Fires when a thread member is updated.
|
|
201
197
|
|
202
198
|
### Integration events
|
203
199
|
|
204
|
-
#### `integration_create(
|
200
|
+
#### `integration_create(integration)`
|
205
201
|
|
206
202
|
Fires when a guild integration is created.
|
207
203
|
|
@@ -209,7 +205,7 @@ Fires when a guild integration is created.
|
|
209
205
|
| ---------- | ----- | ----------- |
|
210
206
|
|`integration`| {Discorb::Integration}| The created integration. |
|
211
207
|
|
212
|
-
#### `integration_update(
|
208
|
+
#### `integration_update(before, after)`
|
213
209
|
|
214
210
|
Fires when a guild integration is updated.
|
215
211
|
|
@@ -219,7 +215,7 @@ Fires when a guild integration is updated.
|
|
219
215
|
|`before` | {Discorb::Integration}| The integration before the update. |
|
220
216
|
|`after` | {Discorb::Integration}| The integration after the update. |
|
221
217
|
|
222
|
-
#### `integration_delete(
|
218
|
+
#### `integration_delete(integration)`
|
223
219
|
|
224
220
|
Fires when a guild integration is deleted.
|
225
221
|
|
@@ -229,7 +225,7 @@ Fires when a guild integration is deleted.
|
|
229
225
|
|
230
226
|
### Message events
|
231
227
|
|
232
|
-
#### `message(
|
228
|
+
#### `message(message)`
|
233
229
|
|
234
230
|
Fires when a message is created.
|
235
231
|
|
@@ -237,15 +233,15 @@ Fires when a message is created.
|
|
237
233
|
| ---------- | ----- | ----------- |
|
238
234
|
|`message` | {Discorb::Message}| The created message. |
|
239
235
|
|
240
|
-
#### `message_update(
|
236
|
+
#### `message_update(event)`
|
241
237
|
|
242
238
|
Fires when a message is updated.
|
243
239
|
|
244
240
|
| Parameter | Type | Description |
|
245
241
|
| ---------- | ----- | ----------- |
|
246
|
-
|`event` | {Discorb::
|
242
|
+
|`event` | {Discorb::Gateway::MessageUpdateEvent}| The message after the update. |
|
247
243
|
|
248
|
-
#### `message_delete(
|
244
|
+
#### `message_delete(message, channel, guild)`
|
249
245
|
|
250
246
|
Fires when a message is deleted.
|
251
247
|
|
@@ -259,7 +255,7 @@ Fires when a message is deleted.
|
|
259
255
|
|
260
256
|
This will fire when cached messages are deleted.
|
261
257
|
|
262
|
-
#### `message_delete_id(
|
258
|
+
#### `message_delete_id(message_id, channel, guild)`
|
263
259
|
|
264
260
|
Fires when a message is deleted.
|
265
261
|
Not like {#message_delete} this will fire even message is not cached.
|
@@ -270,67 +266,67 @@ Not like {#message_delete} this will fire even message is not cached.
|
|
270
266
|
|`channel` | {Discorb::Channel}| The channel the message was deleted from. |
|
271
267
|
|`guild` | ?{Discorb::Guild} | The guild the message was deleted from. |
|
272
268
|
|
273
|
-
#### `message_delete_bulk(
|
269
|
+
#### `message_delete_bulk(messages)`
|
274
270
|
|
275
271
|
Fires when a bulk of messages are deleted.
|
276
272
|
|
277
273
|
| Parameter | Type | Description |
|
278
274
|
| ---------- | ----- | ----------- |
|
279
|
-
|`messages` | Array<{Discorb::Message}, {Discorb::
|
275
|
+
|`messages` | Array<{Discorb::Message}, {Discorb::Gateway::UnknownDeleteBulkMessage}> | The deleted messages. |
|
280
276
|
|
281
|
-
#### `message_pin_update(
|
277
|
+
#### `message_pin_update(event)`
|
282
278
|
|
283
279
|
Fires when a message is pinned or unpinned.
|
284
280
|
|
285
281
|
| Parameter | Type | Description |
|
286
282
|
| ---------- | ----- | ----------- |
|
287
|
-
|`event` | {Discorb::
|
283
|
+
|`event` | {Discorb::Gateway::MessagePinUpdateEvent}| The event object. |
|
288
284
|
|
289
|
-
#### `typing_start(
|
285
|
+
#### `typing_start(event)`
|
290
286
|
|
291
287
|
Fires when a user starts typing.
|
292
288
|
|
293
289
|
| Parameter | Type | Description |
|
294
290
|
| --------- | ----- | ----------- |
|
295
|
-
|`event` | {Discorb::
|
291
|
+
|`event` | {Discorb::Gateway::TypingStartEvent}| The event object. |
|
296
292
|
|
297
293
|
### Reaction events
|
298
294
|
|
299
|
-
#### `reaction_add(
|
295
|
+
#### `reaction_add(event)`
|
300
296
|
|
301
297
|
Fires when a reaction is added to a message.
|
302
298
|
|
303
299
|
| Parameter | Type | Description |
|
304
300
|
| ---------- | ----- | ----------- |
|
305
|
-
|`event` | {Discorb::
|
301
|
+
|`event` | {Discorb::Gateway::ReactionEvent}| The event object. |
|
306
302
|
|
307
|
-
#### `reaction_remove(
|
303
|
+
#### `reaction_remove(event)`
|
308
304
|
|
309
305
|
Fires when someone removes a reaction from a message.
|
310
306
|
|
311
307
|
| Parameter | Type | Description |
|
312
308
|
| ---------- | ----- | ----------- |
|
313
|
-
|`event` | {Discorb::
|
309
|
+
|`event` | {Discorb::Gateway::ReactionEvent}| The event object. |
|
314
310
|
|
315
|
-
#### `reaction_remove_all(
|
311
|
+
#### `reaction_remove_all(event)`
|
316
312
|
|
317
313
|
Fires when all reactions are removed from a message.
|
318
314
|
|
319
315
|
| Parameter | Type | Description |
|
320
316
|
| ---------- | ----- | ----------- |
|
321
|
-
|`event` | {Discorb::
|
317
|
+
|`event` | {Discorb::Gateway::ReactionRemoveAllEvent}| The event object. |
|
322
318
|
|
323
|
-
#### `reaction_remove_emoji(
|
319
|
+
#### `reaction_remove_emoji(event)`
|
324
320
|
|
325
321
|
Fires when a reaction is removed from a message.
|
326
322
|
|
327
323
|
| Parameter | Type | Description |
|
328
324
|
| ---------- | ----- | ----------- |
|
329
|
-
|`event` | {Discorb::
|
325
|
+
|`event` | {Discorb::Gateway::ReactionRemoveEmojiEvent}| The event object. |
|
330
326
|
|
331
327
|
### Role events
|
332
328
|
|
333
|
-
#### `role_create(
|
329
|
+
#### `role_create(role)`
|
334
330
|
|
335
331
|
Fires when a role is created.
|
336
332
|
|
@@ -338,7 +334,7 @@ Fires when a role is created.
|
|
338
334
|
| ---------- | ----- | ----------- |
|
339
335
|
|`role` | {Discorb::Role}| The created role. |
|
340
336
|
|
341
|
-
#### `role_update(
|
337
|
+
#### `role_update(before, after)`
|
342
338
|
|
343
339
|
Fires when a role is updated.
|
344
340
|
|
@@ -347,7 +343,7 @@ Fires when a role is updated.
|
|
347
343
|
|`before` | {Discorb::Role}| The role before the update. |
|
348
344
|
|`after` | {Discorb::Role}| The role after the update. |
|
349
345
|
|
350
|
-
#### `role_remove(
|
346
|
+
#### `role_remove(role)`
|
351
347
|
|
352
348
|
Fires when a role is deleted.
|
353
349
|
|
@@ -361,7 +357,7 @@ Fires when a role is deleted.
|
|
361
357
|
|
362
358
|
These events requires the `guild_members` intent.
|
363
359
|
|
364
|
-
#### `member_add(
|
360
|
+
#### `member_add(member)`
|
365
361
|
|
366
362
|
Fires when a member joins a guild.
|
367
363
|
|
@@ -369,7 +365,7 @@ Fires when a member joins a guild.
|
|
369
365
|
| ---------- | ----- | ----------- |
|
370
366
|
|`member` | {Discorb::Member}| The member that joined. |
|
371
367
|
|
372
|
-
#### `member_update(
|
368
|
+
#### `member_update(before, after)`
|
373
369
|
|
374
370
|
Fires when a member is updated.
|
375
371
|
|
@@ -378,7 +374,7 @@ Fires when a member is updated.
|
|
378
374
|
|`before` | {Discorb::Member}| The member before the update. |
|
379
375
|
|`after` | {Discorb::Member}| The member after the update. |
|
380
376
|
|
381
|
-
#### `member_remove(
|
377
|
+
#### `member_remove(member)`
|
382
378
|
|
383
379
|
Fires when a member is removed from a guild.
|
384
380
|
|
@@ -388,7 +384,7 @@ Fires when a member is removed from a guild.
|
|
388
384
|
|
389
385
|
### Role events
|
390
386
|
|
391
|
-
#### `role_create(
|
387
|
+
#### `role_create(role)`
|
392
388
|
|
393
389
|
Fires when a role is created.
|
394
390
|
|
@@ -396,7 +392,7 @@ Fires when a role is created.
|
|
396
392
|
| ---------- | ----- | ----------- |
|
397
393
|
|`role` | {Discorb::Role}| The created role. |
|
398
394
|
|
399
|
-
#### `role_update(
|
395
|
+
#### `role_update(before, after)`
|
400
396
|
|
401
397
|
Fires when a role is updated.
|
402
398
|
|
@@ -405,7 +401,7 @@ Fires when a role is updated.
|
|
405
401
|
|`before` | {Discorb::Role}| The role before the update. |
|
406
402
|
|`after` | {Discorb::Role}| The role after the update. |
|
407
403
|
|
408
|
-
#### `role_remove(
|
404
|
+
#### `role_remove(role)`
|
409
405
|
|
410
406
|
Fires when a role is deleted.
|
411
407
|
|
@@ -415,7 +411,7 @@ Fires when a role is deleted.
|
|
415
411
|
|
416
412
|
### Invite events
|
417
413
|
|
418
|
-
#### `invite_create(
|
414
|
+
#### `invite_create(invite)`
|
419
415
|
|
420
416
|
Fires when a invite is created.
|
421
417
|
|
@@ -423,7 +419,7 @@ Fires when a invite is created.
|
|
423
419
|
| ---------- | ----- | ----------- |
|
424
420
|
|`invite` | {Discorb::Invite}| The created invite. |
|
425
421
|
|
426
|
-
#### `invite_delete(
|
422
|
+
#### `invite_delete(invite)`
|
427
423
|
|
428
424
|
Fires when a invite is deleted.
|
429
425
|
|
@@ -433,7 +429,7 @@ Fires when a invite is deleted.
|
|
433
429
|
|
434
430
|
### Interaction events
|
435
431
|
|
436
|
-
#### `button_click(
|
432
|
+
#### `button_click(interaction)`
|
437
433
|
|
438
434
|
Fires when a button is clicked.
|
439
435
|
|
@@ -441,7 +437,7 @@ Fires when a button is clicked.
|
|
441
437
|
| ---------- | ----- | ----------- |
|
442
438
|
|`interaction`| {Discorb::MessageComponentInteraction::Button}| The interaction object. |
|
443
439
|
|
444
|
-
#### `select_menu_select(
|
440
|
+
#### `select_menu_select(interaction)`
|
445
441
|
|
446
442
|
Fires when a select menu is selected.
|
447
443
|
|
@@ -455,7 +451,7 @@ It's too big, so they're documented in {file:docs/voice_events.md}
|
|
455
451
|
|
456
452
|
### Low-level events
|
457
453
|
|
458
|
-
#### `guild_create(
|
454
|
+
#### `guild_create(guild)`
|
459
455
|
|
460
456
|
Fires when `GUILD_CREATE` is received.
|
461
457
|
|
@@ -463,7 +459,7 @@ Fires when `GUILD_CREATE` is received.
|
|
463
459
|
| ---------- | ----- | ----------- |
|
464
460
|
|`guild` | {Discorb::Guild}| The guild of the event. |
|
465
461
|
|
466
|
-
#### `guild_delete(
|
462
|
+
#### `guild_delete(guild)`
|
467
463
|
|
468
464
|
Fires when `GUILD_DELETE` is received.
|
469
465
|
|
@@ -471,7 +467,7 @@ Fires when `GUILD_DELETE` is received.
|
|
471
467
|
| ---------- | ----- | ----------- |
|
472
468
|
|`guild` | {Discorb::Guild}| The guild of the event. |
|
473
469
|
|
474
|
-
#### `thread_create(
|
470
|
+
#### `thread_create(thread)`
|
475
471
|
|
476
472
|
Fires when `THREAD_CREATE` is received.
|
477
473
|
|