discord_rda 0.1.3 → 0.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/README.md +63 -0
- data/lib/discord_rda/bot.rb +1223 -61
- data/lib/discord_rda/cache/store.rb +2 -0
- data/lib/discord_rda/connection/gateway_client.rb +12 -2
- data/lib/discord_rda/connection/rest_client.rb +10 -1
- data/lib/discord_rda/connection/rest_proxy.rb +5 -1
- data/lib/discord_rda/connection/shard_manager.rb +10 -1
- data/lib/discord_rda/core/configuration.rb +65 -2
- data/lib/discord_rda/core/error_tracker.rb +22 -0
- data/lib/discord_rda/core/execution_supervisor.rb +180 -0
- data/lib/discord_rda/core/logger.rb +17 -3
- data/lib/discord_rda/core/restart_manager.rb +83 -0
- data/lib/discord_rda/core/secrets.rb +30 -0
- data/lib/discord_rda/core/snowflake.rb +1 -1
- data/lib/discord_rda/core/tracer.rb +41 -0
- data/lib/discord_rda/entity/base.rb +10 -3
- data/lib/discord_rda/entity/message_builder.rb +2 -0
- data/lib/discord_rda/entity/support.rb +287 -0
- data/lib/discord_rda/event/base.rb +258 -7
- data/lib/discord_rda/interactions/application_command.rb +44 -6
- data/lib/discord_rda/interactions/interaction.rb +12 -0
- data/lib/discord_rda/persistence/active_record.rb +72 -0
- data/lib/discord_rda/plugin/analytics_plugin.rb +64 -2
- data/lib/discord_rda/version.rb +1 -1
- data/lib/discord_rda.rb +6 -0
- metadata +64 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d960d7a22ca5c98ca29977ef83f97a4f4e3c21356d824f4ab444cd32784d946a
|
|
4
|
+
data.tar.gz: e2582c65742fc5d336b8a0b3456ca2ecc9c6d40f93fbd85e6448583a4757305a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a39158b307ed8d71bd6ca5ddbe2a12e375ef138faef0c64ee615dda22e61d41ef52c5e2ef8841c1940bef440208e46a06c9c2a73fba2dd05635158eea26d980
|
|
7
|
+
data.tar.gz: 94f2dc665860f7d34d9719e58111420d5b841d5abe77b32768e0d8115f68ca662f776288a0dd22e6cd42ee9b9514ddd4168d212f311086b05775bb66307f63f7
|
data/README.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
DiscordRDA (Ruby Development API) is a high-performance Ruby library for building Discord bots with modern async patterns, comprehensive Slash Command support, Component V2 architecture, and enterprise-grade scalability features.
|
|
9
9
|
|
|
10
|
+
The library now exposes a much broader Discord REST surface than the original quick-start examples show, including thread lifecycle helpers, webhook message management, invite creation, guild widget and onboarding endpoints, and current-user OAuth2 convenience methods.
|
|
11
|
+
|
|
10
12
|
## Features
|
|
11
13
|
|
|
12
14
|
### Core Capabilities
|
|
@@ -26,11 +28,20 @@ DiscordRDA (Ruby Development API) is a high-performance Ruby library for buildin
|
|
|
26
28
|
- **Component V2**: Latest Discord components (buttons, selects, containers)
|
|
27
29
|
|
|
28
30
|
### Enterprise Features
|
|
31
|
+
- **Instant Restarts**: Exec-based restart flow that preserves gateway resume state
|
|
29
32
|
- **Zero-Downtime Resharding**: Add shards without stopping the bot
|
|
30
33
|
- **Hot Reload**: File system event-based code reloading
|
|
31
34
|
- **Session Transfer**: Migrate guilds between shards seamlessly
|
|
32
35
|
- **REST Proxy Support**: Horizontal scaling with proxy servers
|
|
33
36
|
- **State Preservation**: Maintain sessions across reloads
|
|
37
|
+
- **Execution Supervision**: Command timeouts, concurrency limits, and failure circuit breaking
|
|
38
|
+
|
|
39
|
+
### Extended REST Coverage
|
|
40
|
+
- **Threads**: Create, join, leave, archive, and manage thread members
|
|
41
|
+
- **Webhooks**: Fetch, mutate, and edit webhook-owned messages
|
|
42
|
+
- **Guild Admin**: Invites, prune, widget, vanity URL, welcome screen, onboarding
|
|
43
|
+
- **Current User**: DM creation, guild listing, connections, role connections
|
|
44
|
+
- **Persistence**: Built-in ActiveRecord bootstrap and migration helpers
|
|
34
45
|
|
|
35
46
|
## Installation
|
|
36
47
|
|
|
@@ -142,6 +153,58 @@ bot.context_menu(type: :user, name: 'High Five') do |interaction|
|
|
|
142
153
|
end
|
|
143
154
|
```
|
|
144
155
|
|
|
156
|
+
## REST Helpers
|
|
157
|
+
|
|
158
|
+
```ruby
|
|
159
|
+
# Create a thread from a message
|
|
160
|
+
thread = bot.start_thread_from_message(
|
|
161
|
+
channel_id,
|
|
162
|
+
message_id,
|
|
163
|
+
name: 'incident-review',
|
|
164
|
+
auto_archive_duration: 1440
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
# Create a channel invite with the DSL builder
|
|
168
|
+
invite = bot.create_channel_invite(channel_id) do |builder|
|
|
169
|
+
builder.max_age(3600).max_uses(5).temporary
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Edit a webhook message
|
|
173
|
+
bot.edit_webhook_message(webhook_id, webhook_token, message_id, content: 'Updated from DiscordRDA')
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Resilience
|
|
177
|
+
|
|
178
|
+
```ruby
|
|
179
|
+
bot.slash('rebuild', 'Run a risky rebuild task') do |cmd|
|
|
180
|
+
cmd.timeout(10)
|
|
181
|
+
cmd.max_concurrency(1)
|
|
182
|
+
cmd.circuit_breaker(failures: 3, cooldown: 120)
|
|
183
|
+
|
|
184
|
+
cmd.handler do |interaction|
|
|
185
|
+
interaction.respond(content: 'Started safely', ephemeral: true)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# For memory-bound or untrusted work, use an isolated subprocess:
|
|
190
|
+
result = bot.supervisor.run_isolated(
|
|
191
|
+
ruby_code: "puts({ ok: true }.to_json)",
|
|
192
|
+
timeout_seconds: 5,
|
|
193
|
+
memory_limit_mb: 128
|
|
194
|
+
)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## ActiveRecord
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
bot.enable_active_record(database_url: ENV['DATABASE_URL'])
|
|
201
|
+
|
|
202
|
+
class GuildSetting < DiscordRDA::Record
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
bot.active_record.migrate
|
|
206
|
+
```
|
|
207
|
+
|
|
145
208
|
## Components
|
|
146
209
|
|
|
147
210
|
### Button Components
|