discorb 0.12.1 → 0.12.2
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 +5 -0
- data/docs/cli/run.md +2 -1
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/exe/run.rb +16 -1
- data/lib/discorb/message.rb +25 -23
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 315ee0cc7e7f3415979c83b2520c55d28ce302e9df53b039841c04731ff4da0b
|
4
|
+
data.tar.gz: a77e159f9f41d03378424cc83cfa0908feb74edd6bbc0af9ee71edc68bd17da2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a4d325d86c0b451a063712dade9f0facfe9db7f40f8629bb07ef3716483bfcd6357d1d392eb0367e5752befb3b09244bb78133d302ea8ed2d593d457a360727
|
7
|
+
data.tar.gz: 4b6f6ad5620f4602eddfc0f9d90fd85901311d26e28550d7c16d289885e4718f31d901651641ecabf117f0cb79a822b1ac0f990288774531afd3e24e620e86fe
|
data/Changelog.md
CHANGED
data/docs/cli/run.md
CHANGED
@@ -16,6 +16,7 @@ discorb run [options] [script]
|
|
16
16
|
#### `script`
|
17
17
|
|
18
18
|
The script to run. Defaults to `main.rb`.
|
19
|
+
If the script wasn't specified, it will also look for a file named `main.rb` in the parent directories, like rake.
|
19
20
|
|
20
21
|
### Options
|
21
22
|
|
@@ -57,4 +58,4 @@ The name of the environment variable to use for token, or just `-t` or `--token`
|
|
57
58
|
|
58
59
|
#### `-b`, `--bundler`
|
59
60
|
|
60
|
-
Whether to use bundler to load the script.
|
61
|
+
Whether to use bundler to load the script.
|
data/lib/discorb/common.rb
CHANGED
@@ -4,7 +4,7 @@ module Discorb
|
|
4
4
|
# @return [String] The API base URL.
|
5
5
|
API_BASE_URL = "https://discord.com/api/v9"
|
6
6
|
# @return [String] The version of discorb.
|
7
|
-
VERSION = "0.12.
|
7
|
+
VERSION = "0.12.2"
|
8
8
|
# @return [String] The user agent for the bot.
|
9
9
|
USER_AGENT = "DiscordBot (https://discorb-lib.github.io #{VERSION}) Ruby/#{RUBY_VERSION}"
|
10
10
|
|
data/lib/discorb/exe/run.rb
CHANGED
@@ -42,7 +42,22 @@ opt.parse!(ARGV)
|
|
42
42
|
|
43
43
|
script = ARGV[0]
|
44
44
|
|
45
|
-
script
|
45
|
+
if script.nil?
|
46
|
+
script = "main.rb"
|
47
|
+
dir = Dir.pwd
|
48
|
+
loop do
|
49
|
+
if File.exist?(File.join(dir, "main.rb"))
|
50
|
+
script = File.join(dir, "main.rb")
|
51
|
+
break
|
52
|
+
end
|
53
|
+
break if dir == File.dirname(dir)
|
54
|
+
dir = File.dirname(dir)
|
55
|
+
end
|
56
|
+
if File.dirname(script) != Dir.pwd
|
57
|
+
Dir.chdir(File.dirname(script))
|
58
|
+
iputs "Changed directory to \e[m#{File.dirname(script)}"
|
59
|
+
end
|
60
|
+
end
|
46
61
|
|
47
62
|
ENV["DISCORB_CLI_FLAG"] = "run"
|
48
63
|
ENV["DISCORB_CLI_OPTIONS"] = JSON.generate(options)
|
data/lib/discorb/message.rb
CHANGED
@@ -109,9 +109,10 @@ module Discorb
|
|
109
109
|
# * `:guild_discovery_grace_period_final_warning`
|
110
110
|
# * `:thread_created`
|
111
111
|
# * `:reply`
|
112
|
-
# * `:
|
112
|
+
# * `:chat_input_command`
|
113
113
|
# * `:thread_starter_message`
|
114
114
|
# * `:guild_invite_reminder`
|
115
|
+
# * `:context_menu_command`
|
115
116
|
attr_reader :type
|
116
117
|
# @return [Discorb::Message::Activity] The activity of the message.
|
117
118
|
attr_reader :activity
|
@@ -143,28 +144,29 @@ module Discorb
|
|
143
144
|
attr_reader :pinned
|
144
145
|
alias pinned? pinned
|
145
146
|
@message_type = {
|
146
|
-
default
|
147
|
-
recipient_add
|
148
|
-
recipient_remove
|
149
|
-
call
|
150
|
-
channel_name_change
|
151
|
-
channel_icon_change
|
152
|
-
channel_pinned_message
|
153
|
-
guild_member_join
|
154
|
-
user_premium_guild_subscription
|
155
|
-
user_premium_guild_subscription_tier_1
|
156
|
-
user_premium_guild_subscription_tier_2
|
157
|
-
user_premium_guild_subscription_tier_3
|
158
|
-
channel_follow_add
|
159
|
-
guild_discovery_disqualified
|
160
|
-
guild_discovery_requalified
|
161
|
-
guild_discovery_grace_period_initial_warning
|
162
|
-
guild_discovery_grace_period_final_warning
|
163
|
-
thread_created
|
164
|
-
reply
|
165
|
-
|
166
|
-
thread_starter_message
|
167
|
-
guild_invite_reminder
|
147
|
+
0 => :default,
|
148
|
+
1 => :recipient_add,
|
149
|
+
2 => :recipient_remove,
|
150
|
+
3 => :call,
|
151
|
+
4 => :channel_name_change,
|
152
|
+
5 => :channel_icon_change,
|
153
|
+
6 => :channel_pinned_message,
|
154
|
+
7 => :guild_member_join,
|
155
|
+
8 => :user_premium_guild_subscription,
|
156
|
+
9 => :user_premium_guild_subscription_tier_1,
|
157
|
+
10 => :user_premium_guild_subscription_tier_2,
|
158
|
+
11 => :user_premium_guild_subscription_tier_3,
|
159
|
+
12 => :channel_follow_add,
|
160
|
+
14 => :guild_discovery_disqualified,
|
161
|
+
15 => :guild_discovery_requalified,
|
162
|
+
16 => :guild_discovery_grace_period_initial_warning,
|
163
|
+
17 => :guild_discovery_grace_period_final_warning,
|
164
|
+
18 => :thread_created,
|
165
|
+
19 => :reply,
|
166
|
+
20 => :chat_input_command,
|
167
|
+
21 => :thread_starter_message,
|
168
|
+
22 => :guild_invite_reminder,
|
169
|
+
23 => :context_menu_command,
|
168
170
|
}.freeze
|
169
171
|
|
170
172
|
# @!attribute [r] channel
|