discorb 0.3.1 → 0.5.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/.github/workflows/build_main.yml +51 -0
- data/.gitignore +5 -1
- data/.yardopts +1 -0
- data/Changelog.md +33 -1
- data/Gemfile.lock +5 -4
- data/Rakefile +41 -19
- data/discorb.gemspec +4 -4
- data/docs/application_command.md +7 -1
- data/docs/assets/01_new_app.png +0 -0
- data/docs/assets/02_bot_name.png +0 -0
- data/docs/assets/03_add_bot.png +0 -0
- data/docs/assets/04_token_copy.png +0 -0
- data/docs/assets/05_oauth.png +0 -0
- data/docs/assets/06_online.png +0 -0
- data/docs/assets/07_hello_infinite.png +0 -0
- data/docs/assets/08_hello_once.png +0 -0
- data/docs/assets/unused_ping_pong.png +0 -0
- data/docs/cli/init.md +1 -1
- data/docs/cli/irb.md +1 -1
- data/docs/cli/run.md +46 -0
- data/docs/cli/setup.md +17 -0
- data/docs/cli.md +6 -1
- data/docs/tutorial.md +194 -0
- data/exe/discorb +3 -0
- data/lib/discorb/client.rb +59 -13
- data/lib/discorb/command.rb +0 -1
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/error.rb +15 -0
- data/lib/discorb/exe/about.rb +15 -0
- data/lib/discorb/exe/init.rb +9 -8
- data/lib/discorb/exe/irb.rb +9 -3
- data/lib/discorb/exe/run.rb +49 -0
- data/lib/discorb/exe/setup.rb +26 -0
- data/lib/discorb/gateway.rb +35 -6
- data/lib/discorb/http.rb +28 -30
- data/lib/discorb/log.rb +4 -3
- data/lib/discorb/rate_limit.rb +41 -0
- data/lib/discorb.rb +1 -1
- data/template-replace/files/css/common.css +13 -2
- data/template-replace/resources/version_list.html +2 -2
- data/template-replace/scripts/version.rb +15 -3
- metadata +32 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26ef2cd9945ad11a9816b4ece328391c265b8f59f8b9a67e66326e21414f083c
|
4
|
+
data.tar.gz: 06662ff1518386e95e615afffc6b8338cb9e337bb0dc36c66f6d1d79fd7a01e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ddc5818285d4ed50e08998446a5fa9763cffe9c0a1992a70085af38a323e304851ca4dd77f43a8108e4ece850f097eaca9dc119b83c9bdb9a66e5c32b40f5a
|
7
|
+
data.tar.gz: 8a409f031d896344586bb2001019b9431299683a99df36f090f3a0da748d08bd6b4f2191c0a32823106d5b3b0cd6d22624106367d8e4adc400acf430ddb60370
|
@@ -0,0 +1,51 @@
|
|
1
|
+
name: Build YARD with main
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
schedule:
|
6
|
+
- cron: "*/8 * * * *"
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
main:
|
10
|
+
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: 3.0.2
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Set up git settings
|
21
|
+
run: |
|
22
|
+
git config --global user.email "action@github.com"
|
23
|
+
git config --global user.name "GitHub Action"
|
24
|
+
- name: Clone pages
|
25
|
+
env:
|
26
|
+
SSH_SECRET: ${{ secrets.SSH }}
|
27
|
+
GIT_SSH_COMMAND: ssh -i ~/ssh_secret
|
28
|
+
run: |
|
29
|
+
echo "$SSH_SECRET" > ~/ssh_secret
|
30
|
+
chmod 600 ~/ssh_secret
|
31
|
+
git clone git@github.com:discorb-lib/discorb-lib.github.io /tmp/pages
|
32
|
+
- name: Install dependencies
|
33
|
+
run: |
|
34
|
+
bundle config --local with 'docs'
|
35
|
+
bundle install
|
36
|
+
- name: Generate document
|
37
|
+
run: bundle exec rake document
|
38
|
+
- name: Push document
|
39
|
+
env:
|
40
|
+
SSH_SECRET: ${{ secrets.SSH }}
|
41
|
+
GIT_SSH_COMMAND: ssh -i ~/ssh_secret
|
42
|
+
run: |
|
43
|
+
echo "$SSH_SECRET" > ~/ssh_secret
|
44
|
+
chmod 600 ~/ssh_secret
|
45
|
+
cp -r ./doc/. /tmp/pages
|
46
|
+
cd /tmp/pages
|
47
|
+
git add -A
|
48
|
+
git commit -m "Update: Update document for ${{ github.sha }} by cron"
|
49
|
+
git update-ref -d refs/remotes/origin/user
|
50
|
+
git push origin main -f
|
51
|
+
continue-on-error: true
|
data/.gitignore
CHANGED
@@ -35,7 +35,7 @@ build-iPhoneSimulator/
|
|
35
35
|
## Documentation cache and generated files:
|
36
36
|
/.yardoc/
|
37
37
|
/_yardoc/
|
38
|
-
/doc/
|
38
|
+
# /doc/
|
39
39
|
/rdoc/
|
40
40
|
|
41
41
|
## Environment normalization:
|
@@ -54,4 +54,8 @@ build-iPhoneSimulator/
|
|
54
54
|
|
55
55
|
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
56
|
# .rubocop-https?--*
|
57
|
+
|
58
|
+
# For documentation generation.
|
57
59
|
tmp-template-replace
|
60
|
+
tmp-doc
|
61
|
+
doc
|
data/.yardopts
CHANGED
data/Changelog.md
CHANGED
@@ -73,4 +73,36 @@
|
|
73
73
|
## 0.2.5
|
74
74
|
|
75
75
|
- Add: Add way to add event listener
|
76
|
-
- Change: Move document to https://discorb-lib.github.io/
|
76
|
+
- Change: Move document to https://discorb-lib.github.io/
|
77
|
+
|
78
|
+
## 0.3.0
|
79
|
+
|
80
|
+
- Add: Improve CLI tools
|
81
|
+
- Add: Add `discorb init`
|
82
|
+
- Change: Change `discord-irb` to `discorb irb`
|
83
|
+
|
84
|
+
## 0.3.1
|
85
|
+
|
86
|
+
- Add: Add `discorb show`
|
87
|
+
- Fix: Fix documenting
|
88
|
+
|
89
|
+
## 0.4.0
|
90
|
+
|
91
|
+
- Add: Add `discorb setup`
|
92
|
+
- Add: Add `discorb run`
|
93
|
+
- Add: Add realtime documentation
|
94
|
+
|
95
|
+
## 0.4.1
|
96
|
+
|
97
|
+
- Add: Add `-s` option to `discorb run`
|
98
|
+
|
99
|
+
## 0.4.2
|
100
|
+
|
101
|
+
- Fix: Fix error in `discorb run`
|
102
|
+
|
103
|
+
## 0.5.0
|
104
|
+
|
105
|
+
- Change: Use zlib stream instead
|
106
|
+
- Add: Add tutorials
|
107
|
+
- Add: Add ratelimit handler
|
108
|
+
- Change: Make `--git` option in `discorb init` false
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
discorb (0.
|
5
|
-
async
|
6
|
-
async-http
|
7
|
-
async-websocket
|
4
|
+
discorb (0.5.0)
|
5
|
+
async (~> 1.30.1)
|
6
|
+
async-http (~> 0.56.5)
|
7
|
+
async-websocket (~> 0.19.0)
|
8
8
|
mime-types (~> 3.3)
|
9
9
|
|
10
10
|
GEM
|
@@ -54,6 +54,7 @@ GEM
|
|
54
54
|
|
55
55
|
PLATFORMS
|
56
56
|
x86-mingw32
|
57
|
+
x86_64-linux
|
57
58
|
|
58
59
|
DEPENDENCIES
|
59
60
|
discorb!
|
data/Rakefile
CHANGED
@@ -7,10 +7,11 @@ task default: %i[]
|
|
7
7
|
# @!visibility private
|
8
8
|
def get_version
|
9
9
|
require_relative "lib/discorb/common"
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
tag = `git tag --points-at HEAD`.force_encoding("utf-8").strip
|
11
|
+
if tag.empty?
|
12
|
+
version = "main"
|
13
|
+
else
|
14
|
+
version = Discorb::VERSION
|
14
15
|
end
|
15
16
|
version
|
16
17
|
end
|
@@ -19,7 +20,7 @@ desc "Build emoji_table.rb"
|
|
19
20
|
task :emoji_table do
|
20
21
|
require_relative "lib/discorb"
|
21
22
|
|
22
|
-
|
23
|
+
iputs "Building emoji_table.rb"
|
23
24
|
res = {}
|
24
25
|
Discorb::EmojiTable::DISCORD_TO_UNICODE.each do |discord, unicode|
|
25
26
|
res[unicode] ||= []
|
@@ -47,7 +48,7 @@ task :format do
|
|
47
48
|
Dir.glob("**/*.rb").each do |file|
|
48
49
|
next if file.start_with?("vendor")
|
49
50
|
|
50
|
-
|
51
|
+
iputs "Formatting #{file}"
|
51
52
|
`rufo ./#{file}`
|
52
53
|
content = ""
|
53
54
|
File.open(file, "rb") do |f|
|
@@ -66,7 +67,7 @@ namespace :document do
|
|
66
67
|
|
67
68
|
desc "Just generate document"
|
68
69
|
task :yard do
|
69
|
-
sh "yardoc -o doc/#{version}"
|
70
|
+
sh "bundle exec yardoc -o doc/#{version}"
|
70
71
|
end
|
71
72
|
|
72
73
|
desc "Replace files"
|
@@ -75,7 +76,7 @@ namespace :document do
|
|
75
76
|
|
76
77
|
desc "Replace CSS"
|
77
78
|
task :css do
|
78
|
-
|
79
|
+
iputs "Replacing css"
|
79
80
|
Dir.glob("template-replace/files/**/*.*")
|
80
81
|
.map { |f| f.delete_prefix("template-replace/files") }.each do |file|
|
81
82
|
FileUtils.cp("template-replace/files" + file, "doc/#{version}/#{file}")
|
@@ -89,7 +90,7 @@ namespace :document do
|
|
89
90
|
require_relative "template-replace/scripts/version.rb"
|
90
91
|
require_relative "template-replace/scripts/index.rb"
|
91
92
|
require_relative "template-replace/scripts/yard_replace.rb"
|
92
|
-
|
93
|
+
iputs "Resetting changes"
|
93
94
|
Dir.glob("doc/#{version}/**/*.html") do |f|
|
94
95
|
next if (m = f.match(/[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+)?/)) && m[0] != version
|
95
96
|
|
@@ -97,25 +98,26 @@ namespace :document do
|
|
97
98
|
content.gsub!(/<!--od-->[\s\S]*<!--eod-->/, "")
|
98
99
|
File.write(f, content)
|
99
100
|
end
|
100
|
-
|
101
|
+
iputs "Adding version tab"
|
101
102
|
%w[file_list class_list method_list].each do |f|
|
102
103
|
replace_sidebar("doc/#{version}/#{f}.html")
|
103
104
|
end
|
104
105
|
|
105
|
-
|
106
|
-
build_version_sidebar("doc/#{version}")
|
107
|
-
|
106
|
+
iputs "Building version tab"
|
107
|
+
build_version_sidebar("doc/#{version}", version)
|
108
|
+
iputs "Replacing _index.html"
|
108
109
|
replace_index("doc/#{version}", version)
|
109
|
-
|
110
|
+
iputs "Replacing YARD credits"
|
110
111
|
yard_replace("doc/#{version}", version)
|
111
|
-
|
112
|
+
iputs "Successfully replaced htmls"
|
112
113
|
end
|
113
114
|
|
114
115
|
desc "Replace EOL"
|
115
116
|
task :eol do
|
116
|
-
|
117
|
+
iputs "Replacing CRLF with LF"
|
117
118
|
Dir.glob("doc/**/*.*") do |file|
|
118
119
|
next unless File.file?(file)
|
120
|
+
next unless %w[html css js].include? file.split(".").last
|
119
121
|
|
120
122
|
content = ""
|
121
123
|
File.open(file, "rb") do |f|
|
@@ -134,18 +136,32 @@ namespace :document do
|
|
134
136
|
desc "Build all versions"
|
135
137
|
task :build_all do
|
136
138
|
require "fileutils"
|
137
|
-
|
139
|
+
|
140
|
+
class Bundler::Definition
|
141
|
+
def validate_platforms!
|
142
|
+
# noop
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
iputs "Building all versions"
|
147
|
+
FileUtils.rm_rf("doc") rescue nil
|
138
148
|
FileUtils.cp_r("./template-replace/.", "./tmp-template-replace")
|
149
|
+
Rake::Task["document:yard"].execute
|
150
|
+
Rake::Task["document:replace:html"].execute
|
151
|
+
Rake::Task["document:replace:css"].execute
|
152
|
+
Rake::Task["document:replace:eol"].execute
|
139
153
|
tags = `git tag`.force_encoding("utf-8").split("\n")
|
140
154
|
tags.each do |tag|
|
141
155
|
sh "git checkout #{tag} -f"
|
142
|
-
|
156
|
+
iputs "Building #{tag}"
|
143
157
|
FileUtils.cp_r("./tmp-template-replace/.", "./template-replace")
|
144
158
|
version = tag.delete_prefix("v")
|
145
159
|
Rake::Task["document:yard"].execute
|
146
160
|
Rake::Task["document:replace:html"].execute
|
147
161
|
Rake::Task["document:replace:css"].execute
|
148
162
|
Rake::Task["document:replace:eol"].execute
|
163
|
+
FileUtils.cp_r("./doc/.", "./tmp-doc")
|
164
|
+
FileUtils.rm_rf("doc")
|
149
165
|
end
|
150
166
|
version = "."
|
151
167
|
Rake::Task["document:yard"].execute
|
@@ -153,13 +169,19 @@ namespace :document do
|
|
153
169
|
Rake::Task["document:replace:css"].execute
|
154
170
|
Rake::Task["document:replace:eol"].execute
|
155
171
|
sh "git switch main -f"
|
172
|
+
FileUtils.cp_r("./tmp-doc/.", "./doc")
|
156
173
|
sputs "Successfully built all versions"
|
174
|
+
rescue => e
|
175
|
+
sh "git switch main -f"
|
176
|
+
raise e
|
157
177
|
end
|
158
178
|
|
159
179
|
desc "Push to discorb-lib/discorb-lib.github.io"
|
160
180
|
task :push do
|
161
|
-
|
181
|
+
iputs "Pushing documents"
|
162
182
|
Dir.chdir("doc") do
|
183
|
+
sh "git init"
|
184
|
+
sh "git remote add origin git@github.com:discorb-lib/discorb-lib.github.io"
|
163
185
|
sh "git add ."
|
164
186
|
sh "git commit -m \"Update: Update document\""
|
165
187
|
sh "git push -f"
|
data/discorb.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.metadata["homepage_uri"] = spec.homepage
|
19
19
|
spec.metadata["source_code_uri"] = "https://github.com/discorb-lib/discorb"
|
20
|
-
spec.metadata["changelog_uri"] = "https://
|
20
|
+
spec.metadata["changelog_uri"] = "https://discorb-lib.github.io/file.Changelog.html"
|
21
21
|
spec.metadata["documentation_uri"] = "https://discorb-lib.github.io"
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
|
-
spec.add_dependency "async"
|
34
|
-
spec.add_dependency "async-http"
|
35
|
-
spec.add_dependency "async-websocket"
|
33
|
+
spec.add_dependency "async", "~> 1.30.1"
|
34
|
+
spec.add_dependency "async-http", "~> 0.56.5"
|
35
|
+
spec.add_dependency "async-websocket", "~> 0.19.0"
|
36
36
|
|
37
37
|
spec.add_dependency "mime-types", "~> 3.3"
|
38
38
|
# For more information and examples about making a new gem, checkout our
|
data/docs/application_command.md
CHANGED
@@ -10,7 +10,13 @@ From: [Discord API docs](https://discord.com/developers/docs/interactions/applic
|
|
10
10
|
|
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.
|
17
|
+
|
18
|
+
And then run `discorb setup` to register your application commands.
|
19
|
+
{file:docs/cli/setup.md Learn more about `discorb setup`}.
|
14
20
|
|
15
21
|
### Note
|
16
22
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/docs/cli/init.md
CHANGED
@@ -30,7 +30,7 @@ Default to true.
|
|
30
30
|
Whether to initialize git.
|
31
31
|
If true, the command will initialize git and commit the initial files with commit message `Initial commit`.
|
32
32
|
Use `git commit --amend -m "..."` to change the commit message.
|
33
|
-
Default to
|
33
|
+
Default to false.
|
34
34
|
|
35
35
|
### `-t`, `--token`
|
36
36
|
|
data/docs/cli/irb.md
CHANGED
data/docs/cli/run.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# @title CLI: discorb run
|
2
|
+
|
3
|
+
# discorb run
|
4
|
+
|
5
|
+
This command will run a client.
|
6
|
+
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
```
|
11
|
+
discorb run [options] [script]
|
12
|
+
```
|
13
|
+
|
14
|
+
### Arguments
|
15
|
+
|
16
|
+
#### `script`
|
17
|
+
|
18
|
+
The script to run. Defaults to `main.rb`.
|
19
|
+
|
20
|
+
#### `-d`, `--deamon`
|
21
|
+
|
22
|
+
Run the client in deamon mode.
|
23
|
+
|
24
|
+
#### `-l`, `--log-level`
|
25
|
+
|
26
|
+
Specify the log level.
|
27
|
+
Should be one of the following:
|
28
|
+
|
29
|
+
* `none`
|
30
|
+
* `debug`
|
31
|
+
* `info`
|
32
|
+
* `warn`
|
33
|
+
* `error`
|
34
|
+
* `fatal`
|
35
|
+
|
36
|
+
#### `-f`, `--log-file`
|
37
|
+
|
38
|
+
Specify the file to write logs to.
|
39
|
+
You can use `stdout` to write to the standard output, and `stderr` to write to the standard error.
|
40
|
+
|
41
|
+
#### `-c`, `--[no-]log-color`
|
42
|
+
|
43
|
+
Whether to colorize the log output.
|
44
|
+
If not specified, the default will be:
|
45
|
+
- `true` if the file to write logs to is `stdout` or `stderr`.
|
46
|
+
- `false` otherwise.
|
data/docs/cli/setup.md
ADDED