discorb 0.5.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6919eceb7431839769fc4bca402df56fef34e50d12f47f6cc8824e210bef95b
4
- data.tar.gz: 8e50f4f53b5a1b52d3c4e29f9856cac2469a067c7d6005542a520081622d8da2
3
+ metadata.gz: 13326863238ba4e79e873947fe579da1027bfcfe7f6baed1bd9d0c74806e31a1
4
+ data.tar.gz: c43a370b95eec06dcfa2ce0f627c8b9e14421464848c7170690ddc9527aff589
5
5
  SHA512:
6
- metadata.gz: 45a3649f783094e691921a041428df1a7a1d368705a116240385b94e9d2b30983a232b47a5d702c50ae61a7a4b36ef3252f6b7f48992832c6f4073cadab08d26
7
- data.tar.gz: 1a89fba62ef9b03db524eb6b57e409280c1888709e248df33cd1c42266c12ae534535a39c2765046a56eebd66adb5b8472f202115cf0e16cfcbbefee04e17e1a
6
+ metadata.gz: bf804c54e218696a9ba5464af5e8c6d4d25132ac573413d0453502872e2dcc55ec49bfb4c571d05df4d489a49cef894ca139091e74fb41fb0d5f36c2786e5cdf
7
+ data.tar.gz: 8fb94771a4ea9730962f084d40439383b412caa97674aa9d6edb38d01ebd10fb14ecc54a9bac24a067768bbe5866d18ddd6366449ba84355324af70839fce135
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: Bug Report
3
+ about: A bug report for discorb.
4
+ labels:
5
+ - bug
6
+ ---
7
+
8
+ <!--
9
+ Before submitting a bug report, please check that it is not already being, or has been, reported.
10
+ Don't forget to find closed issues and check if the bug is already fixed.
11
+ -->
12
+
13
+ ## What is the bug?
14
+
15
+ <!--
16
+ Please describe the bug in detail.
17
+ Ex:
18
+ I want to sleep, but I can't.
19
+ -->
20
+
21
+ ## What steps did you take to reproduce the bug?
22
+
23
+ <!--
24
+ Please describe the steps you took to reproduce the bug.
25
+ Ex:
26
+ 1. Go to bed
27
+ 2. Count sheeps
28
+ 3. Observe
29
+ -->
30
+
31
+ ## What did you expect to see?
32
+
33
+ <!--
34
+ Please describe what you expected to see.
35
+ Ex:
36
+ I can sleep.
37
+ -->
38
+
39
+ ## What did you see instead?
40
+
41
+ <!--
42
+ Please describe what you saw instead.
43
+ Ex:
44
+ I can't sleep.
45
+ -->
46
+
47
+ ## Environment information
48
+
49
+ <!--
50
+ Use `discorb show` to get the current machine.
51
+ -->
52
+
53
+ ## Other information
54
+
55
+ <!--
56
+ Please describe any other information you want to include as such as the screenshots you took, or the logs you generated.
57
+ -->
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Documentation
4
+ url: https://discorb-lib.github.io/
5
+ about: Read the documentation first.
6
+ - name: Official Guild
7
+ url: https://discord.gg/hCP6zq8Vpj
8
+ about: Join the official Guild.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Feature Request
3
+ labels:
4
+ - Feature Request
5
+ - Enhancement
6
+ about: Feature request for discorb's future.
7
+ ---
8
+ <!--
9
+ Before submitting a feature request, please check there is no existing feature request for the feature you are requesting.
10
+ -->
11
+
12
+
13
+ ## What is the feature you are requesting?
14
+
15
+ <!--
16
+ Please describe the feature you are requesting.
17
+ Ex: Create discorb-chan
18
+ -->
19
+
20
+ ## Why do you need the feature?
21
+
22
+ <!--
23
+ Please describe the reason for the feature you are requesting.
24
+ Ex: She's cute.
25
+ -->
26
+
27
+ ## Alternative considerations?
28
+
29
+ <!--
30
+ Please describe alternative considerations for the feature you are requesting.
31
+ Ex: Add discorb-kun
32
+ -->
33
+
34
+ ## Additional context
35
+
36
+ <!--
37
+ Please describe any additional context you have for the feature you are requesting.
38
+ -->
data/.gitignore CHANGED
@@ -45,9 +45,9 @@ build-iPhoneSimulator/
45
45
 
46
46
  # for a library or gem, you might want to ignore these files since the code is
47
47
  # intended to run in multiple environments; otherwise, check them in:
48
- # Gemfile.lock
49
- # .ruby-version
50
- # .ruby-gemset
48
+ Gemfile.lock
49
+ .ruby-version
50
+ .ruby-gemset
51
51
 
52
52
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
53
  .rvmrc
data/.yardopts CHANGED
@@ -4,6 +4,7 @@
4
4
  --tag flags:"Flags"
5
5
  --verbose
6
6
  --asset docs/assets:assets
7
+ --asset assets:assets
7
8
  -
8
9
  docs/**/*.md
9
10
  Changelog.md
data/Changelog.md CHANGED
@@ -131,4 +131,43 @@
131
131
 
132
132
  ## 0.5.5
133
133
 
134
- - Fix: Fix some bugs
134
+ - Fix: Fix some bugs
135
+
136
+ ## 0.5.6
137
+
138
+ - Add: Raise error when intents are invalid
139
+ - Fix: Fix Emoji#==
140
+
141
+ ## 0.6.0
142
+
143
+ - Fix: Fix issue with client with no guilds
144
+ - Add: Add rbs (experimental)
145
+ - Add: Add `-t`, `--token` option to `discorb run`
146
+ - Add: Add `-g`, `--guild` option to `discorb setup`
147
+ - Change: Use `Async::Task<R>` instead of `R` in return value
148
+
149
+ ## 0.6.1
150
+
151
+ - Change: Rename `Event#discriminator` to `Event#metadata`
152
+ - Add: Add `:override` to `Client#on`
153
+
154
+ ## 0.7.0
155
+
156
+ - Add: Add `error` event
157
+ - Fix: Fix some issues with client without guild intent
158
+ - Add: Add alias for `#fired_by`
159
+ - Change!: Change block usage of `ApplicationCommand::Handler#group`
160
+ ```ruby
161
+ # before
162
+ client.slash_group do
163
+ slash "help", "Help" do |interaction|
164
+ # ...
165
+ end
166
+ end
167
+
168
+ # after
169
+ client.slash_group do |group|
170
+ group.slash "help", "Help" do |interaction|
171
+ # ...
172
+ end
173
+ end
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
- # discorb
2
- [![Document](https://img.shields.io/badge/Document-discord--lib.github.io-blue.svg)](https://discorb-lib.github.io/)
3
- [![Gem](https://img.shields.io/gem/dt/discorb?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/discorb)
4
- [![Gem](https://img.shields.io/gem/v/discorb?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/discorb)
5
- [![Discord](https://img.shields.io/discord/863581274916913193?logo=discord&logoColor=fff&color=5865f2&label=Discord)](https://discord.gg/hCP6zq8Vpj)
6
- [![GitHub](https://img.shields.io/github/stars/discorb-lib/discorb?color=24292e&label=Stars&logo=GitHub&logoColor=fff)](https://github.com/discorb-lib/discorb)
1
+ ![discorb](./assets/banner.svg)
2
+
3
+ <div align="center"><a href="https://discorb-lib.github.io/"><img src="https://img.shields.io/badge/Document-discorb--lib.github.io-blue.svg" alt="Document"></a>
4
+ <a href="https://rubygems.org/gems/discorb"><img src="https://img.shields.io/gem/dt/discorb?logo=rubygems&logoColor=fff" alt="Gem"></a>
5
+ <a href="https://rubygems.org/gems/discorb"><img src="https://img.shields.io/gem/v/discorb?logo=rubygems&logoColor=fff" alt="Gem"></a>
6
+ <a href="https://discord.gg/hCP6zq8Vpj"><img src="https://img.shields.io/discord/863581274916913193?logo=discord&logoColor=fff&color=5865f2&label=Discord" alt="Discord"></a>
7
+ <a href="https://github.com/discorb-lib/discorb"><img src="https://img.shields.io/github/stars/discorb-lib/discorb?color=24292e&label=Stars&logo=GitHub&logoColor=fff" alt="GitHub"></a></div>
8
+
9
+ ----
7
10
 
8
11
  discorb is a Discord API wrapper for Ruby.
9
12
 
data/assets/banner.svg ADDED
@@ -0,0 +1,125 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="レイヤー_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
5
+ y="0px" width="1080px" height="150px" viewBox="0 0 1080 150" enable-background="new 0 0 1080 150" xml:space="preserve">
6
+ <g>
7
+ <defs>
8
+ <rect id="SVGID_1_" x="283.667" y="-12.667" width="343.333" height="201.333"/>
9
+ </defs>
10
+ <clipPath id="SVGID_2_">
11
+ <use xlink:href="#SVGID_1_" overflow="visible"/>
12
+ </clipPath>
13
+ <g clip-path="url(#SVGID_2_)">
14
+ <g>
15
+ <g>
16
+ <path fill="#2E3338" d="M370.533,119.061c-13.503,0-21.565-10.312-21.565-27.582c0-18.543,9.872-30.525,25.149-30.525
17
+ c5.186,0,10.446,0.915,14.432,2.509l3.429,1.372V31.79l6.393-1.006v86.997h-4.456l-1.936-12.146l-3.522,4.208
18
+ C383.265,116.045,377.402,119.061,370.533,119.061z M374.501,65.554c-9.191,0-19.013,6.676-19.013,25.413
19
+ c0,13.96,6.559,22.98,16.708,22.98c7.18,0,13.308-3.736,19.286-11.758l0.495-0.665V69.983l-1.358-0.697
20
+ C385.253,66.53,381.035,65.554,374.501,65.554z"/>
21
+ </g>
22
+ <g>
23
+ <path fill="#2E3338" d="M419.624,117.78V61.721h6.393v56.059H419.624z M422.884,44.433c-2.645,0-4.796-2.094-4.796-4.668
24
+ c0-2.6,2.196-4.796,4.796-4.796c2.574,0,4.668,2.152,4.668,4.796C427.552,42.338,425.458,44.433,422.884,44.433z"/>
25
+ </g>
26
+ <g>
27
+ <path fill="#2E3338" d="M463.332,119.061c-7.015,0-14.662-2.282-19.529-4.647l0.809-5.23c4.905,2.794,11.627,5.405,19.616,5.405
28
+ c9.34,0,14.917-3.949,14.917-10.564c0-8.187-6.482-10.382-16.372-12.797c-13.937-3.485-18.19-7.314-18.19-16.388
29
+ c0-8.611,7.638-14.397,19.005-14.397c6.173,0,11.985,1.055,17.305,3.139l-0.902,5.412c-5.417-2.532-11.33-3.95-16.659-3.95
30
+ c-12.06,0-12.997,7.302-12.997,9.54c0,6.302,5.57,8.979,14.559,11.256c15.329,3.897,20.003,7.967,20.003,17.418
31
+ C484.897,113.3,477.037,119.061,463.332,119.061z"/>
32
+ </g>
33
+ <g>
34
+ <path fill="#2E3338" d="M523.746,119.061c-15.986,0-25.917-11.206-25.917-29.246c0-17.843,10.273-29.373,26.173-29.373
35
+ c6.897,0,12.696,1.453,17.263,4.322l-0.821,5.493c-5.086-3.282-10.441-4.83-16.57-4.83c-12.043,0-19.525,9.296-19.525,24.262
36
+ c0,15.271,7.777,24.389,20.805,24.389c6.137,0,11.114-1.451,15.996-4.757l0.746,4.59
37
+ C536.669,117.509,531.15,119.061,523.746,119.061z"/>
38
+ </g>
39
+ <g>
40
+ <path fill="#2E3338" d="M580.834,119.061c-15.511,0-25.533-11.479-25.533-29.246c0-17.843,10.022-29.373,25.533-29.373
41
+ c15.744,0,25.917,11.53,25.917,29.373C606.751,107.581,596.578,119.061,580.834,119.061z M580.834,65.042
42
+ c-11.729,0-19.014,9.492-19.014,24.772c0,15.049,7.463,24.773,19.014,24.773c11.964,0,19.396-9.492,19.396-24.773
43
+ C600.23,74.766,592.617,65.042,580.834,65.042z"/>
44
+ </g>
45
+ <g>
46
+ <path d="M623.652,117.78V61.721h4.444l2.615,16.91l3.563-5.661c3.16-5.019,8.634-11.016,17.176-12.309l0.981,5.953
47
+ c-9.186,1.447-17.664,7.67-22.117,16.437l-0.271,0.533v34.196H623.652z"/>
48
+ </g>
49
+ <g>
50
+ <path d="M688.224,118.549c-8.27,0-14.267-1.167-21.31-3.208V31.79l6.393-1.006V72.56l4.295-4.43
51
+ c5.017-5.173,10.417-7.688,16.51-7.688c13.302,0,21.565,10.569,21.565,27.582C715.677,107.423,705.671,118.549,688.224,118.549z
52
+ M692.447,65.554c-6.539,0-12.794,3.675-18.593,10.923l-0.548,0.685v33.856l1.64,0.601c3.981,1.461,7.108,2.202,13.148,2.202
53
+ c9.608,0,21.062-4.387,21.062-25.285C709.156,74.575,702.598,65.554,692.447,65.554z"/>
54
+ </g>
55
+ </g>
56
+ </g>
57
+ </g>
58
+ <g>
59
+ <defs>
60
+ <rect id="SVGID_3_" x="610.334" y="8" width="268" height="246"/>
61
+ </defs>
62
+ <clipPath id="SVGID_4_">
63
+ <use xlink:href="#SVGID_3_" overflow="visible"/>
64
+ </clipPath>
65
+ <g clip-path="url(#SVGID_4_)">
66
+ <g>
67
+ <path fill="#2E3338" d="M391.782,120.28l-1.408-8.833c-4.608,5.505-10.88,10.113-19.841,10.113
68
+ c-13.185,0-24.065-9.601-24.065-30.082c0-22.272,12.8-33.025,27.649-33.025c6.017,0,11.521,1.152,15.361,2.688v-31.49
69
+ l11.393-1.792v92.42H391.782z M389.478,71.51c-4.736-2.432-8.448-3.456-14.977-3.456c-9.601,0-16.513,7.809-16.513,22.913
70
+ c0,13.441,6.016,20.48,14.208,20.48c7.041,0,12.417-4.224,17.281-10.752V71.51z"/>
71
+ <path fill="#2E3338" d="M422.884,46.933c-3.968,0-7.296-3.2-7.296-7.168s3.328-7.296,7.296-7.296s7.168,3.328,7.168,7.296
72
+ S426.852,46.933,422.884,46.933z M417.124,120.28V59.221h11.393v61.059H417.124z"/>
73
+ <path fill="#2E3338" d="M463.332,121.561c-8.064,0-17.025-2.816-22.273-5.76l1.664-10.754c5.76,3.969,13.185,7.041,21.505,7.041
74
+ c7.808,0,12.417-2.944,12.417-8.064c0-5.633-3.456-7.68-14.465-10.368c-14.336-3.585-20.097-7.937-20.097-18.817
75
+ c0-9.729,8.192-16.897,21.505-16.897c7.552,0,14.336,1.536,20.097,4.096l-1.792,10.752c-5.376-3.072-12.161-5.248-18.561-5.248
76
+ c-6.913,0-10.497,2.688-10.497,7.04c0,4.096,3.072,6.4,12.672,8.832c15.105,3.841,21.889,8.193,21.889,19.842
77
+ C487.397,114.393,479.077,121.561,463.332,121.561z"/>
78
+ <path fill="#2E3338" d="M523.746,121.561c-16.385,0-28.417-11.393-28.417-31.746c0-20.865,12.8-31.873,28.673-31.873
79
+ c8.96,0,15.36,2.304,19.968,5.632l-1.664,11.136c-5.632-4.608-11.392-6.784-18.432-6.784c-9.985,0-17.025,7.552-17.025,21.762
80
+ c0,14.848,7.552,21.889,18.305,21.889c6.145,0,11.521-1.408,17.793-6.785l1.664,10.241
81
+ C538.339,119.768,531.938,121.561,523.746,121.561z"/>
82
+ <path fill="#2E3338" d="M580.834,121.561c-16.258,0-28.033-11.648-28.033-31.746c0-20.097,11.775-31.873,28.033-31.873
83
+ c16.385,0,28.417,11.776,28.417,31.873C609.251,109.912,597.219,121.561,580.834,121.561z M580.834,67.542
84
+ c-11.009,0-16.514,9.472-16.514,22.272c0,12.545,5.761,22.273,16.514,22.273c11.264,0,16.896-9.473,16.896-22.273
85
+ C597.73,77.271,591.842,67.542,580.834,67.542z"/>
86
+ <path fill="#CC342D" d="M632.545,84.183v36.098h-11.393V59.221h9.088l1.92,12.417c4.353-6.913,11.393-13.185,21.377-13.697
87
+ l1.793,10.88C645.217,69.334,636.641,76.118,632.545,84.183z"/>
88
+ <path fill="#CC342D" d="M688.224,121.049c-9.217,0-15.745-1.408-23.81-3.841V29.652l11.393-1.792v38.53
89
+ c4.096-4.224,9.984-8.448,18.305-8.448c13.185,0,24.065,9.729,24.065,30.082C718.177,110.296,705.888,121.049,688.224,121.049z
90
+ M692.447,68.054c-6.4,0-12.032,4.224-16.641,9.984v31.233c3.84,1.408,6.656,2.049,12.288,2.049
91
+ c11.905,0,18.562-7.041,18.562-22.785C706.656,75.222,700.64,68.054,692.447,68.054z"/>
92
+ </g>
93
+ </g>
94
+ </g>
95
+ <g>
96
+ </g>
97
+ <g>
98
+ </g>
99
+ <g>
100
+ </g>
101
+ <g>
102
+ </g>
103
+ <g>
104
+ </g>
105
+ <g>
106
+ </g>
107
+ <g>
108
+ </g>
109
+ <g>
110
+ </g>
111
+ <g>
112
+ </g>
113
+ <g>
114
+ </g>
115
+ <g>
116
+ </g>
117
+ <g>
118
+ </g>
119
+ <g>
120
+ </g>
121
+ <g>
122
+ </g>
123
+ <g>
124
+ </g>
125
+ </svg>
@@ -11,9 +11,9 @@ From: [Discord API docs](https://discord.com/developers/docs/interactions/applic
11
11
  ## How do I register an application command?
12
12
 
13
13
  Write to a your script:
14
- - {Discorb::Command::Handler.slash}, {Discorb::Command::Handler.slash_group} for slash commands,
15
- - {Discorb::Command::Handler.user_command} for user menu commands,
16
- - {Discorb::Command::Handler.message_command} for message menu commands.
14
+ - {Discorb::ApplicationCommand::Handler.slash}, {Discorb::ApplicationCommand::Handler.slash_group} for slash commands,
15
+ - {Discorb::ApplicationCommand::Handler.user_command} for user menu commands,
16
+ - {Discorb::ApplicationCommand::Handler.message_command} for message menu commands.
17
17
 
18
18
  And then run `discorb setup` to register your application commands.
19
19
  {file:docs/cli/setup.md Learn more about `discorb setup`}.
@@ -39,7 +39,7 @@ end
39
39
  client.run(ENV["DISCORD_BOT_TOKEN"])
40
40
  ```
41
41
 
42
- {Discorb::Command::Handler#slash} takes 5 arguments:
42
+ {Discorb::ApplicationCommand::Handler#slash} takes 5 arguments:
43
43
 
44
44
  | Argument | Description |
45
45
  |---------|-------------|
@@ -107,7 +107,7 @@ In `type`, You must use one of the following:
107
107
 
108
108
  ### Group Slash Commands
109
109
 
110
- To register a group of slash commands, use {Discorb::Command::Handler#slash_group}.
110
+ To register a group of slash commands, use {Discorb::ApplicationCommand::Handler#slash_group}.
111
111
 
112
112
  ```ruby
113
113
  group = client.slash_group("settings", "Set settings of bot.")
@@ -136,8 +136,8 @@ Since v0.5.1, You can use block for register commands.
136
136
 
137
137
  ```ruby
138
138
 
139
- client.slash_group("settings", "Set settings of bot.") do
140
- slash("message_expand", "Whether bot should expand message.", {
139
+ client.slash_group("settings", "Set settings of bot.") do |group|
140
+ group.slash("message_expand", "Whether bot should expand message.", {
141
141
  "enabled" => {
142
142
  type: :boolean,
143
143
  description: "Whether bot should expand message."
@@ -145,7 +145,7 @@ client.slash_group("settings", "Set settings of bot.") do
145
145
  }) do |interaction|
146
146
  # ...
147
147
  end
148
- slash("bump_alert", "Whether bot should notify DISBOARD bump.", {
148
+ group.slash("bump_alert", "Whether bot should notify DISBOARD bump.", {
149
149
  "enabled" => {
150
150
  type: :boolean,
151
151
  description: "Whether bot should notify DISBOARD bump."
@@ -156,7 +156,7 @@ client.slash_group("settings", "Set settings of bot.") do
156
156
  end
157
157
  ```
158
158
 
159
- You can make subcommand group by using {Discorb::Command::Command::GroupCommand#group}.
159
+ You can make subcommand group by using {Discorb::ApplicationCommand::Command::GroupCommand#group}.
160
160
 
161
161
  ```ruby
162
162
  group = client.slash_group("permission", "Set/Get command permissions.")
@@ -164,14 +164,14 @@ group = client.slash_group("permission", "Set/Get command permissions.")
164
164
  group_user = group.group("user", "Set/Get user's command permissions.")
165
165
 
166
166
  group_user.slash("set", "Set user's command permissions.", {
167
- "user_id" => {
168
- type: :user,
169
- description: "The user."
170
- },
171
- "value" => {
172
- type: :boolean,
173
- description: "Whether the user can use the command."
174
- }
167
+ "user_id" => {
168
+ type: :user,
169
+ description: "The user."
170
+ },
171
+ "value" => {
172
+ type: :boolean,
173
+ description: "Whether the user can use the command."
174
+ }
175
175
  }) do |interaction, user|
176
176
  # ...
177
177
  end
@@ -244,7 +244,7 @@ client.user_command("hello") do |interaction, user|
244
244
  interaction.post("Hello, #{user.name}!")
245
245
  end
246
246
  ```
247
- {Discorb::Command::Handler.user_command} takes 3 arguments:
247
+ {Discorb::ApplicationCommand::Handler.user_command} takes 3 arguments:
248
248
 
249
249
  | Parameter | Description |
250
250
  | --- | --- |
@@ -268,7 +268,7 @@ client.message_command("Bookmark") do |interaction, message|
268
268
  end
269
269
  ```
270
270
 
271
- {Discorb::Command::Handler.message_command} takes 3 arguments:
271
+ {Discorb::ApplicationCommand::Handler.message_command} takes 3 arguments:
272
272
 
273
273
  | Parameter | Description |
274
274
  | --- | --- |
data/docs/cli/run.md CHANGED
@@ -17,6 +17,8 @@ discorb run [options] [script]
17
17
 
18
18
  The script to run. Defaults to `main.rb`.
19
19
 
20
+ ### Options
21
+
20
22
  #### `-d`, `--deamon`
21
23
 
22
24
  Run the client in deamon mode.
@@ -43,4 +45,12 @@ You can use `stdout` to write to the standard output, and `stderr` to write to t
43
45
  Whether to colorize the log output.
44
46
  If not specified, the default will be:
45
47
  - `true` if the file to write logs to is `stdout` or `stderr`.
46
- - `false` otherwise.
48
+ - `false` otherwise.
49
+
50
+ #### `-s`, `--setup`
51
+
52
+ Whether to setup application commands.
53
+
54
+ #### `-t`, `--token`
55
+
56
+ The name of the environment variable to use for token, or just `-t` or `--token` for intractive prompt.
data/docs/cli/setup.md CHANGED
@@ -7,7 +7,7 @@ This command will setup application commands.
7
7
  ## Usage
8
8
 
9
9
  ```
10
- discorb setup [script]
10
+ discorb setup [options] [script]
11
11
  ```
12
12
 
13
13
  ### Arguments
@@ -15,3 +15,9 @@ discorb setup [script]
15
15
  #### `script`
16
16
 
17
17
  The script to setup. Defaults to `main.rb`.
18
+
19
+ ### Options
20
+
21
+ #### `-g`, `--guild`
22
+
23
+ Guild IDs to use as default. Can be specified multiple IDs by using `,` as delimiter.
data/docs/events.md CHANGED
@@ -30,6 +30,35 @@ end
30
30
 
31
31
  If you want to seperate event handlers from the client, consider using {Discorb::Extension}. {file:docs/extension.md Learn more about extensions}.
32
32
 
33
+ Since v0.6.1, you can set `:override` to `true` to register overridable event handlers.
34
+
35
+ ```ruby
36
+ client.on :message, override: true do |event|
37
+ puts "This event handler is overrideable!"
38
+ end
39
+
40
+ client.on :message do |event|
41
+ puts "Override!"
42
+ end
43
+ ```
44
+
45
+ This example will print `Override!`, but not `This event handler is overrideable!`.
46
+ This is useful for registering event handlers for default behaviour on errors.
47
+
48
+ ```ruby
49
+ # In the library...
50
+
51
+ client.on :command_error, override: true do |event, error|
52
+ $stderr.puts "Command error:\n#{error.full_message}"
53
+ end
54
+
55
+ # In your code...
56
+
57
+ client.on :command_error do |event, error|
58
+ event.message.reply "An error occurred while executing that command!\n#{error.full_message}"
59
+ end
60
+ ```
61
+
33
62
  ## Event reference
34
63
 
35
64
  ### Client events
@@ -50,6 +79,11 @@ Fires when the client is ready.
50
79
 
51
80
  Fires when the client is resumed connection.
52
81
 
82
+ #### `error(event_name, args, error)`
83
+
84
+ Fires when an error occurs during an event.
85
+ Defaults to printing the error to stderr, override to handle it yourself.
86
+
53
87
  ### Guild events
54
88
 
55
89
  #### `guild_join(guild)`
data/docs/extension.md CHANGED
@@ -36,7 +36,7 @@ end
36
36
 
37
37
  ## Register Command
38
38
 
39
- Since v0.5.2, {Discorb::Extension} includes {Discorb::Command::Handler} module, so you can register command with {Discorb::Command::Handler#slash} and {Discorb::Command::Handler#slash_group}.
39
+ Since v0.5.2, {Discorb::Extension} includes {Discorb::ApplicationCommand::Handler} module, so you can register command with {Discorb::ApplicationCommand::Handler#slash} and {Discorb::ApplicationCommand::Handler#slash_group}.
40
40
 
41
41
  ```ruby
42
42
  module MyExtension
@@ -46,13 +46,13 @@ module MyExtension
46
46
  # ...
47
47
  end
48
48
 
49
- slash_group("group", "Group") do
50
- slash("subcommand", "Subcommand") do |interaction|
49
+ slash_group("group", "Group") do |group|
50
+ group.slash("subcommand", "Subcommand") do |interaction|
51
51
  # ...
52
52
  end
53
53
 
54
- group("subgroup", "Subcommand group") do
55
- slash("group_subcommand", "Command in Subcommand group") do |interaction|
54
+ group.group("subgroup", "Subcommand group") do |group|
55
+ group.slash("group_subcommand", "Command in Subcommand group") do |interaction|
56
56
  # ...
57
57
  end
58
58
  end
@@ -86,7 +86,7 @@ module MyExtension
86
86
  extend Discorb::Extension
87
87
 
88
88
  event :ready do |message|
89
- puts "Logged in as #{client.user}"
89
+ puts "Logged in as #{@client.user}"
90
90
  end
91
91
  end
92
92
  ```