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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f43c7785e34661458d9837fd1e75877b8d343f8c920021624d92d0fb87c5ee3
4
- data.tar.gz: f5b1ed37f600c0b2945d737a154c9d07155d38dad1b8c3da58fc209fa2db99a9
3
+ metadata.gz: 315ee0cc7e7f3415979c83b2520c55d28ce302e9df53b039841c04731ff4da0b
4
+ data.tar.gz: a77e159f9f41d03378424cc83cfa0908feb74edd6bbc0af9ee71edc68bd17da2
5
5
  SHA512:
6
- metadata.gz: 42f7ffe2b1a851123d883f98223b7c8a755d40faff16a29c1eeecc58e3e023817c5a865bd2aaab52001a8311458a656e034de1f3349ed7778b033afd49840634
7
- data.tar.gz: 3a6789362788a6c16e38ead2f6d463162f6e852da84df703ef90e32e27477fafb3ce611c931c9f1d9516275f21fb7229e4cec51b0110720b870a2d30f474120d
6
+ metadata.gz: 3a4d325d86c0b451a063712dade9f0facfe9db7f40f8629bb07ef3716483bfcd6357d1d392eb0367e5752befb3b09244bb78133d302ea8ed2d593d457a360727
7
+ data.tar.gz: 4b6f6ad5620f4602eddfc0f9d90fd85901311d26e28550d7c16d289885e4718f31d901651641ecabf117f0cb79a822b1ac0f990288774531afd3e24e620e86fe
data/Changelog.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## v0.12
6
6
 
7
+ ### v0.12.2
8
+
9
+ - Fix: Fix `Message#type`
10
+ - Change: `discorb run` will lookup for `main.rb` in parent directories
11
+
7
12
  ### v0.12.1
8
13
 
9
14
  - Fix: Fix some texts
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.
@@ -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.1"
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
 
@@ -42,7 +42,22 @@ opt.parse!(ARGV)
42
42
 
43
43
  script = ARGV[0]
44
44
 
45
- script ||= "main.rb"
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)
@@ -109,9 +109,10 @@ module Discorb
109
109
  # * `:guild_discovery_grace_period_final_warning`
110
110
  # * `:thread_created`
111
111
  # * `:reply`
112
- # * `:application_command`
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: 0,
147
- recipient_add: 1,
148
- recipient_remove: 2,
149
- call: 3,
150
- channel_name_change: 4,
151
- channel_icon_change: 5,
152
- channel_pinned_message: 6,
153
- guild_member_join: 7,
154
- user_premium_guild_subscription: 8,
155
- user_premium_guild_subscription_tier_1: 9,
156
- user_premium_guild_subscription_tier_2: 10,
157
- user_premium_guild_subscription_tier_3: 11,
158
- channel_follow_add: 12,
159
- guild_discovery_disqualified: 14,
160
- guild_discovery_requalified: 15,
161
- guild_discovery_grace_period_initial_warning: 16,
162
- guild_discovery_grace_period_final_warning: 17,
163
- thread_created: 18,
164
- reply: 19,
165
- application_command: 20,
166
- thread_starter_message: 21,
167
- guild_invite_reminder: 22,
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sevenc-nanashi