discorb 0.8.2 → 0.9.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: c3274a015f4e303bb978379e4eb01a039088ce3139507bccf6e32dbcf19dfe29
4
- data.tar.gz: 4f8b8ca01fcbd9e362ff90bdee7880d11769e0c984687be1e7d5774a9da6a8b5
3
+ metadata.gz: e36750d1d9ddfedd7263fe6fedd28f38f4e0f4b16adad906be8e4a1976cb5917
4
+ data.tar.gz: 92b0b7fc3b1f3409525aff7257054bddccee649112510f5eb6440a4fa1d3f997
5
5
  SHA512:
6
- metadata.gz: 7eb065d83e4fa92ac82bfd70426e48e04aaca4832dcea9890603e04a349998b48f0d39aac1169a047b73014b88517eae05ab9679c1e55e27286e7b411f6454b2
7
- data.tar.gz: 77bb4471337fbf056af8a3d3493b84218cb6811745ce28e3a33e4684e72f6806c74045af1a58bf8d7e80532d46cf9fb8caa51587e94c8f96660e5ad9ce10bd6b
6
+ metadata.gz: c4298d074c03df93c3c09cb8d0a4d77498b3bacbc2427358241f10e3cf2dfb810b865365ffe0e03ae301c65417f0b6d72a6e4cb79feb291adb340bc5f2b2bddb
7
+ data.tar.gz: 823d463b905fc65e420745ca412187303dfc5896b65be08e7fdae8208e5d9d7a7c2fc40bc6d67f56b9a670609e1d16d818e51a83b3747d140cad2a0e8dddf042
data/Changelog.md CHANGED
@@ -223,4 +223,11 @@ end
223
223
 
224
224
  ## 0.8.2
225
225
 
226
- Fix: Fix `Client#initialize`
226
+ - Fix: Fix `Client#initialize`
227
+
228
+ ## 0.9.0
229
+
230
+ - Delete: Delete `-d` parameter from `discorb run`; This is caused by segement fault error.
231
+ - Change: Rename `-t`, `--token` to `-e`, `--env` parameter
232
+ - Add: Add `-t`, `--title` parameter to `discorb run`
233
+ - Add: Add `title` parameter to `Client#initialize`
@@ -66,11 +66,13 @@ module Discorb
66
66
  # @param [:debug, :info, :warn, :error, :critical] log_level The log level.
67
67
  # @param [Boolean] wait_until_ready Whether to delay event dispatch until ready.
68
68
  # @param [Boolean] fetch_member Whether to fetch member on ready. This may slow down the client. Default to `false`.
69
+ # @param [String] title The title of the process. `false` to default, `nil` to `discorb: User#0000`. Default to `nil`.
69
70
  #
70
71
  def initialize(
71
72
  allowed_mentions: nil, intents: nil, message_caches: 1000,
72
73
  log: nil, colorize_log: false, log_level: :info,
73
- wait_until_ready: true, fetch_member: false
74
+ wait_until_ready: true, fetch_member: false,
75
+ title: nil
74
76
  )
75
77
  @allowed_mentions = allowed_mentions || AllowedMentions.new(everyone: true, roles: true, users: true)
76
78
  @intents = (intents or Intents.default)
@@ -94,6 +96,7 @@ module Discorb
94
96
  @bottom_commands = []
95
97
  @status = :initialized
96
98
  @fetch_member = fetch_member
99
+ @title = title
97
100
  set_default_events
98
101
  end
99
102
 
@@ -495,15 +498,10 @@ module Discorb
495
498
  end
496
499
 
497
500
  once :standby do
498
- if @daemon
499
- title = "discorb: #{@user}"
500
- Process.setproctitle title
501
- sputs "Your discorb client is now in standby mode."
502
- iputs "Process ID: #{Process.pid}"
503
- iputs "Title: #{title}"
501
+ next if @title == false
504
502
 
505
- Process.daemon
506
- end
503
+ title = @title || ENV["DISCORB_CLI_TITLE"] || "discorb: #{@user}"
504
+ Process.setproctitle title
507
505
  end
508
506
  end
509
507
  end
@@ -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.8.2"
7
+ VERSION = "0.9.0"
8
8
  # @return [String] The user agent for the bot.
9
9
  USER_AGENT = "DiscordBot (https://github.com/discorb-lib/discorb #{VERSION}) Ruby/#{RUBY_VERSION}"
10
10
 
@@ -16,14 +16,13 @@ opt = OptionParser.new <<~BANNER
16
16
  script The script to run. Defaults to 'main.rb'.
17
17
  BANNER
18
18
  options = {
19
- deamon: false,
19
+ title: nil,
20
20
  log_level: nil,
21
21
  log_file: nil,
22
22
  log_color: nil,
23
23
  setup: nil,
24
24
  token: false,
25
25
  }
26
- opt.on("-d", "--deamon", "Run as a daemon.") { |v| options[:daemon] = v }
27
26
  opt.on("-l", "--log-level LEVEL", "Log level.") do |v|
28
27
  unless LOG_LEVELS.include? v.downcase
29
28
  eputs "Invalid log level: \e[31m#{v}\e[91m"
@@ -35,7 +34,8 @@ end
35
34
  opt.on("-f", "--log-file FILE", "File to write log to.") { |v| options[:log_file] = v }
36
35
  opt.on("-c", "--[no-]log-color", "Whether to colorize log output.") { |v| options[:log_color] = v }
37
36
  opt.on("-s", "--setup", "Whether to setup application commands.") { |v| options[:setup] = v }
38
- opt.on("-t", "--token [ENV]", "The name of the environment variable to use for token, or just `-t` or `--token` for intractive prompt.") { |v| options[:token] = v }
37
+ opt.on("-e", "--env [ENV]", "The name of the environment variable to use for token, or just `-e` or `--env` for intractive prompt.") { |v| options[:token] = v }
38
+ opt.on("-t", "--title TITLE", "The title of process.") { |v| options[:title] = v }
39
39
  opt.parse!(ARGV)
40
40
 
41
41
  script = ARGV[0]
@@ -54,6 +54,8 @@ elsif options[:token].nil? || options[:token] == "-"
54
54
  puts ""
55
55
  end
56
56
 
57
+ ENV["DISCORB_CLI_TITLE"] = options[:title]
58
+
57
59
  begin
58
60
  load script
59
61
  rescue LoadError
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sevenc-nanashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-23 00:00:00.000000000 Z
11
+ date: 2021-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async