discordrb 3.3.0 → 3.4.3
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/.circleci/config.yml +126 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
- data/.github/pull_request_template.md +37 -0
- data/.rubocop.yml +34 -37
- data/.travis.yml +5 -6
- data/CHANGELOG.md +504 -347
- data/Gemfile +2 -0
- data/LICENSE.txt +1 -1
- data/README.md +61 -79
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/discordrb-webhooks.gemspec +6 -6
- data/discordrb.gemspec +18 -18
- data/lib/discordrb/allowed_mentions.rb +36 -0
- data/lib/discordrb/api/channel.rb +62 -39
- data/lib/discordrb/api/invite.rb +3 -3
- data/lib/discordrb/api/server.rb +57 -50
- data/lib/discordrb/api/user.rb +9 -8
- data/lib/discordrb/api/webhook.rb +6 -6
- data/lib/discordrb/api.rb +40 -15
- data/lib/discordrb/await.rb +0 -1
- data/lib/discordrb/bot.rb +175 -73
- data/lib/discordrb/cache.rb +4 -2
- data/lib/discordrb/colour_rgb.rb +43 -0
- data/lib/discordrb/commands/command_bot.rb +30 -9
- data/lib/discordrb/commands/container.rb +20 -23
- data/lib/discordrb/commands/parser.rb +18 -18
- data/lib/discordrb/commands/rate_limiter.rb +3 -2
- data/lib/discordrb/container.rb +77 -17
- data/lib/discordrb/data/activity.rb +271 -0
- data/lib/discordrb/data/application.rb +50 -0
- data/lib/discordrb/data/attachment.rb +56 -0
- data/lib/discordrb/data/audit_logs.rb +345 -0
- data/lib/discordrb/data/channel.rb +849 -0
- data/lib/discordrb/data/embed.rb +251 -0
- data/lib/discordrb/data/emoji.rb +82 -0
- data/lib/discordrb/data/integration.rb +83 -0
- data/lib/discordrb/data/invite.rb +137 -0
- data/lib/discordrb/data/member.rb +297 -0
- data/lib/discordrb/data/message.rb +334 -0
- data/lib/discordrb/data/overwrite.rb +102 -0
- data/lib/discordrb/data/profile.rb +91 -0
- data/lib/discordrb/data/reaction.rb +33 -0
- data/lib/discordrb/data/recipient.rb +34 -0
- data/lib/discordrb/data/role.rb +191 -0
- data/lib/discordrb/data/server.rb +1002 -0
- data/lib/discordrb/data/user.rb +204 -0
- data/lib/discordrb/data/voice_region.rb +45 -0
- data/lib/discordrb/data/voice_state.rb +41 -0
- data/lib/discordrb/data/webhook.rb +145 -0
- data/lib/discordrb/data.rb +25 -4180
- data/lib/discordrb/errors.rb +2 -1
- data/lib/discordrb/events/bans.rb +7 -5
- data/lib/discordrb/events/channels.rb +2 -0
- data/lib/discordrb/events/guilds.rb +16 -9
- data/lib/discordrb/events/invites.rb +125 -0
- data/lib/discordrb/events/members.rb +6 -2
- data/lib/discordrb/events/message.rb +69 -27
- data/lib/discordrb/events/presence.rb +14 -4
- data/lib/discordrb/events/raw.rb +1 -3
- data/lib/discordrb/events/reactions.rb +49 -3
- data/lib/discordrb/events/typing.rb +6 -4
- data/lib/discordrb/events/voice_server_update.rb +47 -0
- data/lib/discordrb/events/voice_state_update.rb +15 -10
- data/lib/discordrb/events/webhooks.rb +9 -6
- data/lib/discordrb/gateway.rb +72 -57
- data/lib/discordrb/id_object.rb +39 -0
- data/lib/discordrb/light/integrations.rb +1 -1
- data/lib/discordrb/light/light_bot.rb +1 -1
- data/lib/discordrb/logger.rb +4 -4
- data/lib/discordrb/paginator.rb +57 -0
- data/lib/discordrb/permissions.rb +103 -8
- data/lib/discordrb/version.rb +1 -1
- data/lib/discordrb/voice/encoder.rb +16 -7
- data/lib/discordrb/voice/network.rb +84 -43
- data/lib/discordrb/voice/sodium.rb +96 -0
- data/lib/discordrb/voice/voice_bot.rb +34 -26
- data/lib/discordrb.rb +73 -0
- metadata +98 -60
- /data/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5c0ecfd68356ed63ea61a7b99bb5d32e358f74b23c2f729ab531e4848bc770d
|
4
|
+
data.tar.gz: 4c5917f1b7a1a3e97d875a0244a8fa8e9583bce025053505b960de9e900ca16f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09b5b31c7e7f15c7053c476ae0c2fd11839b7f5b82c4dea330764da42321c8333559df72273cdffbafe91bc9452a51a4bece945a2e6b3a8774af5fce409750fb'
|
7
|
+
data.tar.gz: 1743f21d2ad48858e8ebed88984fdf5cecb2ce5878ae0cbf32dbccc451175daa1d0f37c571efa100dadd94dcb169b17515bc691884d9583e00b40f57b45242ff
|
@@ -0,0 +1,126 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
commands:
|
4
|
+
setup-env:
|
5
|
+
description: Sets up the testing environment
|
6
|
+
steps:
|
7
|
+
- run:
|
8
|
+
name: Install OS packages
|
9
|
+
command: apk add git build-base ruby-dev ruby-etc ruby-json libsodium
|
10
|
+
- checkout
|
11
|
+
- run:
|
12
|
+
name: "Ruby version"
|
13
|
+
command: |
|
14
|
+
ruby -v
|
15
|
+
echo $RUBY_VERSION > ruby_version.txt
|
16
|
+
- restore_cache:
|
17
|
+
keys:
|
18
|
+
- bundle-cache-v1-{{ checksum "ruby_version.txt" }}-{{ .Branch }}-{{ checksum "Gemfile" }}-{{ checksum "discordrb.gemspec" }}
|
19
|
+
- bundle-cache-v1-{{ checksum "ruby_version.txt" }}-{{ .Branch }}
|
20
|
+
- bundle-cache-v1-{{ checksum "ruby_version.txt" }}
|
21
|
+
- run:
|
22
|
+
name: Install dependencies
|
23
|
+
command: bundle install --path vendor/bundle
|
24
|
+
- save_cache:
|
25
|
+
key: bundle-cache-v1-{{ checksum "ruby_version.txt" }}-{{ .Branch }}-{{ checksum "Gemfile" }}-{{ checksum "discordrb.gemspec" }}
|
26
|
+
paths:
|
27
|
+
- ./vendor/bundle
|
28
|
+
|
29
|
+
jobs:
|
30
|
+
test_ruby_25:
|
31
|
+
docker:
|
32
|
+
- image: ruby:2.5-alpine
|
33
|
+
steps:
|
34
|
+
- setup-env
|
35
|
+
- run:
|
36
|
+
name: Run RSpec
|
37
|
+
command: bundle exec rspec
|
38
|
+
|
39
|
+
test_ruby_26:
|
40
|
+
docker:
|
41
|
+
- image: ruby:2.6-alpine
|
42
|
+
steps:
|
43
|
+
- setup-env
|
44
|
+
- run:
|
45
|
+
name: Run RSpec
|
46
|
+
command: bundle exec rspec
|
47
|
+
|
48
|
+
test_ruby_27:
|
49
|
+
docker:
|
50
|
+
- image: ruby:2.7-alpine
|
51
|
+
steps:
|
52
|
+
- setup-env
|
53
|
+
- run:
|
54
|
+
name: Run RSpec
|
55
|
+
command: bundle exec rspec
|
56
|
+
|
57
|
+
rubocop:
|
58
|
+
docker:
|
59
|
+
- image: ruby:2.5-alpine
|
60
|
+
steps:
|
61
|
+
- setup-env
|
62
|
+
- run:
|
63
|
+
name: Run Rubocop
|
64
|
+
command: bundle exec rubocop -P
|
65
|
+
|
66
|
+
yard:
|
67
|
+
docker:
|
68
|
+
- image: ruby:2.5-alpine
|
69
|
+
steps:
|
70
|
+
- setup-env
|
71
|
+
- attach_workspace:
|
72
|
+
at: /tmp/workspace
|
73
|
+
- run:
|
74
|
+
name: Run YARD
|
75
|
+
command: bundle exec yard --output-dir /tmp/workspace/docs
|
76
|
+
- persist_to_workspace:
|
77
|
+
root: /tmp/workspace
|
78
|
+
paths:
|
79
|
+
- docs
|
80
|
+
|
81
|
+
pages:
|
82
|
+
machine: true
|
83
|
+
steps:
|
84
|
+
- attach_workspace:
|
85
|
+
at: /tmp/workspace
|
86
|
+
- run:
|
87
|
+
name: Clone docs
|
88
|
+
command: git clone $CIRCLE_REPOSITORY_URL -b gh-pages .
|
89
|
+
- add_ssh_keys:
|
90
|
+
fingerprints:
|
91
|
+
- "9a:4c:50:94:23:46:81:74:41:97:87:04:4e:59:4b:4e"
|
92
|
+
- run:
|
93
|
+
name: Push updated docs
|
94
|
+
command: |
|
95
|
+
git config user.name "Circle CI"
|
96
|
+
git config user.email "ci-build@shardlab.dev"
|
97
|
+
|
98
|
+
SOURCE_BRANCH=$CIRCLE_BRANCH
|
99
|
+
if [ -n "$CIRCLE_TAG" ]; then
|
100
|
+
SOURCE_BRANCH=$CIRCLE_TAG
|
101
|
+
fi
|
102
|
+
|
103
|
+
mkdir -p $SOURCE_BRANCH
|
104
|
+
rm -rf $SOURCE_BRANCH/*
|
105
|
+
cp -r /tmp/workspace/docs/. ./$SOURCE_BRANCH/
|
106
|
+
|
107
|
+
git add $SOURCE_BRANCH
|
108
|
+
git commit --allow-empty -m "[skip ci] Deploy docs"
|
109
|
+
git push -u origin gh-pages
|
110
|
+
|
111
|
+
workflows:
|
112
|
+
test:
|
113
|
+
jobs:
|
114
|
+
- test_ruby_25
|
115
|
+
- test_ruby_26
|
116
|
+
- test_ruby_27
|
117
|
+
- rubocop
|
118
|
+
- yard
|
119
|
+
deploy:
|
120
|
+
jobs:
|
121
|
+
- yard:
|
122
|
+
filters: {branches: {only: main}, tags: {only: /^v.*/}}
|
123
|
+
- pages:
|
124
|
+
requires:
|
125
|
+
- yard
|
126
|
+
filters: {branches: {only: main}, tags: {only: /^v.*/}}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Report a bug to help us improve the library
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
# Summary
|
8
|
+
|
9
|
+
<!---
|
10
|
+
First, please check to see that another issue or pull request (open or closed)
|
11
|
+
already addresses the problem you are facing. If you are not sure, please ask
|
12
|
+
in the Discord channel (link below).
|
13
|
+
|
14
|
+
Describe the bug you are encountering with as much detail as you can.
|
15
|
+
If you are not sure if a small detail is relevant, include it anyways!
|
16
|
+
|
17
|
+
Include simple code examples that will reproduce the bug.
|
18
|
+
Include any exceptions you are encountering in your logs, including
|
19
|
+
the initial error message and the backtrace that follows.
|
20
|
+
|
21
|
+
Stuck or need help? Join the Discord! https://discord.gg/cyK3Hjm
|
22
|
+
-->
|
23
|
+
|
24
|
+
---
|
25
|
+
|
26
|
+
## Environment
|
27
|
+
|
28
|
+
<!---
|
29
|
+
These are some commands to run to give us basic information about
|
30
|
+
your Ruby environment. Some issues may be version, OS, or hardware specific.
|
31
|
+
--->
|
32
|
+
|
33
|
+
**Ruby version:**
|
34
|
+
|
35
|
+
<!--- Paste full output of `ruby -v` here --->
|
36
|
+
|
37
|
+
**Discordrb version:**
|
38
|
+
|
39
|
+
<!--- Paste full output of `gem list discordrb` or `bundle list discordrb` here --->
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
name: Feature Request
|
3
|
+
about: Request a new feature, or change an existing one
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
<!---
|
8
|
+
Describe your feature request in as much detail as you can here.
|
9
|
+
|
10
|
+
Include why you want this feature. For example:
|
11
|
+
|
12
|
+
- It is a feature supported by Discord's API, but missing from the library
|
13
|
+
|
14
|
+
- It is a feature that would simplify a lot of your bots code
|
15
|
+
|
16
|
+
- It is a feature present in other popular Discord libraries
|
17
|
+
|
18
|
+
Include simple code examples (pseudocode is fine) that demonstrate
|
19
|
+
what you want to do.
|
20
|
+
|
21
|
+
Do your best to think about how this new feature would impact the code
|
22
|
+
of other people who use discordrb, and not just your own bot's codebase.
|
23
|
+
|
24
|
+
Stuck or need help? Join the Discord! https://discord.gg/cyK3Hjm
|
25
|
+
--->
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Summary
|
2
|
+
|
3
|
+
<!---
|
4
|
+
Describe the general goal of your pull request here:
|
5
|
+
|
6
|
+
- Include details about any issues you encountered that inspired
|
7
|
+
the pull request, such as bugs or missing features.
|
8
|
+
|
9
|
+
- If adding or changing features, include a small example that showcases
|
10
|
+
the new behavior.
|
11
|
+
|
12
|
+
- Reference any related issues or pull requests.
|
13
|
+
|
14
|
+
Stuck or need help? Join the Discord! https://discord.gg/cyK3Hjm
|
15
|
+
--->
|
16
|
+
|
17
|
+
---
|
18
|
+
|
19
|
+
<!---
|
20
|
+
List each individual change you made to the library here in the appropriate
|
21
|
+
section in short, bulleted sentences.
|
22
|
+
|
23
|
+
This will aid in reviewing your pull request, and for adding it to the
|
24
|
+
changelog later.
|
25
|
+
|
26
|
+
You may remove sections that have no items if you want.
|
27
|
+
--->
|
28
|
+
|
29
|
+
## Added
|
30
|
+
|
31
|
+
## Changed
|
32
|
+
|
33
|
+
## Deprecated
|
34
|
+
|
35
|
+
## Removed
|
36
|
+
|
37
|
+
## Fixed
|
data/.rubocop.yml
CHANGED
@@ -1,44 +1,58 @@
|
|
1
|
-
|
2
|
-
Metrics/AbcSize:
|
3
|
-
Enabled: false
|
1
|
+
require: rubocop-performance
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
inherit_mode:
|
4
|
+
merge:
|
5
|
+
- AllowedNames
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
AllCops:
|
8
|
+
NewCops: enable
|
9
|
+
TargetRubyVersion: 2.5
|
10
10
|
|
11
|
-
|
11
|
+
# Disable line length checks
|
12
|
+
Layout/LineLength:
|
12
13
|
Enabled: false
|
13
14
|
|
14
|
-
|
15
|
+
# TODO: Larger refactor
|
16
|
+
Lint/MissingSuper:
|
15
17
|
Enabled: false
|
16
18
|
|
17
|
-
|
19
|
+
# Allow 'Pokémon-style' exception handling
|
20
|
+
Lint/RescueException:
|
18
21
|
Enabled: false
|
19
22
|
|
20
|
-
|
23
|
+
# Disable all metrics.
|
24
|
+
Metrics:
|
21
25
|
Enabled: false
|
22
26
|
|
23
|
-
|
24
|
-
|
27
|
+
# Allow some common and/or obvious short method params
|
28
|
+
Naming/MethodParameterName:
|
29
|
+
AllowedNames:
|
30
|
+
- e
|
25
31
|
|
26
|
-
|
27
|
-
|
32
|
+
# Ignore `eval` in the examples folder
|
33
|
+
Security/Eval:
|
34
|
+
Exclude:
|
35
|
+
- examples/**/*
|
28
36
|
|
29
|
-
|
37
|
+
# https://stackoverflow.com/q/4763121/
|
38
|
+
Style/Alias:
|
30
39
|
Enabled: false
|
31
40
|
|
32
41
|
# Prefer compact module/class defs
|
33
42
|
Style/ClassAndModuleChildren:
|
34
43
|
Enabled: false
|
35
44
|
|
36
|
-
#
|
37
|
-
Style/
|
45
|
+
# So RuboCop doesn't complain about application IDs
|
46
|
+
Style/NumericLiterals:
|
47
|
+
Exclude:
|
48
|
+
- examples/**/*
|
49
|
+
|
50
|
+
# TODO: Requires breaking changes
|
51
|
+
Style/OptionalBooleanParameter:
|
38
52
|
Enabled: false
|
39
53
|
|
40
|
-
#
|
41
|
-
|
54
|
+
# Prefer explicit arguments in case global variables like `$;` or `$,` are changed
|
55
|
+
Style/RedundantArgument:
|
42
56
|
Enabled: false
|
43
57
|
|
44
58
|
# Prefer |m, e| for the `reduce` block arguments
|
@@ -46,20 +60,3 @@ Style/SingleLineBlockParams:
|
|
46
60
|
Methods:
|
47
61
|
- reduce: [m, e]
|
48
62
|
- inject: [m, e]
|
49
|
-
|
50
|
-
AllCops:
|
51
|
-
TargetRubyVersion: 2.2
|
52
|
-
|
53
|
-
# https://stackoverflow.com/q/4763121
|
54
|
-
Style/Alias:
|
55
|
-
Enabled: false
|
56
|
-
|
57
|
-
# So RuboCop doesn't complain about application IDs
|
58
|
-
Style/NumericLiterals:
|
59
|
-
Exclude:
|
60
|
-
- examples/*
|
61
|
-
|
62
|
-
# Ignore `eval` in the examples folder
|
63
|
-
Security/Eval:
|
64
|
-
Exclude:
|
65
|
-
- examples/*
|
data/.travis.yml
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.4.4
|
6
|
-
- 2.5.1
|
3
|
+
- 2.5
|
4
|
+
- 2.6
|
7
5
|
before_script:
|
8
6
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 -o ./cc-test-reporter
|
9
7
|
- chmod +x ./cc-test-reporter
|
10
8
|
- ./cc-test-reporter before-build
|
9
|
+
- sudo apt-get install libsodium-dev
|
11
10
|
script:
|
12
11
|
- bundle exec rspec spec
|
13
12
|
- bundle exec rubocop -c .rubocop.yml
|
@@ -22,7 +21,7 @@ deploy:
|
|
22
21
|
local-dir: docs
|
23
22
|
on:
|
24
23
|
branch: master
|
25
|
-
rvm: 2.
|
24
|
+
rvm: 2.6
|
26
25
|
- provider: pages
|
27
26
|
skip-cleanup: true
|
28
27
|
github-token: $GITHUB_TOKEN
|
@@ -30,4 +29,4 @@ deploy:
|
|
30
29
|
local-dir: docs
|
31
30
|
on:
|
32
31
|
tags: true
|
33
|
-
rvm: 2.
|
32
|
+
rvm: 2.6
|