onyxcord 2.0.13 → 3.2.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/lib/onyxcord/application_commands/command.rb +4 -97
- data/lib/onyxcord/application_commands/context.rb +4 -94
- data/lib/onyxcord/application_commands/option.rb +4 -75
- data/lib/onyxcord/application_commands/registry.rb +4 -45
- data/lib/onyxcord/application_commands.rb +8 -5
- data/lib/onyxcord/bot.rb +24 -1759
- data/lib/onyxcord/{cache.rb → cache/manager.rb} +16 -14
- data/lib/onyxcord/cache/stores/gateway.rb +272 -0
- data/lib/onyxcord/commands/bot/channels.rb +48 -0
- data/lib/onyxcord/commands/bot/execution.rb +174 -0
- data/lib/onyxcord/commands/bot/message_dispatch.rb +58 -0
- data/lib/onyxcord/commands/bot/permissions.rb +72 -0
- data/lib/onyxcord/commands/bot.rb +209 -0
- data/lib/onyxcord/commands/container.rb +21 -2
- data/lib/onyxcord/commands/parser.rb +30 -1
- data/lib/onyxcord/container.rb +16 -960
- data/lib/onyxcord/core/bot/application_commands.rb +210 -0
- data/lib/onyxcord/core/bot/awaits.rb +112 -0
- data/lib/onyxcord/core/bot/invites.rb +42 -0
- data/lib/onyxcord/core/bot/messaging.rb +161 -0
- data/lib/onyxcord/core/bot/oauth.rb +27 -0
- data/lib/onyxcord/core/bot/presence.rb +103 -0
- data/lib/onyxcord/core/bot/runtime.rb +183 -0
- data/lib/onyxcord/core/bot/voice.rb +69 -0
- data/lib/onyxcord/{errors.rb → core/errors.rb} +18 -3
- data/lib/onyxcord/{logger.rb → core/logger.rb} +5 -0
- data/lib/onyxcord/core/version.rb +5 -0
- data/lib/onyxcord/events/await/base.rb +48 -0
- data/lib/onyxcord/events/await.rb +1 -46
- data/lib/onyxcord/events/ban/base.rb +54 -0
- data/lib/onyxcord/events/ban/remove.rb +11 -0
- data/lib/onyxcord/events/bans.rb +2 -58
- data/lib/onyxcord/events/channels/base.rb +91 -0
- data/lib/onyxcord/events/channels/delete.rb +73 -0
- data/lib/onyxcord/events/channels/pins.rb +44 -0
- data/lib/onyxcord/events/channels/recipients.rb +77 -0
- data/lib/onyxcord/events/channels.rb +4 -239
- data/lib/onyxcord/events/guilds/audit_logs.rb +79 -0
- data/lib/onyxcord/events/guilds/base.rb +97 -0
- data/lib/onyxcord/events/guilds/emoji.rb +147 -0
- data/lib/onyxcord/events/guilds.rb +3 -267
- data/lib/onyxcord/events/handlers/channels.rb +133 -0
- data/lib/onyxcord/events/handlers/core.rb +146 -0
- data/lib/onyxcord/events/handlers/guilds.rb +375 -0
- data/lib/onyxcord/events/handlers/interactions.rb +238 -0
- data/lib/onyxcord/events/handlers/lifetime.rb +71 -0
- data/lib/onyxcord/events/handlers/messages.rb +218 -0
- data/lib/onyxcord/events/handlers/presence.rb +56 -0
- data/lib/onyxcord/events/handlers/raw.rb +39 -0
- data/lib/onyxcord/events/handlers/reactions.rb +98 -0
- data/lib/onyxcord/events/handlers/scheduled_events.rb +243 -0
- data/lib/onyxcord/events/handlers/voice.rb +46 -0
- data/lib/onyxcord/events/integration/base.rb +45 -0
- data/lib/onyxcord/events/integration/create.rb +11 -0
- data/lib/onyxcord/events/integration/delete.rb +48 -0
- data/lib/onyxcord/events/integration/update.rb +11 -0
- data/lib/onyxcord/events/integrations.rb +4 -98
- data/lib/onyxcord/events/interactions/application_commands.rb +185 -0
- data/lib/onyxcord/events/interactions/autocomplete.rb +62 -0
- data/lib/onyxcord/events/interactions/base.rb +175 -0
- data/lib/onyxcord/events/interactions/components.rb +221 -0
- data/lib/onyxcord/events/interactions/permissions.rb +53 -0
- data/lib/onyxcord/events/interactions.rb +5 -622
- data/lib/onyxcord/events/invite/create.rb +79 -0
- data/lib/onyxcord/events/invite/delete.rb +55 -0
- data/lib/onyxcord/events/invites.rb +2 -125
- data/lib/onyxcord/events/lifetime/base.rb +31 -0
- data/lib/onyxcord/events/lifetime.rb +1 -29
- data/lib/onyxcord/events/member/add.rb +12 -0
- data/lib/onyxcord/events/member/base.rb +67 -0
- data/lib/onyxcord/events/member/delete.rb +21 -0
- data/lib/onyxcord/events/member/update.rb +25 -0
- data/lib/onyxcord/events/members.rb +4 -108
- data/lib/onyxcord/events/message/base.rb +295 -0
- data/lib/onyxcord/events/message/ids.rb +71 -0
- data/lib/onyxcord/events/message/mentions.rb +55 -0
- data/lib/onyxcord/events/message/updates.rb +27 -0
- data/lib/onyxcord/events/message.rb +4 -397
- data/lib/onyxcord/events/poll/add.rb +11 -0
- data/lib/onyxcord/events/poll/base.rb +106 -0
- data/lib/onyxcord/events/poll/remove.rb +11 -0
- data/lib/onyxcord/events/polls.rb +3 -116
- data/lib/onyxcord/events/presence/playing.rb +77 -0
- data/lib/onyxcord/events/presence/status.rb +60 -0
- data/lib/onyxcord/events/presence.rb +2 -129
- data/lib/onyxcord/events/raw/base.rb +74 -0
- data/lib/onyxcord/events/raw.rb +1 -72
- data/lib/onyxcord/events/reactions/base.rb +143 -0
- data/lib/onyxcord/events/reactions/clear.rb +99 -0
- data/lib/onyxcord/events/reactions.rb +2 -216
- data/lib/onyxcord/events/role/create.rb +46 -0
- data/lib/onyxcord/events/role/delete.rb +40 -0
- data/lib/onyxcord/events/role/update.rb +11 -0
- data/lib/onyxcord/events/roles.rb +3 -85
- data/lib/onyxcord/events/scheduled_events/events.rb +112 -0
- data/lib/onyxcord/events/scheduled_events/users.rb +91 -0
- data/lib/onyxcord/events/scheduled_events.rb +2 -169
- data/lib/onyxcord/events/thread/base.rb +49 -0
- data/lib/onyxcord/events/thread/members.rb +44 -0
- data/lib/onyxcord/events/thread/update.rb +18 -0
- data/lib/onyxcord/events/threads.rb +3 -98
- data/lib/onyxcord/events/typing/base.rb +73 -0
- data/lib/onyxcord/events/typing.rb +1 -71
- data/lib/onyxcord/events/voice/server_update.rb +48 -0
- data/lib/onyxcord/events/voice/state_update.rb +137 -0
- data/lib/onyxcord/events/voice_server_update.rb +2 -46
- data/lib/onyxcord/events/voice_state_update.rb +2 -135
- data/lib/onyxcord/events/webhook/update.rb +65 -0
- data/lib/onyxcord/events/webhooks.rb +1 -63
- data/lib/onyxcord/gateway/client.rb +460 -0
- data/lib/onyxcord/interactions/command.rb +120 -0
- data/lib/onyxcord/interactions/context.rb +109 -0
- data/lib/onyxcord/interactions/internal/application_command.rb +203 -0
- data/lib/onyxcord/interactions/internal/message.rb +152 -0
- data/lib/onyxcord/interactions/internal/metadata.rb +109 -0
- data/lib/onyxcord/interactions/internal/option_builder.rb +230 -0
- data/lib/onyxcord/interactions/internal/permission_builder.rb +90 -0
- data/lib/onyxcord/interactions/option.rb +88 -0
- data/lib/onyxcord/interactions/registry.rb +50 -0
- data/lib/onyxcord/interactions.rb +16 -0
- data/lib/onyxcord/internal/async_runtime.rb +32 -0
- data/lib/onyxcord/internal/event_bus.rb +591 -0
- data/lib/onyxcord/internal/event_executor.rb +155 -0
- data/lib/onyxcord/internal/gateway/opcodes.rb +22 -0
- data/lib/onyxcord/internal/gateway/session.rb +45 -0
- data/lib/onyxcord/internal/http.rb +189 -0
- data/lib/onyxcord/internal/json.rb +51 -0
- data/lib/onyxcord/internal/message_payload.rb +78 -0
- data/lib/onyxcord/internal/rate_limiter/async_rest.rb +151 -0
- data/lib/onyxcord/internal/rate_limiter/gateway.rb +44 -0
- data/lib/onyxcord/internal/rate_limiter/rest.rb +144 -0
- data/lib/onyxcord/internal/upload.rb +39 -0
- data/lib/onyxcord/internal/websocket.rb +79 -0
- data/lib/onyxcord/light/data.rb +1 -1
- data/lib/onyxcord/light/integrations.rb +1 -1
- data/lib/onyxcord/light/light_bot.rb +7 -7
- data/lib/onyxcord/{data → models}/activity.rb +2 -2
- data/lib/onyxcord/{data → models}/application.rb +3 -3
- data/lib/onyxcord/{data → models}/avatar_decoration.rb +1 -1
- data/lib/onyxcord/{data → models}/channel.rb +23 -23
- data/lib/onyxcord/{data → models}/collectibles.rb +1 -1
- data/lib/onyxcord/{data → models}/emoji.rb +1 -1
- data/lib/onyxcord/models/interaction.rb +450 -0
- data/lib/onyxcord/{data → models}/invite.rb +1 -1
- data/lib/onyxcord/{data → models}/member.rb +11 -11
- data/lib/onyxcord/{data → models}/message.rb +22 -14
- data/lib/onyxcord/{data → models}/poll.rb +2 -2
- data/lib/onyxcord/{data → models}/primary_server.rb +1 -1
- data/lib/onyxcord/{data → models}/profile.rb +4 -4
- data/lib/onyxcord/{data → models}/role.rb +6 -12
- data/lib/onyxcord/{data → models}/scheduled_event.rb +5 -5
- data/lib/onyxcord/{data → models}/server.rb +41 -41
- data/lib/onyxcord/{data → models}/server_preview.rb +2 -2
- data/lib/onyxcord/{data → models}/team.rb +1 -1
- data/lib/onyxcord/{data → models}/user.rb +5 -5
- data/lib/onyxcord/{data → models}/webhook.rb +13 -11
- data/lib/onyxcord/models.rb +57 -0
- data/lib/onyxcord/{api.rb → rest/client.rb} +83 -27
- data/lib/onyxcord/{api → rest/routes}/application.rb +79 -57
- data/lib/onyxcord/rest/routes/channel/base.rb +73 -0
- data/lib/onyxcord/rest/routes/channel/groups.rb +78 -0
- data/lib/onyxcord/rest/routes/channel/messages.rb +130 -0
- data/lib/onyxcord/rest/routes/channel/permissions.rb +73 -0
- data/lib/onyxcord/rest/routes/channel/pins.rb +45 -0
- data/lib/onyxcord/rest/routes/channel/polls.rb +32 -0
- data/lib/onyxcord/rest/routes/channel/reactions.rb +86 -0
- data/lib/onyxcord/rest/routes/channel/threads.rb +176 -0
- data/lib/onyxcord/rest/routes/channel/webhooks.rb +47 -0
- data/lib/onyxcord/rest/routes/channel.rb +12 -0
- data/lib/onyxcord/{api/interaction.rb → rest/routes/interaction/base.rb} +10 -33
- data/lib/onyxcord/rest/routes/interaction/response.rb +24 -0
- data/lib/onyxcord/rest/routes/interaction.rb +4 -0
- data/lib/onyxcord/{api → rest/routes}/invite.rb +7 -7
- data/lib/onyxcord/rest/routes/server/admin.rb +174 -0
- data/lib/onyxcord/rest/routes/server/assets.rb +25 -0
- data/lib/onyxcord/rest/routes/server/bans.rb +67 -0
- data/lib/onyxcord/rest/routes/server/base.rb +77 -0
- data/lib/onyxcord/rest/routes/server/channels.rb +58 -0
- data/lib/onyxcord/rest/routes/server/emoji.rb +48 -0
- data/lib/onyxcord/rest/routes/server/members.rb +109 -0
- data/lib/onyxcord/rest/routes/server/messages.rb +19 -0
- data/lib/onyxcord/rest/routes/server/roles.rb +156 -0
- data/lib/onyxcord/rest/routes/server/scheduled_events.rb +86 -0
- data/lib/onyxcord/rest/routes/server.rb +12 -0
- data/lib/onyxcord/{api → rest/routes}/user.rb +23 -23
- data/lib/onyxcord/{api → rest/routes}/webhook.rb +30 -32
- data/lib/onyxcord/{allowed_mentions.rb → utils/allowed_mentions.rb} +9 -1
- data/lib/onyxcord/utils/timestamp.rb +69 -0
- data/lib/onyxcord/voice/{voice_bot.rb → client.rb} +4 -4
- data/lib/onyxcord/voice/encoder.rb +1 -1
- data/lib/onyxcord/voice/network/udp.rb +135 -0
- data/lib/onyxcord/voice/network/websocket.rb +225 -0
- data/lib/onyxcord/voice/network.rb +5 -357
- data/lib/onyxcord/webhooks/builder.rb +1 -1
- data/lib/onyxcord/webhooks/client.rb +13 -13
- data/lib/onyxcord/webhooks/modal/group_builder.rb +55 -0
- data/lib/onyxcord/webhooks/modal/label_builder.rb +183 -0
- data/lib/onyxcord/webhooks/modal.rb +2 -239
- data/lib/onyxcord/webhooks/version.rb +3 -3
- data/lib/onyxcord/webhooks/view/container_builder.rb +80 -0
- data/lib/onyxcord/webhooks/view/file_builder.rb +24 -0
- data/lib/onyxcord/webhooks/view/media_gallery_builder.rb +50 -0
- data/lib/onyxcord/webhooks/view/row_builder.rb +120 -0
- data/lib/onyxcord/webhooks/view/section_builder.rb +61 -0
- data/lib/onyxcord/webhooks/view/select_menu_builder.rb +77 -0
- data/lib/onyxcord/webhooks/view/separator_builder.rb +22 -0
- data/lib/onyxcord/webhooks/view/text_display_builder.rb +20 -0
- data/lib/onyxcord/webhooks/view.rb +9 -425
- data/lib/onyxcord.rb +106 -40
- metadata +208 -91
- data/.github/CONTRIBUTING.md +0 -13
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
- data/.github/pull_request_template.md +0 -37
- data/.github/workflows/ci.yml +0 -78
- data/.github/workflows/codeql.yml +0 -65
- data/.github/workflows/deploy.yml +0 -54
- data/.github/workflows/release.yml +0 -51
- data/.gitignore +0 -17
- data/.markdownlint.json +0 -4
- data/.overcommit.yml +0 -7
- data/.rspec +0 -2
- data/.rubocop.yml +0 -129
- data/.yardopts +0 -1
- data/CHANGELOG.md +0 -202
- data/Gemfile +0 -6
- data/LICENSE.txt +0 -21
- data/README.md +0 -448
- data/Rakefile +0 -13
- data/lib/onyxcord/api/channel.rb +0 -705
- data/lib/onyxcord/api/server.rb +0 -775
- data/lib/onyxcord/async/runtime.rb +0 -30
- data/lib/onyxcord/commands/command_bot.rb +0 -505
- data/lib/onyxcord/data/interaction.rb +0 -1143
- data/lib/onyxcord/data.rb +0 -57
- data/lib/onyxcord/event_executor.rb +0 -153
- data/lib/onyxcord/gateway.rb +0 -500
- data/lib/onyxcord/http.rb +0 -115
- data/lib/onyxcord/json.rb +0 -49
- data/lib/onyxcord/rate_limiter/async_rest.rb +0 -149
- data/lib/onyxcord/rate_limiter/gateway.rb +0 -42
- data/lib/onyxcord/rate_limiter/rest.rb +0 -142
- data/lib/onyxcord/version.rb +0 -7
- data/lib/onyxcord/websocket.rb +0 -77
- data/onyxcord.gemspec +0 -63
- /data/lib/onyxcord/{configuration.rb → core/configuration.rb} +0 -0
- /data/lib/onyxcord/{data → models}/attachment.rb +0 -0
- /data/lib/onyxcord/{data → models}/audit_logs.rb +0 -0
- /data/lib/onyxcord/{data → models}/call.rb +0 -0
- /data/lib/onyxcord/{data → models}/channel_tag.rb +0 -0
- /data/lib/onyxcord/{data → models}/component.rb +0 -0
- /data/lib/onyxcord/{data → models}/embed.rb +0 -0
- /data/lib/onyxcord/{data → models}/install_params.rb +0 -0
- /data/lib/onyxcord/{data → models}/integration.rb +0 -0
- /data/lib/onyxcord/{data → models}/message_activity.rb +0 -0
- /data/lib/onyxcord/{data → models}/overwrite.rb +0 -0
- /data/lib/onyxcord/{data → models}/reaction.rb +0 -0
- /data/lib/onyxcord/{data → models}/recipient.rb +0 -0
- /data/lib/onyxcord/{data → models}/role_connection_data.rb +0 -0
- /data/lib/onyxcord/{data → models}/role_subscription.rb +0 -0
- /data/lib/onyxcord/{data → models}/snapshot.rb +0 -0
- /data/lib/onyxcord/{data → models}/timestamp.rb +0 -0
- /data/lib/onyxcord/{data → models}/voice_region.rb +0 -0
- /data/lib/onyxcord/{data → models}/voice_state.rb +0 -0
- /data/lib/onyxcord/{colour_rgb.rb → utils/colour_rgb.rb} +0 -0
- /data/lib/onyxcord/{id_object.rb → utils/id_object.rb} +0 -0
- /data/lib/onyxcord/{message_components.rb → utils/message_components.rb} +0 -0
- /data/lib/onyxcord/{paginator.rb → utils/paginator.rb} +0 -0
- /data/lib/onyxcord/{permissions.rb → utils/permissions.rb} +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
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"
|
|
@@ -1,51 +0,0 @@
|
|
|
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
DELETED
data/.markdownlint.json
DELETED
data/.overcommit.yml
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--markup markdown --hide-tag todo --fail-on-warning
|
data/CHANGELOG.md
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 2.0.13 - 2026-06-28
|
|
4
|
-
|
|
5
|
-
### Correcoes de gateway
|
|
6
|
-
|
|
7
|
-
- Evita chamadas REST em `Bot#update_voice_state` ao processar `VOICE_STATE_UPDATE`.
|
|
8
|
-
- Torna `GUILD_UPDATE` tolerante a guild ainda nao cacheada.
|
|
9
|
-
|
|
10
|
-
## 2.0.12 - 2026-06-28
|
|
11
|
-
|
|
12
|
-
### Correcoes de gateway
|
|
13
|
-
|
|
14
|
-
- Evita chamadas REST durante a criação de eventos do Gateway para `VOICE_STATE_UPDATE` e `CHANNEL_CREATE`.
|
|
15
|
-
- Trata `Async::Cancel` durante dispatch do Gateway como cancelamento esperado, sem registrar erro fatal.
|
|
16
|
-
|
|
17
|
-
## 2.0.11 - 2026-06-28
|
|
18
|
-
|
|
19
|
-
### Correcoes de estabilidade
|
|
20
|
-
|
|
21
|
-
- Isola a sessao HTTP persistente por thread para evitar que tarefas em segundo plano disputem a mesma conexao REST das interacoes.
|
|
22
|
-
|
|
23
|
-
## 2.0.10 - 2026-06-28
|
|
24
|
-
|
|
25
|
-
### Correcoes de voz
|
|
26
|
-
|
|
27
|
-
- Mantem `channel_id` no cache de `VoiceState` mesmo quando o objeto do canal ainda nao foi resolvido.
|
|
28
|
-
- Expoe `channel_id` e `old_channel_id` em `VoiceStateUpdateEvent`, corrigindo entradas em call que pareciam `nil -> nil`.
|
|
29
|
-
- Permite que raw dispatch handlers filtrem pacotes com chaves string ou symbol.
|
|
30
|
-
|
|
31
|
-
## 2.0.9 - 2026-06-28
|
|
32
|
-
|
|
33
|
-
### Correcoes de estabilidade
|
|
34
|
-
|
|
35
|
-
- Tolera um heartbeat sem ACK antes de reconectar, evitando queda por ACK atrasado isolado.
|
|
36
|
-
|
|
37
|
-
## 2.0.8 - 2026-06-28
|
|
38
|
-
|
|
39
|
-
### Correcoes de gateway
|
|
40
|
-
|
|
41
|
-
- Forca WebSocket do Gateway e do cliente generico em HTTP/1.1 para evitar `Async::WebSocket::ConnectionError: Failed to negotiate connection!` ao conectar no Discord.
|
|
42
|
-
- Desativa extensoes WebSocket no handshake para evitar close `Error while decoding payload` no Gateway do Discord.
|
|
43
|
-
- Remove o empacotamento separado `onyxcord-webhooks`; webhooks continuam incluidos diretamente na gem `onyxcord`.
|
|
44
|
-
|
|
45
|
-
## 2.0.6 - 2026-06-28
|
|
46
|
-
|
|
47
|
-
### Correcoes de empacotamento
|
|
48
|
-
|
|
49
|
-
- Incluidos na gem os arquivos da infraestrutura async que ficaram fora do pacote `2.0.5`: `onyxcord/async/runtime` e `onyxcord/rate_limiter/async_rest`.
|
|
50
|
-
- Incluidos na gem os arquivos da DSL moderna de application commands: `onyxcord/application_commands` e seus componentes internos.
|
|
51
|
-
- Corrige `LoadError: cannot load such file -- onyxcord/async/runtime` ao usar a gem publicada.
|
|
52
|
-
|
|
53
|
-
## 2.0.5 - 2026-06-28
|
|
54
|
-
|
|
55
|
-
### Async Runtime (Infraestrutura nao-bloqueante)
|
|
56
|
-
|
|
57
|
-
- **`OnyxCord::AsyncRuntime`**: modulo central que gerencia o reactor `async` com `run`, `async` e `sleep`, reaproveitando reactor existente quando disponivel.
|
|
58
|
-
- **`EventExecutor::AsyncPool`**: novo pool de workers baseado em `Async::Queue` e fibers, sem threads.
|
|
59
|
-
- **Gateway**: `run_async` nao cria mais `Thread.new` — usa `@task = AsyncRuntime.async { run }`. Todos os `sleep` trocados por `AsyncRuntime.sleep`.
|
|
60
|
-
- **WebSocket**: usa `AsyncRuntime.async` em vez de `Async do` solto na classe.
|
|
61
|
-
- **API REST**: `request` agora delega para `request_async` automaticamente quando dentro de um reactor. `request_async` usa rate limiter async, `AsyncRuntime.sleep`, e retry com limite em 502.
|
|
62
|
-
- **Rate Limiter Async**: novo `OnyxCord::RateLimiter::AsyncRest` que evita `mutex.synchronize { sleep }` bloqueante.
|
|
63
|
-
- **Bot**: `run`/`stop`/`join` refatorados para o runtime async. `send_temporary_message` e `voice_connect` usam sleeps async.
|
|
64
|
-
- Compatibilidade sync mantida: a API publica continua funcionando de forma sincrona quando chamada fora de um reactor.
|
|
65
|
-
|
|
66
|
-
### Modern Application Commands DSL
|
|
67
|
-
|
|
68
|
-
- **`bot.slash`, `bot.user_command`, `bot.message_command`**: nova DSL para comandos modernos com definicao e handler unificados.
|
|
69
|
-
- **`bot.sync_application_commands!`**: sincroniza todos os commands registrados com a API do Discord de uma vez.
|
|
70
|
-
- **`bot.bulk_overwrite_global_application_commands`** e **`bot.bulk_overwrite_guild_application_commands`**: wrappers para bulk overwrite.
|
|
71
|
-
- **`ApplicationCommands::Context`**: wrapper com `respond`, `defer`, `edit_original`, `delete_original`, `followup` e acesso a `options`, `guild`, `channel`, `user`.
|
|
72
|
-
- **`Interaction#edit_original`**, **`Interaction#delete_original`**, **`Interaction#followup`**: novos aliases dos metodos originais.
|
|
73
|
-
- API legacy (`register_application_command` + `application_command`) mantida com compatibilidade total.
|
|
74
|
-
|
|
75
|
-
### Exemplo da nova DSL
|
|
76
|
-
|
|
77
|
-
```ruby
|
|
78
|
-
bot.slash :ban, description: "Bane um membro", default_member_permissions: [:ban_members] do
|
|
79
|
-
user :member, "Membro que sera banido", required: true
|
|
80
|
-
string :reason, "Motivo do banimento", max_length: 512
|
|
81
|
-
|
|
82
|
-
execute do |ctx|
|
|
83
|
-
ctx.defer(ephemeral: true)
|
|
84
|
-
member = ctx.options[:member]
|
|
85
|
-
reason = ctx.options[:reason] || "Sem motivo informado"
|
|
86
|
-
ctx.guild.ban(member, reason: reason)
|
|
87
|
-
ctx.edit_original(content: "Membro banido com sucesso.")
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
bot.sync_application_commands!(server_id: ENV.fetch('DISCORD_SERVER_ID'))
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Validacao
|
|
95
|
-
|
|
96
|
-
- `bundle exec rspec`: 460 exemplos, 0 falhas, 3 pendentes.
|
|
97
|
-
- `ruby -c lib/onyxcord/**/*.rb`: todos os arquivos com sintaxe OK.
|
|
98
|
-
- `gem build onyxcord.gemspec`: sucesso.
|
|
99
|
-
|
|
100
|
-
## 2.0.0 - 2026-06-28
|
|
101
|
-
|
|
102
|
-
### Arquitetura & Performance (Major Refactoring)
|
|
103
|
-
|
|
104
|
-
- **Runtime 100% Async**: A infraestrutura de threads (`Thread.new`) foi substituída pelo modelo de fibers do Ruby usando a gem `async`. Gateway, heartbeats, fila REST, worker de eventos e comandos agora executam de forma não-bloqueante no reator Async.
|
|
105
|
-
- **REST Moderno via HTTPX**: Substituída a gem legada `rest-client` pela `httpx`, trazendo suporte nativo a conexões persistentes (Keep-Alive), HTTP/2, multipart uploads nativos e retries automáticos em erros 502.
|
|
106
|
-
- **Gateway via Async-WebSocket**: Substituída a implementação de raw TCP sockets + `websocket-client-simple` por `async-websocket`, proporcionando um event loop de gateway extremamente rápido e escalável.
|
|
107
|
-
- **Parse JSON via Oj**: A gem `oj` foi integrada em modo de compatibilidade (`mode: :compat`), acelerando transparentemente todas as serializações e deserializações de pacotes do Discord na lib inteira.
|
|
108
|
-
- **Cache Inteligente LRU**: Os caches em memória (usuários, canais, servidores, membros) agora utilizam `LruRedux::ThreadSafeCache`. Os tamanhos padrão foram aumentados (`users: 50_000`, `channels: 10_000`, `servers: 1_000`, `members: 100_000`) e podem ser customizados via `OnyxCord.configure { |c| c.cache_sizes.users = 100_000 }`.
|
|
109
|
-
- **Fusão do Webhooks**: A funcionalidade da gem separada `onyxcord-webhooks` foi integrada diretamente no núcleo da gem `onyxcord`; nao ha mais pacote separado para publicar.
|
|
110
|
-
- **Alvo Ruby ≥ 3.4**: Atualizada a versão mínima requerida do Ruby para aproveitar as otimizações modernas do interpretador e fibras.
|
|
111
|
-
|
|
112
|
-
## 1.1.8 - 2026-06-28
|
|
113
|
-
|
|
114
|
-
### Correcoes
|
|
115
|
-
|
|
116
|
-
- `Components::Label` agora delega `custom_id`, `value` e `values` para o componente interativo interno, mantendo compatibilidade com codigo legado de modal que itera por `event.components`.
|
|
117
|
-
- Modais modernos continuam preservando `label`, `description` e `component`, enquanto `event.value(custom_id)`, `event.values(custom_id)` e acesso direto em `event.components` funcionam de forma consistente.
|
|
118
|
-
|
|
119
|
-
### Validacao
|
|
120
|
-
|
|
121
|
-
- `bundle exec rspec spec/components_v2_spec.rb`: sucesso.
|
|
122
|
-
- `bundle exec rspec`: 460 exemplos, 0 falhas, 3 pendentes.
|
|
123
|
-
- `ruby -c lib/onyxcord/data/component.rb`: sucesso.
|
|
124
|
-
- `ruby -c spec/components_v2_spec.rb`: sucesso.
|
|
125
|
-
- `gem build onyxcord.gemspec`: sucesso.
|
|
126
|
-
|
|
127
|
-
## 1.1.7 - 2026-06-28
|
|
128
|
-
|
|
129
|
-
### Melhorias
|
|
130
|
-
|
|
131
|
-
- Atualizada a descricao publicada no RubyGems para mostrar o convite da comunidade Discord: `https://discord.gg/Jy2tpCUtzM`.
|
|
132
|
-
- README mantem as secoes em ingles, portugues e espanhol com o link da comunidade.
|
|
133
|
-
|
|
134
|
-
### Validacao
|
|
135
|
-
|
|
136
|
-
- `ruby -c onyxcord.gemspec`: sucesso.
|
|
137
|
-
|
|
138
|
-
## 1.1.6 - 2026-06-28
|
|
139
|
-
|
|
140
|
-
### Melhorias
|
|
141
|
-
|
|
142
|
-
- Adicionado suporte aos novos componentes de modal do Discord: `Label`, `File Upload`, `Radio Group`, `Checkbox Group` e `Checkbox`.
|
|
143
|
-
- Modais agora preservam o `id` do componente `Label` ao gerar o payload.
|
|
144
|
-
- Parser de componentes agora expoe `label` e `description` em `Components::Label`.
|
|
145
|
-
|
|
146
|
-
### Validacao
|
|
147
|
-
|
|
148
|
-
- `bundle exec rspec spec/components_v2_spec.rb`: 15 exemplos, 0 falhas.
|
|
149
|
-
- `ruby -c lib/onyxcord/webhooks/modal.rb`: sucesso.
|
|
150
|
-
- `ruby -c lib/onyxcord/data/component.rb`: sucesso.
|
|
151
|
-
- `ruby -c spec/components_v2_spec.rb`: sucesso.
|
|
152
|
-
|
|
153
|
-
## 1.1.5 - 2026-06-28
|
|
154
|
-
|
|
155
|
-
### Melhorias
|
|
156
|
-
|
|
157
|
-
- Attachment uploads agora enviam metadata (`id`, `filename`) no payload JSON e usam chaves `files[N]` no multipart body, seguindo a especificacao da API do Discord.
|
|
158
|
-
- Novos helpers `attachment_payload` e `multipart_body` adicionados nativamente em `API::Channel`, `API::Interaction` e `API::Webhook`.
|
|
159
|
-
- Metodos afetados: `Channel.create_message`, `Channel.start_thread_in_forum_or_media_channel`, `Interaction.create_interaction_response`, `Webhook.token_edit_message` e `Webhook.token_execute_webhook`.
|
|
160
|
-
|
|
161
|
-
### Correcoes
|
|
162
|
-
|
|
163
|
-
- Corrigido `Channel.create_message` para sanitizar o parametro `tts`, forçando `false` quando o valor nao e booleano.
|
|
164
|
-
|
|
165
|
-
## 1.1.4 - 2026-06-28
|
|
166
|
-
|
|
167
|
-
### Melhorias
|
|
168
|
-
|
|
169
|
-
- `MediaGallery` agora aceita URLs diretas e hashes no builder, como `media_gallery('https://...')`, alem do formato em bloco.
|
|
170
|
-
- `FileComponent`/`file_display` agora aceita a URL do attachment como primeiro argumento, como `file_display('attachment://arquivo.txt')`.
|
|
171
|
-
|
|
172
|
-
### Correcoes
|
|
173
|
-
|
|
174
|
-
- Parser de `MediaGallery` e `FileUpload` ficou mais tolerante quando o payload nao traz `items` ou `values`.
|
|
175
|
-
|
|
176
|
-
### Validacao
|
|
177
|
-
|
|
178
|
-
- `bundle exec rspec spec/components_v2_spec.rb`: 13 exemplos, 0 falhas.
|
|
179
|
-
|
|
180
|
-
## 1.1.3 - 2026-06-23
|
|
181
|
-
|
|
182
|
-
### Melhorias
|
|
183
|
-
|
|
184
|
-
- Alterado o modo padrao do bot para `:hybrid`, mantendo suporte a handlers raw e eventos em objeto sem configuracao extra.
|
|
185
|
-
- Adicionado `event_queue_size` para permitir fila de eventos com limite via `SizedQueue`.
|
|
186
|
-
- Application commands agora usam o `EventExecutor`, evitando criacao direta de threads por interaction.
|
|
187
|
-
- Adicionados `runtime_stats`, `cache_stats`, `prune_cache!` e `OnyxCord::API.rate_limiter_stats` para diagnostico de memoria e runtime.
|
|
188
|
-
- Rate limiter REST agora expoe `stats`, `prune!` e limpeza automatica de bookkeeping antigo.
|
|
189
|
-
- Voice recebeu limpeza mais segura de UDP, WebSocket, threads e leitura DCA com fechamento garantido de arquivo.
|
|
190
|
-
- Dependencias principais receberam upper bounds conservadores para reduzir risco de quebra em releases futuras.
|
|
191
|
-
|
|
192
|
-
### Correcoes
|
|
193
|
-
|
|
194
|
-
- Corrigido retry de respostas REST `202` para reutilizar a rota e o major parameter originais.
|
|
195
|
-
- Removidos logs temporarios de interaction no caminho quente de dispatch.
|
|
196
|
-
- Corrigido warning de spec causado por expectativa em cache de usuarios nulo.
|
|
197
|
-
|
|
198
|
-
### Validacao
|
|
199
|
-
|
|
200
|
-
- `bundle exec rspec`: 456 exemplos, 0 falhas, 3 pendentes.
|
|
201
|
-
- RuboCop nos arquivos alterados: sem offenses.
|
|
202
|
-
- `gem build onyxcord.gemspec`: sucesso.
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|