onyxcord 1.1.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 +7 -0
- data/.devcontainer/Dockerfile +13 -0
- data/.devcontainer/devcontainer.json +29 -0
- data/.devcontainer/postcreate.sh +4 -0
- data/.github/CONTRIBUTING.md +13 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- data/.github/pull_request_template.md +37 -0
- data/.github/workflows/ci.yml +78 -0
- data/.github/workflows/codeql.yml +65 -0
- data/.github/workflows/deploy.yml +54 -0
- data/.github/workflows/release.yml +51 -0
- data/.gitignore +16 -0
- data/.markdownlint.json +4 -0
- data/.overcommit.yml +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +129 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +305 -0
- data/Rakefile +17 -0
- data/bin/console +15 -0
- data/bin/setup +7 -0
- data/lib/onyxcord/allowed_mentions.rb +43 -0
- data/lib/onyxcord/api/application.rb +316 -0
- data/lib/onyxcord/api/channel.rb +700 -0
- data/lib/onyxcord/api/interaction.rb +67 -0
- data/lib/onyxcord/api/invite.rb +44 -0
- data/lib/onyxcord/api/server.rb +775 -0
- data/lib/onyxcord/api/user.rb +158 -0
- data/lib/onyxcord/api/webhook.rb +163 -0
- data/lib/onyxcord/api.rb +335 -0
- data/lib/onyxcord/await.rb +51 -0
- data/lib/onyxcord/bot.rb +1971 -0
- data/lib/onyxcord/cache.rb +326 -0
- data/lib/onyxcord/colour_rgb.rb +43 -0
- data/lib/onyxcord/commands/command_bot.rb +511 -0
- data/lib/onyxcord/commands/container.rb +112 -0
- data/lib/onyxcord/commands/events.rb +11 -0
- data/lib/onyxcord/commands/parser.rb +327 -0
- data/lib/onyxcord/commands/rate_limiter.rb +144 -0
- data/lib/onyxcord/configuration.rb +125 -0
- data/lib/onyxcord/container.rb +988 -0
- data/lib/onyxcord/data/activity.rb +271 -0
- data/lib/onyxcord/data/application.rb +341 -0
- data/lib/onyxcord/data/attachment.rb +91 -0
- data/lib/onyxcord/data/audit_logs.rb +438 -0
- data/lib/onyxcord/data/avatar_decoration.rb +26 -0
- data/lib/onyxcord/data/call.rb +22 -0
- data/lib/onyxcord/data/channel.rb +1355 -0
- data/lib/onyxcord/data/channel_tag.rb +69 -0
- data/lib/onyxcord/data/collectibles.rb +47 -0
- data/lib/onyxcord/data/component.rb +583 -0
- data/lib/onyxcord/data/embed.rb +258 -0
- data/lib/onyxcord/data/emoji.rb +123 -0
- data/lib/onyxcord/data/install_params.rb +24 -0
- data/lib/onyxcord/data/integration.rb +144 -0
- data/lib/onyxcord/data/interaction.rb +1141 -0
- data/lib/onyxcord/data/invite.rb +137 -0
- data/lib/onyxcord/data/member.rb +528 -0
- data/lib/onyxcord/data/message.rb +612 -0
- data/lib/onyxcord/data/message_activity.rb +41 -0
- data/lib/onyxcord/data/overwrite.rb +109 -0
- data/lib/onyxcord/data/poll.rb +365 -0
- data/lib/onyxcord/data/primary_server.rb +60 -0
- data/lib/onyxcord/data/profile.rb +79 -0
- data/lib/onyxcord/data/reaction.rb +64 -0
- data/lib/onyxcord/data/recipient.rb +34 -0
- data/lib/onyxcord/data/role.rb +449 -0
- data/lib/onyxcord/data/role_connection_data.rb +69 -0
- data/lib/onyxcord/data/role_subscription.rb +41 -0
- data/lib/onyxcord/data/scheduled_event.rb +513 -0
- data/lib/onyxcord/data/server.rb +1614 -0
- data/lib/onyxcord/data/server_preview.rb +68 -0
- data/lib/onyxcord/data/snapshot.rb +112 -0
- data/lib/onyxcord/data/team.rb +98 -0
- data/lib/onyxcord/data/timestamp.rb +69 -0
- data/lib/onyxcord/data/user.rb +324 -0
- data/lib/onyxcord/data/voice_region.rb +46 -0
- data/lib/onyxcord/data/voice_state.rb +41 -0
- data/lib/onyxcord/data/webhook.rb +238 -0
- data/lib/onyxcord/data.rb +57 -0
- data/lib/onyxcord/errors.rb +246 -0
- data/lib/onyxcord/event_executor.rb +80 -0
- data/lib/onyxcord/events/await.rb +48 -0
- data/lib/onyxcord/events/bans.rb +60 -0
- data/lib/onyxcord/events/channels.rb +225 -0
- data/lib/onyxcord/events/generic.rb +129 -0
- data/lib/onyxcord/events/guilds.rb +269 -0
- data/lib/onyxcord/events/integrations.rb +100 -0
- data/lib/onyxcord/events/interactions.rb +624 -0
- data/lib/onyxcord/events/invites.rb +127 -0
- data/lib/onyxcord/events/lifetime.rb +31 -0
- data/lib/onyxcord/events/members.rb +110 -0
- data/lib/onyxcord/events/message.rb +399 -0
- data/lib/onyxcord/events/polls.rb +118 -0
- data/lib/onyxcord/events/presence.rb +131 -0
- data/lib/onyxcord/events/raw.rb +74 -0
- data/lib/onyxcord/events/reactions.rb +218 -0
- data/lib/onyxcord/events/roles.rb +87 -0
- data/lib/onyxcord/events/scheduled_events.rb +171 -0
- data/lib/onyxcord/events/threads.rb +100 -0
- data/lib/onyxcord/events/typing.rb +73 -0
- data/lib/onyxcord/events/voice_server_update.rb +48 -0
- data/lib/onyxcord/events/voice_state_update.rb +106 -0
- data/lib/onyxcord/events/webhooks.rb +65 -0
- data/lib/onyxcord/gateway.rb +890 -0
- data/lib/onyxcord/id_object.rb +39 -0
- data/lib/onyxcord/light/data.rb +62 -0
- data/lib/onyxcord/light/integrations.rb +73 -0
- data/lib/onyxcord/light/light_bot.rb +58 -0
- data/lib/onyxcord/light.rb +8 -0
- data/lib/onyxcord/logger.rb +120 -0
- data/lib/onyxcord/message_components.rb +70 -0
- data/lib/onyxcord/paginator.rb +60 -0
- data/lib/onyxcord/permissions.rb +255 -0
- data/lib/onyxcord/rate_limiter/gateway.rb +42 -0
- data/lib/onyxcord/rate_limiter/rest.rb +89 -0
- data/lib/onyxcord/version.rb +7 -0
- data/lib/onyxcord/voice/encoder.rb +115 -0
- data/lib/onyxcord/voice/network.rb +380 -0
- data/lib/onyxcord/voice/opcodes.rb +29 -0
- data/lib/onyxcord/voice/sodium.rb +157 -0
- data/lib/onyxcord/voice/timer.rb +19 -0
- data/lib/onyxcord/voice/voice_bot.rb +386 -0
- data/lib/onyxcord/webhooks.rb +14 -0
- data/lib/onyxcord/websocket.rb +62 -0
- data/lib/onyxcord.rb +180 -0
- data/onyxcord-webhooks.gemspec +30 -0
- data/onyxcord.gemspec +50 -0
- metadata +421 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f5d2ba7d4563edb0e1a0e1e19706759c987f775d31bf75e5e21600fa99b9fb7c
|
|
4
|
+
data.tar.gz: 92a280220aff31be1a36e526309193a4269437f2845fc409e3fba6cedef19d81
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 580c7ae99d795b2c12a823f03d0e1097f83834141c180321994e6b7ae903e57ad0fc24b5d797f46c8431ce1816af3f35d7ba9a5aa0a2fa137cab0a5e0f4780c2
|
|
7
|
+
data.tar.gz: 051cabf28b31f5b92c93a6fd28397f8b171510cd25d946c9f9ac55913a4cfe282bf2753d7881f6712f0ffe35cb56127388b8cec12f508b542c27d4ceb0daed74
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Which Ruby version to use. You may need to use a more restrictive version,
|
|
2
|
+
# e.g. `3.0`
|
|
3
|
+
ARG VARIANT=3.3
|
|
4
|
+
|
|
5
|
+
# Pull Microsoft's ruby devcontainer base image
|
|
6
|
+
FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT}
|
|
7
|
+
|
|
8
|
+
# Install libsodium dependency for voice channel interactions
|
|
9
|
+
RUN apt update -yq && apt install -y libsodium-dev
|
|
10
|
+
|
|
11
|
+
# Ensure we're running the latest bundler, as what ships with the Ruby image may
|
|
12
|
+
# not be current, and bundler will auto-downgrade to match the Gemfile.lock
|
|
13
|
+
RUN gem install bundler
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Ruby",
|
|
3
|
+
"build": {
|
|
4
|
+
"dockerfile": "Dockerfile"
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
// Configure tool-specific properties.
|
|
8
|
+
"customizations": {
|
|
9
|
+
// Configure properties specific to VS Code.
|
|
10
|
+
"vscode": {
|
|
11
|
+
// Add the IDs of extensions you want installed when the container is created.
|
|
12
|
+
"extensions": [
|
|
13
|
+
"shopify.ruby-lsp"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
// Set the environment variables
|
|
19
|
+
// "runArgs": ["--env-file",".env"],
|
|
20
|
+
|
|
21
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
22
|
+
// "forwardPorts": [],
|
|
23
|
+
|
|
24
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
25
|
+
"postCreateCommand": "bash .devcontainer/postcreate.sh",
|
|
26
|
+
|
|
27
|
+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
|
28
|
+
"remoteUser": "vscode"
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Contributing guidelines
|
|
2
|
+
|
|
3
|
+
Any contributions are very much appreciated! This project is relatively relaxed when it comes to guidelines, however
|
|
4
|
+
there are still some things that would be nice to have considered.
|
|
5
|
+
|
|
6
|
+
For bug reports, please try to include a code sample if at all appropriate for
|
|
7
|
+
the issue, so we can reproduce it on our own machines.
|
|
8
|
+
|
|
9
|
+
For PRs, please make sure that you tested your code before every push; it's a little annoying to keep having to get back
|
|
10
|
+
to a PR because of small avoidable oversights. (Huge bonus points if you're adding specs for your code! This project
|
|
11
|
+
has very few specs in places where it should have more so every added spec is very much appreciated.)
|
|
12
|
+
|
|
13
|
+
If you have any questions at all, don't be afraid to ask in the [onyxcord channel on Discord](https://discord.gg/cyK3Hjm).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report a bug to help us improve the library
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Summary
|
|
7
|
+
|
|
8
|
+
<!---
|
|
9
|
+
First, please check to see that another issue or pull request (open or closed)
|
|
10
|
+
already addresses the problem you are facing. If you are not sure, please ask
|
|
11
|
+
in the Discord channel (link below).
|
|
12
|
+
|
|
13
|
+
Describe the bug you are encountering with as much detail as you can.
|
|
14
|
+
If you are not sure if a small detail is relevant, include it anyways!
|
|
15
|
+
|
|
16
|
+
Include simple code examples that will reproduce the bug.
|
|
17
|
+
Include any exceptions you are encountering in your logs, including
|
|
18
|
+
the initial error message and the backtrace that follows.
|
|
19
|
+
|
|
20
|
+
Stuck or need help? Join the Discord! https://discord.gg/cyK3Hjm
|
|
21
|
+
-->
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Environment
|
|
26
|
+
|
|
27
|
+
<!---
|
|
28
|
+
These are some commands to run to give us basic information about
|
|
29
|
+
your Ruby environment. Some issues may be version, OS, or hardware specific.
|
|
30
|
+
--->
|
|
31
|
+
|
|
32
|
+
**Ruby version:**
|
|
33
|
+
|
|
34
|
+
<!--- Paste full output of `ruby -v` here --->
|
|
35
|
+
|
|
36
|
+
**OnyxCord version:**
|
|
37
|
+
|
|
38
|
+
<!--- Paste full output of `gem list onyxcord` or `bundle list onyxcord` here --->
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Request a new feature, or change an existing one
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!---
|
|
7
|
+
Describe your feature request in as much detail as you can here.
|
|
8
|
+
|
|
9
|
+
Include why you want this feature. For example:
|
|
10
|
+
|
|
11
|
+
- It is a feature supported by Discord's API, but missing from the library
|
|
12
|
+
|
|
13
|
+
- It is a feature that would simplify a lot of your bots code
|
|
14
|
+
|
|
15
|
+
- It is a feature present in other popular Discord libraries
|
|
16
|
+
|
|
17
|
+
Include simple code examples (pseudocode is fine) that demonstrate
|
|
18
|
+
what you want to do.
|
|
19
|
+
|
|
20
|
+
Do your best to think about how this new feature would impact the code
|
|
21
|
+
of other people who use onyxcord, and not just your own bot's codebase.
|
|
22
|
+
|
|
23
|
+
Stuck or need help? Join the Discord! https://discord.gg/cyK3Hjm
|
|
24
|
+
--->
|
|
@@ -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
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
# --- Test on multiple Ruby versions ---
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
ruby: [3.3, 3.4, 4.0]
|
|
15
|
+
container:
|
|
16
|
+
image: ruby:${{ matrix.ruby }}-alpine
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- name: Install OS packages
|
|
20
|
+
run: apk add git build-base ruby-dev libsodium-dev
|
|
21
|
+
- name: Cache bundle
|
|
22
|
+
uses: actions/cache@v4
|
|
23
|
+
with:
|
|
24
|
+
path: vendor/bundle
|
|
25
|
+
key: bundle-${{ hashFiles('Gemfile', 'onyxcord.gemspec') }}-${{ matrix.ruby }}
|
|
26
|
+
restore-keys: |
|
|
27
|
+
bundle-${{ matrix.ruby }}
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: bundle config set path vendor/bundle && bundle install
|
|
30
|
+
- name: Run RSpec
|
|
31
|
+
run: |
|
|
32
|
+
mkdir -p rspec
|
|
33
|
+
bundle exec rspec --format progress --format RspecJunitFormatter -o rspec/rspec.xml
|
|
34
|
+
- name: Upload test results
|
|
35
|
+
uses: actions/upload-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: rspec-results-${{ matrix.ruby }}
|
|
38
|
+
path: rspec/rspec.xml
|
|
39
|
+
|
|
40
|
+
# --- Rubocop ---
|
|
41
|
+
rubocop:
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
container:
|
|
44
|
+
image: ruby:3.3-alpine
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
- name: Install OS packages
|
|
48
|
+
run: apk add git build-base ruby-dev libsodium-dev
|
|
49
|
+
- name: Cache bundle
|
|
50
|
+
uses: actions/cache@v4
|
|
51
|
+
with:
|
|
52
|
+
path: vendor/bundle
|
|
53
|
+
key: bundle-${{ hashFiles('Gemfile', 'onyxcord.gemspec') }}-rubocop
|
|
54
|
+
- name: Install dependencies
|
|
55
|
+
run: bundle config set path vendor/bundle && bundle install
|
|
56
|
+
- name: Run Rubocop
|
|
57
|
+
run: bundle exec rubocop
|
|
58
|
+
|
|
59
|
+
# --- Generate YARD docs ---
|
|
60
|
+
yard:
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
container:
|
|
63
|
+
image: ruby:3.3-alpine
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
- name: Install OS packages
|
|
67
|
+
run: apk add git build-base ruby-dev libsodium-dev
|
|
68
|
+
- name: Cache bundle
|
|
69
|
+
uses: actions/cache@v4
|
|
70
|
+
with:
|
|
71
|
+
path: vendor/bundle
|
|
72
|
+
key: bundle-${{ hashFiles('Gemfile', 'onyxcord.gemspec') }}-yard
|
|
73
|
+
- name: Install dependencies
|
|
74
|
+
run: bundle config set path vendor/bundle && bundle install
|
|
75
|
+
- name: Run YARD
|
|
76
|
+
run: |
|
|
77
|
+
mkdir -p docs
|
|
78
|
+
bundle exec yard --output-dir docs
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: "CodeQL"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ 'main' ]
|
|
6
|
+
pull_request:
|
|
7
|
+
# The branches below must be a subset of the branches above
|
|
8
|
+
branches: [ 'main' ]
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: '29 6 * * 5'
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
analyze:
|
|
14
|
+
name: Analyze
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
actions: read
|
|
18
|
+
contents: read
|
|
19
|
+
security-events: write
|
|
20
|
+
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
language: [ 'ruby' ]
|
|
25
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
26
|
+
# Use only 'java' to analyze code written in Java, Kotlin or both
|
|
27
|
+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
|
28
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- name: Checkout repository
|
|
32
|
+
uses: actions/checkout@v3
|
|
33
|
+
|
|
34
|
+
# Initializes the CodeQL tools for scanning.
|
|
35
|
+
- name: Initialize CodeQL
|
|
36
|
+
uses: github/codeql-action/init@v3
|
|
37
|
+
with:
|
|
38
|
+
languages: ${{ matrix.language }}
|
|
39
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
40
|
+
# By default, queries listed here will override any specified in a config file.
|
|
41
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
42
|
+
|
|
43
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
44
|
+
# queries: security-extended,security-and-quality
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
|
48
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
49
|
+
- name: Autobuild
|
|
50
|
+
uses: github/codeql-action/autobuild@v3
|
|
51
|
+
|
|
52
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
53
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
54
|
+
|
|
55
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
56
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
57
|
+
|
|
58
|
+
# - run: |
|
|
59
|
+
# echo "Run, Build Application using script"
|
|
60
|
+
# ./location_of_script_within_repo/buildscript.sh
|
|
61
|
+
|
|
62
|
+
- name: Perform CodeQL Analysis
|
|
63
|
+
uses: github/codeql-action/analyze@v3
|
|
64
|
+
with:
|
|
65
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Deploy Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main] # deploy only on merges to main
|
|
6
|
+
tags:
|
|
7
|
+
- "v*" # deploy when a version tag (e.g., v1.0.0) is created
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
deploy:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
container:
|
|
13
|
+
image: ruby:3.3-alpine
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install OS packages
|
|
19
|
+
run: apk add git build-base ruby-dev libsodium-dev
|
|
20
|
+
|
|
21
|
+
- name: Cache bundle
|
|
22
|
+
uses: actions/cache@v4
|
|
23
|
+
with:
|
|
24
|
+
path: vendor/bundle
|
|
25
|
+
key: bundle-${{ hashFiles('Gemfile', 'onyxcord.gemspec') }}-yard
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: bundle install --path vendor/bundle
|
|
29
|
+
|
|
30
|
+
- name: Generate YARD documentation
|
|
31
|
+
run: |
|
|
32
|
+
mkdir -p docs
|
|
33
|
+
bundle exec yard --output-dir docs
|
|
34
|
+
|
|
35
|
+
- name: Determine deploy folder
|
|
36
|
+
id: set_folder
|
|
37
|
+
run: |
|
|
38
|
+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
|
39
|
+
echo "folder=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
40
|
+
else
|
|
41
|
+
echo "folder=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
|
|
42
|
+
fi
|
|
43
|
+
echo "Deploying to folder: ${{ steps.set_folder.outputs.folder }}"
|
|
44
|
+
|
|
45
|
+
- name: Deploy to GitHub Pages
|
|
46
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
47
|
+
with:
|
|
48
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
49
|
+
publish_dir: docs
|
|
50
|
+
publish_branch: gh-pages
|
|
51
|
+
destination_dir: ${{ steps.set_folder.outputs.folder }}
|
|
52
|
+
keep_files: true
|
|
53
|
+
user_name: "GitHub Actions"
|
|
54
|
+
user_email: "actions@github.com"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish RubyGems + GitHub Packages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
packages: write
|
|
12
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
13
|
+
contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v5
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
- name: Set up Ruby
|
|
20
|
+
uses: ruby/setup-ruby@v1
|
|
21
|
+
with:
|
|
22
|
+
bundler-cache: true
|
|
23
|
+
ruby-version: '3.4.7'
|
|
24
|
+
|
|
25
|
+
- name: Validate tag matches gemspecs
|
|
26
|
+
run: |
|
|
27
|
+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
|
28
|
+
for gemspec in *.gemspec; do
|
|
29
|
+
GEM_VERSION=$(ruby -e "puts Gem::Specification.load('$gemspec').version")
|
|
30
|
+
if [ "$TAG_VERSION" != "$GEM_VERSION" ]; then
|
|
31
|
+
echo "::error::$gemspec version ($GEM_VERSION) does not match tag ($TAG_VERSION)"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
- uses: rubygems/release-gem@v1
|
|
37
|
+
|
|
38
|
+
- name: Publish to GitHub Packages
|
|
39
|
+
env:
|
|
40
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
run: |
|
|
42
|
+
OWNER=$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f1)
|
|
43
|
+
for gemspec in *.gemspec; do
|
|
44
|
+
gem build "$gemspec"
|
|
45
|
+
done
|
|
46
|
+
for gem_file in *.gem; do
|
|
47
|
+
echo "Publishing $gem_file to GitHub Packages..."
|
|
48
|
+
gem push "$gem_file" \
|
|
49
|
+
--key github \
|
|
50
|
+
--host "https://rubygems.pkg.github.com/${OWNER}" || true
|
|
51
|
+
done
|
data/.gitignore
ADDED
data/.markdownlint.json
ADDED
data/.overcommit.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-performance
|
|
3
|
+
- rubocop-rake
|
|
4
|
+
|
|
5
|
+
inherit_mode:
|
|
6
|
+
merge:
|
|
7
|
+
- AllowedNames
|
|
8
|
+
|
|
9
|
+
AllCops:
|
|
10
|
+
NewCops: enable
|
|
11
|
+
TargetRubyVersion: 3.3
|
|
12
|
+
|
|
13
|
+
# Disable line length checks
|
|
14
|
+
Layout/LineLength:
|
|
15
|
+
Enabled: false
|
|
16
|
+
|
|
17
|
+
# TODO: Larger refactor
|
|
18
|
+
Lint/MissingSuper:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
# Allow 'Pokémon-style' exception handling
|
|
22
|
+
Lint/RescueException:
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
25
|
+
# Disable all metrics.
|
|
26
|
+
Metrics:
|
|
27
|
+
Enabled: false
|
|
28
|
+
|
|
29
|
+
# Allow some common and/or obvious short method params
|
|
30
|
+
Naming/MethodParameterName:
|
|
31
|
+
AllowedNames:
|
|
32
|
+
- e
|
|
33
|
+
|
|
34
|
+
# Ignore `eval` in the examples folder
|
|
35
|
+
Security/Eval:
|
|
36
|
+
Exclude:
|
|
37
|
+
- examples/**/*
|
|
38
|
+
|
|
39
|
+
# https://stackoverflow.com/q/4763121/
|
|
40
|
+
Style/Alias:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
# Had to disable this globally because it's being silently autocorrected even with local disable comments?
|
|
44
|
+
Style/BisectedAttrAccessor:
|
|
45
|
+
Enabled: false
|
|
46
|
+
|
|
47
|
+
# Prefer compact module/class defs
|
|
48
|
+
Style/ClassAndModuleChildren:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
# So RuboCop doesn't complain about application IDs
|
|
52
|
+
Style/NumericLiterals:
|
|
53
|
+
Exclude:
|
|
54
|
+
- examples/**/*
|
|
55
|
+
|
|
56
|
+
# TODO: Requires breaking changes
|
|
57
|
+
Style/OptionalBooleanParameter:
|
|
58
|
+
Enabled: false
|
|
59
|
+
|
|
60
|
+
# Prefer explicit arguments in case global variables like `$;` or `$,` are changed
|
|
61
|
+
Style/RedundantArgument:
|
|
62
|
+
Enabled: false
|
|
63
|
+
|
|
64
|
+
# Prefer |m, e| for the `reduce` block arguments
|
|
65
|
+
Style/SingleLineBlockParams:
|
|
66
|
+
Methods:
|
|
67
|
+
- reduce: [m, e]
|
|
68
|
+
- inject: [m, e]
|
|
69
|
+
|
|
70
|
+
###################################
|
|
71
|
+
## NEW COPS TO MAKE DECISIONS ON ##
|
|
72
|
+
###################################
|
|
73
|
+
|
|
74
|
+
# TODO: Decide how you want to handle this:
|
|
75
|
+
# https://rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashSyntax
|
|
76
|
+
Style/HashSyntax:
|
|
77
|
+
EnforcedShorthandSyntax: either
|
|
78
|
+
|
|
79
|
+
Style/ArgumentsForwarding:
|
|
80
|
+
Enabled: false
|
|
81
|
+
|
|
82
|
+
Performance/StringIdentifierArgument:
|
|
83
|
+
Enabled: false
|
|
84
|
+
|
|
85
|
+
Style/ComparableClamp:
|
|
86
|
+
Enabled: false
|
|
87
|
+
|
|
88
|
+
Style/SuperArguments:
|
|
89
|
+
Enabled: false
|
|
90
|
+
|
|
91
|
+
Naming/BlockForwarding:
|
|
92
|
+
Enabled: false
|
|
93
|
+
|
|
94
|
+
Style/RedundantSelfAssignmentBranch:
|
|
95
|
+
Enabled: false
|
|
96
|
+
|
|
97
|
+
Performance/MapCompact:
|
|
98
|
+
Enabled: false
|
|
99
|
+
|
|
100
|
+
Gemspec/RequiredRubyVersion:
|
|
101
|
+
Enabled: false
|
|
102
|
+
|
|
103
|
+
Gemspec/DevelopmentDependencies:
|
|
104
|
+
Enabled: false
|
|
105
|
+
|
|
106
|
+
Style/RedundantReturn:
|
|
107
|
+
Enabled: false
|
|
108
|
+
|
|
109
|
+
Style/RedundantParentheses:
|
|
110
|
+
Enabled: false
|
|
111
|
+
|
|
112
|
+
Layout/EndOfLine:
|
|
113
|
+
Enabled: true
|
|
114
|
+
EnforcedStyle: lf
|
|
115
|
+
|
|
116
|
+
# This will probably be a breaking change, but should happen
|
|
117
|
+
Style/ReturnNilInPredicateMethodDefinition:
|
|
118
|
+
Enabled: false
|
|
119
|
+
|
|
120
|
+
# FIXME: Disabled due to breaking tests, should probably refactor the code instead
|
|
121
|
+
Style/SafeNavigation:
|
|
122
|
+
Enabled: false
|
|
123
|
+
|
|
124
|
+
Style/Documentation:
|
|
125
|
+
Enabled: true
|
|
126
|
+
|
|
127
|
+
Style/IfUnlessModifier:
|
|
128
|
+
Exclude:
|
|
129
|
+
- lib/onyxcord/data/role.rb
|
data/.yardopts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--markup markdown --hide-tag todo --fail-on-warning
|
data/CHANGELOG.md
ADDED
|
File without changes
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2026 meew0
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|