disrb 0.1.4.1 → 0.1.4.2
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/CHANGELOG.md +6 -0
- data/LICENSE +9 -5
- data/LICENSES/ISC.txt +5 -0
- data/LICENSES/MIT.txt +9 -0
- data/LICENSES/Unlicense.txt +10 -0
- data/README.md +20 -17
- data/lib/disrb.rb +8 -8
- data/lib/version.rb +2 -2
- metadata +10 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 720c2445e006449cf781790fe5e00fd9e08f16131c6f53e5b87463b165925d63
|
|
4
|
+
data.tar.gz: 38ea74986b2de4adf369de1fee414f8a7cdcc3e71614655b14519e49d72f95af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 922b62106b7fc15fbeb04c1ce4736f4c5c50fbd83f1012777ae11eab3f92b466d6c10ce6e5575151e3cd31a7f38fce79ebbff97a4fcbd521a10878efd3d00e9b
|
|
7
|
+
data.tar.gz: 17811d9847cc46ff504553d7484b1c33b944d1c3dc3c2a5f06c933ddfd589c562d5760ad63e22cd648e83294ee0b31abbfaad1256e89c05a4530c91ca599097a
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
Unlicense OR MIT OR ISC
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This software is available under any of the following licenses, at your choice:
|
|
4
|
+
- The Unlicense, available at LICENSES/Unlicense.txt in this source code repository, or at
|
|
5
|
+
https://unlicense.org
|
|
6
|
+
- The MIT license, available at LICENSES/MIT.txt in this source code repository, or at
|
|
7
|
+
https://spdx.org/licenses/MIT.txt
|
|
8
|
+
- The ISC license, available at LICENSES/ISC.txt in this source code repository, or at
|
|
9
|
+
https://spdx.org/licenses/ISC.txt
|
|
4
10
|
|
|
5
|
-
The
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
11
|
+
The copyright year is 2026, and the current copyright holder is hoovad.
|
data/LICENSES/ISC.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Copyright (c) 2026 hoovad
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
+
|
|
5
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
data/LICENSES/MIT.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hoovad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
|
|
4
|
+
|
|
5
|
+
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and
|
|
6
|
+
successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
9
|
+
|
|
10
|
+
For more information, please refer to <http://unlicense.org/>
|
data/README.md
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# disrb indev
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[](https://rubygems.org/gems/disrb)
|
|
5
|
-

|
|
6
|
-
[](https://github.com/hoovad/discord.rb/actions/workflows/main.yml)
|
|
3
|
+
[Changelog](CHANGELOG.md) | [Documentation](https://www.rubydoc.info/gems/disrb/)
|
|
7
4
|
|
|
8
|
-
[Changelog](CHANGELOG.md) | [Documentation](https://www.rubydoc.info/gems/disrb/) | [Contributing](CONTRIBUTING.md)
|
|
9
|
-
|
|
10
|
-
> [!IMPORTANT]
|
|
11
5
|
> This is project is still in early development. Expect changes that might break your code at any time. If your code suddenly doesn't work but it did on a previous version, check the [Changelog](CHANGELOG.md) for any breaking changes.
|
|
12
6
|
|
|
13
7
|
W.I.P. Discord API wrapper written in Ruby for fun.
|
|
14
8
|
|
|
15
|
-
> [!NOTE]
|
|
16
9
|
> This is not a full-featured Discord API handler. This gem lets you interact with the Discord API directly without all the baggage. If you want to make a bot extremely easily, this is not what you are looking for.
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Demonstration
|
|
11
|
+
Please send patches to [~hoovad/public-inbox@lists.sr.ht](mailto:~hoovad/public-inbox@lists.sr.ht). For more info, see <https://git-send-email.io>.
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
You may also submit questions or discussions to the same above email. Configure your email client to send emails in plain text format: <https://useplaintext.email/>
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
> You will need to fill out the required data in `env.rb.template` and rename it to `env.rb` before running `test.rb`.
|
|
15
|
+
Submit issues, feature requests and enhancements to <https://todo.sr.ht/~hoovad/disrb>.
|
|
26
16
|
|
|
27
17
|
## How to use this project
|
|
28
18
|
|
|
@@ -32,7 +22,6 @@ Most functions in this library return a `Faraday::Response` object. Check the [F
|
|
|
32
22
|
|
|
33
23
|
If you want to get the contents of the response, use the `body` instance method (example: `[Faraday::Response object here].body`). The contents will most likely be JSON. To convert it to a Ruby object, use `JSON.parse([Faraday::Response object here].body)` (with `require 'json'` of course).
|
|
34
24
|
|
|
35
|
-
> [!TIP]
|
|
36
25
|
> When reading the documentation, there most likely will be a link to the relevant Discord Developer Documentation page. Please read that page as well, it will contain information that may help you.
|
|
37
26
|
|
|
38
27
|
## Roadmap
|
|
@@ -59,4 +48,18 @@ If you want to get the contents of the response, use the `body` instance method
|
|
|
59
48
|
- [ ] Add parameter validation
|
|
60
49
|
- [ ] Stable release (v1.0.0)
|
|
61
50
|
- [ ] Return classes instead of `Faraday::Response` objects
|
|
62
|
-
- [ ] Bugfixes, consistency and improvements
|
|
51
|
+
- [ ] Bugfixes, consistency and improvements
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
> You will need to create a Discord bot and fill out the required data in `env.rb.template` and rename it to `env.rb` before running any examples.
|
|
56
|
+
|
|
57
|
+
Currently the only example program can be found at [examples/test.rb](examples/test.rb), and it does the following:
|
|
58
|
+
|
|
59
|
+
- Creates three commands:
|
|
60
|
+
- "test", bot responds with "Hi!"
|
|
61
|
+
- "test2", bot responds with "Hello World!"
|
|
62
|
+
- "file", bot responds with a file containing "Hello World in a file!"
|
|
63
|
+
- Sets the bot's current activity to "Watching if i work"
|
|
64
|
+
- Bot's presence to online since program start
|
|
65
|
+
- Reply to a message mentioning the bot with "pong"
|
data/lib/disrb.rb
CHANGED
|
@@ -67,7 +67,7 @@ class DiscordApi
|
|
|
67
67
|
# @param verbosity_level [String, Integer, nil] The verbosity level of the logger.
|
|
68
68
|
# @param user_agent [String, nil] When sending a request to Discord's HTTP API, a valid User-Agent header must be set.
|
|
69
69
|
# By setting this parameter, the value of the User-Agent header sent will be equal to the value of this parameter.
|
|
70
|
-
# Defaults to '
|
|
70
|
+
# Defaults to 'disrb (https://sr.ht/~hoovad/disrb/, [disrb version])'
|
|
71
71
|
# Set verbosity_level to:
|
|
72
72
|
# - 'all' or 5 to log all of the below plus debug messages
|
|
73
73
|
# - 'info', 4 or nil to log all of the below plus info messages [DEFAULT]
|
|
@@ -114,7 +114,7 @@ class DiscordApi
|
|
|
114
114
|
@verbosity_level = 4
|
|
115
115
|
end
|
|
116
116
|
@logger = Logger2.new(@verbosity_level)
|
|
117
|
-
default_user_agent = "
|
|
117
|
+
default_user_agent = "disrb (https://sr.ht/~hoovad/disrb/, #{DiscordApi::VERSION})"
|
|
118
118
|
if user_agent.is_a?(String) && !user_agent.empty?
|
|
119
119
|
@user_agent = user_agent
|
|
120
120
|
elsif user_agent.nil?
|
|
@@ -164,8 +164,8 @@ class DiscordApi
|
|
|
164
164
|
# https://discord.com/developers/docs/topics/gateway#resume
|
|
165
165
|
# @param activities [Hash, Array, nil] Activity or list of activities to set in presence.
|
|
166
166
|
# @param os [String, nil] OS name reported to the Gateway. Host OS if nil.
|
|
167
|
-
# @param browser [String, nil] Browser/client name reported to the Gateway. "
|
|
168
|
-
# @param device [String, nil] Device name reported to the Gateway. "
|
|
167
|
+
# @param browser [String, nil] Browser/client name reported to the Gateway. "disrb" if nil.
|
|
168
|
+
# @param device [String, nil] Device name reported to the Gateway. "disrb" if nil
|
|
169
169
|
# @param intents [Integer, nil] Bitwise Gateway intents integer.
|
|
170
170
|
# @param presence_since [Integer, TrueClass, nil] Unix ms timestamp or true for since value in presence.
|
|
171
171
|
# @param presence_status [String, nil] Presence status (e.g., "online", "idle", "dnd").
|
|
@@ -224,11 +224,11 @@ class DiscordApi
|
|
|
224
224
|
os = nil
|
|
225
225
|
end
|
|
226
226
|
unless browser.is_a?(String) || browser.nil?
|
|
227
|
-
@logger.error("Invalid browser: #{browser}. Expected a String. Defaulting to '
|
|
227
|
+
@logger.error("Invalid browser: #{browser}. Expected a String. Defaulting to 'disrb'.")
|
|
228
228
|
browser = nil
|
|
229
229
|
end
|
|
230
230
|
unless device.is_a?(String) || device.nil?
|
|
231
|
-
@logger.error("Invalid device: #{device}. Expected a String. Defaulting to '
|
|
231
|
+
@logger.error("Invalid device: #{device}. Expected a String. Defaulting to 'disrb'.")
|
|
232
232
|
device = nil
|
|
233
233
|
end
|
|
234
234
|
unless (intents.is_a?(Integer) && intents >= 0 && intents <= 131_071) || intents.nil?
|
|
@@ -273,8 +273,8 @@ class DiscordApi
|
|
|
273
273
|
identify[:d][:intents] = intents || 513
|
|
274
274
|
identify[:d][:properties] = {}
|
|
275
275
|
identify[:d][:properties][:os] = os || RbConfig::CONFIG['host_os']
|
|
276
|
-
identify[:d][:properties][:browser] = browser || '
|
|
277
|
-
identify[:d][:properties][:device] = device || '
|
|
276
|
+
identify[:d][:properties][:browser] = browser || 'disrb'
|
|
277
|
+
identify[:d][:properties][:device] = device || 'disrb'
|
|
278
278
|
if !activities.nil? || !presence_since.nil? || !presence_status.nil? || !presence_afk.nil?
|
|
279
279
|
identify[:d][:presence] = {}
|
|
280
280
|
identify[:d][:presence][:activities] = activities unless activities.nil?
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: disrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.4.
|
|
4
|
+
version: 0.1.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hoovad
|
|
@@ -121,16 +121,18 @@ dependencies:
|
|
|
121
121
|
- - ">="
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
123
|
version: 0.26.0
|
|
124
|
-
description:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
email: hoovad@proton.me
|
|
124
|
+
description: disrb is a Ruby library that allows you to interact with the Discord
|
|
125
|
+
API.
|
|
126
|
+
email: hoovad@purelymail.com
|
|
128
127
|
executables: []
|
|
129
128
|
extensions: []
|
|
130
129
|
extra_rdoc_files: []
|
|
131
130
|
files:
|
|
132
131
|
- CHANGELOG.md
|
|
133
132
|
- LICENSE
|
|
133
|
+
- LICENSES/ISC.txt
|
|
134
|
+
- LICENSES/MIT.txt
|
|
135
|
+
- LICENSES/Unlicense.txt
|
|
134
136
|
- README.md
|
|
135
137
|
- lib/disrb.rb
|
|
136
138
|
- lib/disrb/application_commands.rb
|
|
@@ -139,9 +141,11 @@ files:
|
|
|
139
141
|
- lib/disrb/message.rb
|
|
140
142
|
- lib/disrb/user.rb
|
|
141
143
|
- lib/version.rb
|
|
142
|
-
homepage: https://
|
|
144
|
+
homepage: https://sr.ht/~hoovad/disrb/
|
|
143
145
|
licenses:
|
|
146
|
+
- Unlicense
|
|
144
147
|
- MIT
|
|
148
|
+
- ISC
|
|
145
149
|
metadata: {}
|
|
146
150
|
rdoc_options: []
|
|
147
151
|
require_paths:
|