lib_discord 0.1.3 → 1.0.1
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/CONTRIBUTING.md +88 -0
- data/README.md +40 -67
- data/lib/lib_discord/client.rb +2667 -138
- data/lib/lib_discord/formatter.rb +108 -0
- data/lib/lib_discord/maps.rb +730 -0
- data/lib/lib_discord/permissions.rb +84 -0
- data/lib/lib_discord/urls.rb +9 -15
- data/lib/lib_discord/version.rb +1 -4
- data/lib/lib_discord.rb +3 -5
- metadata +12 -120
- data/CHANGELOG.md +0 -152
- data/lib/lib_discord/application.rb +0 -43
- data/lib/lib_discord/application_command.rb +0 -341
- data/lib/lib_discord/application_role_connection_metadata.rb +0 -52
- data/lib/lib_discord/audit_log.rb +0 -36
- data/lib/lib_discord/auto_moderation.rb +0 -106
- data/lib/lib_discord/channel.rb +0 -716
- data/lib/lib_discord/emoji.rb +0 -106
- data/lib/lib_discord/errors.rb +0 -31
- data/lib/lib_discord/guild.rb +0 -830
- data/lib/lib_discord/guild_scheduled_event.rb +0 -133
- data/lib/lib_discord/guild_template.rb +0 -128
- data/lib/lib_discord/interaction.rb +0 -163
- data/lib/lib_discord/invite.rb +0 -47
- data/lib/lib_discord/mappers/application_command_option_types.rb +0 -22
- data/lib/lib_discord/mappers/application_command_permission_types.rb +0 -14
- data/lib/lib_discord/mappers/application_command_types.rb +0 -14
- data/lib/lib_discord/mappers/application_integration_types.rb +0 -13
- data/lib/lib_discord/mappers/application_role_connection_metadata_types.rb +0 -19
- data/lib/lib_discord/mappers/audit_log_events.rb +0 -67
- data/lib/lib_discord/mappers/auto_moderation_action_types.rb +0 -14
- data/lib/lib_discord/mappers/auto_moderation_event_types.rb +0 -12
- data/lib/lib_discord/mappers/auto_moderation_keyword_preset_types.rb +0 -14
- data/lib/lib_discord/mappers/auto_moderation_trigger_types.rb +0 -15
- data/lib/lib_discord/mappers/channel_forum_layout_types.rb +0 -14
- data/lib/lib_discord/mappers/channel_message_activity_types.rb +0 -15
- data/lib/lib_discord/mappers/channel_message_types.rb +0 -42
- data/lib/lib_discord/mappers/channel_sort_order_types.rb +0 -13
- data/lib/lib_discord/mappers/channel_types.rb +0 -24
- data/lib/lib_discord/mappers/channel_video_quality_modes.rb +0 -13
- data/lib/lib_discord/mappers/guild_default_message_notification_levels.rb +0 -13
- data/lib/lib_discord/mappers/guild_explicit_content_filter_levels.rb +0 -14
- data/lib/lib_discord/mappers/guild_integration_expire_behaviors.rb +0 -13
- data/lib/lib_discord/mappers/guild_mfa_levels.rb +0 -13
- data/lib/lib_discord/mappers/guild_nsfw_levels.rb +0 -15
- data/lib/lib_discord/mappers/guild_onboarding_modes.rb +0 -13
- data/lib/lib_discord/mappers/guild_premium_tiers.rb +0 -15
- data/lib/lib_discord/mappers/guild_prompt_types.rb +0 -13
- data/lib/lib_discord/mappers/guild_scheduled_event_entity_types.rb +0 -14
- data/lib/lib_discord/mappers/guild_scheduled_event_privacy_levels.rb +0 -12
- data/lib/lib_discord/mappers/guild_scheduled_event_statuses.rb +0 -15
- data/lib/lib_discord/mappers/guild_verification_levels.rb +0 -16
- data/lib/lib_discord/mappers/interaction_callback_types.rb +0 -19
- data/lib/lib_discord/mappers/interaction_context_types.rb +0 -14
- data/lib/lib_discord/mappers/interaction_types.rb +0 -16
- data/lib/lib_discord/mappers/invite_target_types.rb +0 -13
- data/lib/lib_discord/mappers/message_component_button_styles.rb +0 -16
- data/lib/lib_discord/mappers/message_component_text_input_styles.rb +0 -13
- data/lib/lib_discord/mappers/message_component_types.rb +0 -19
- data/lib/lib_discord/mappers/poll_layout_types.rb +0 -12
- data/lib/lib_discord/mappers/stage_instance_privacy_levels.rb +0 -13
- data/lib/lib_discord/mappers/sticker_format_types.rb +0 -15
- data/lib/lib_discord/mappers/sticker_types.rb +0 -13
- data/lib/lib_discord/mappers/user_premium_types.rb +0 -15
- data/lib/lib_discord/mappers/user_visibility_types.rb +0 -13
- data/lib/lib_discord/mappers/webhooks_types.rb +0 -14
- data/lib/lib_discord/mappers.rb +0 -87
- data/lib/lib_discord/poll.rb +0 -62
- data/lib/lib_discord/resource.rb +0 -133
- data/lib/lib_discord/response.rb +0 -43
- data/lib/lib_discord/stage_instance.rb +0 -79
- data/lib/lib_discord/sticker.rb +0 -132
- data/lib/lib_discord/types.rb +0 -47
- data/lib/lib_discord/user.rb +0 -174
- data/lib/lib_discord/voice.rb +0 -29
- data/lib/lib_discord/webhook.rb +0 -299
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c677b5a4584d13d77314c8c92f7edbeef2a1d95d09e0aa5e3b575d94a0c05c1
|
4
|
+
data.tar.gz: aec4498155ca2ee500e209d4110f3ee3082b86340f079e9e9ec9db606bb72c85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12e1ce987f5151afc5361a23be89fa56fb53f83409cab4fd2d1b39635eedecc573c89b41351caf13a477c22375d32b38f36d99f29d15f3ade3b7363641801997
|
7
|
+
data.tar.gz: 1d7ced417a81d559a71f14ba8295e025a760b449e5810fb352063dfcc8ed3df7690eecd29349ab3c62cbc24c8a3d28933825b5eec0838406362bcb4f99f09619
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# CONTRIBUTING
|
2
|
+
|
3
|
+
[project]: https://sr.ht/~komidore64/lib_discord
|
4
|
+
[sources]: https://sr.ht/~komidore64/lib_discord/sources
|
5
|
+
[mailing lists]: https://sr.ht/~komidore64/lib_discord/lists
|
6
|
+
[bug tracker]: https://todo.sr.ht/~komidore64/lib_discord
|
7
|
+
|
8
|
+
Bug reports and patch submissions are welcome on SourceHut via the [bug
|
9
|
+
tracker] and [mailing lists], respectively.
|
10
|
+
|
11
|
+
## Code of Conduct
|
12
|
+
|
13
|
+
Everyone interacting in the lib_discord project's codebases, bug trackers, chat
|
14
|
+
rooms, and mailing lists is expected to follow the [code of
|
15
|
+
conduct](https://git.sr.ht/~komidore64/lib_discord/tree/main/item/CODE_OF_CONDUCT.md).
|
16
|
+
|
17
|
+
## Necessary Development Tools
|
18
|
+
|
19
|
+
### Ruby Runtime
|
20
|
+
|
21
|
+
lib_discord is written in Ruby. A Ruby runtime is required. Our recommendation
|
22
|
+
is to use [asdf](https://asdf-vm.com/) and
|
23
|
+
[asdf-ruby](https://github.com/asdf-vm/asdf-ruby) to manage your local ruby
|
24
|
+
installation.
|
25
|
+
|
26
|
+
## Code Style
|
27
|
+
|
28
|
+
This project adheres to [Standard Ruby](https://github.com/standardrb/standard)
|
29
|
+
style rules.
|
30
|
+
|
31
|
+
Additionally, we strive for an 80 character line length, but it's not a
|
32
|
+
hard-and-fast rule. There are occasions where breaking an expression across
|
33
|
+
multiple lines makes it more difficult to understand. In these instances the
|
34
|
+
line breaks do nothing more than appease a linter. As such, there is no
|
35
|
+
automated tooling to enforce an 80 character line length. Favor readability.
|
36
|
+
|
37
|
+
## Submitting Patches
|
38
|
+
|
39
|
+
We respect the intellectual property rights of others and want to ensure all
|
40
|
+
incoming contributions are attributed and licensed. The DCO is a declaration
|
41
|
+
attached to every contribution made by every developer. In the commit message,
|
42
|
+
the developer adds a `Signed-off-by` trailer ([`git commit -s`]) to sign that
|
43
|
+
they agree to the DCO. The contents of the agreement can be found below, or at
|
44
|
+
[DeveloperCertificate.org](https://developercertificate.org/).
|
45
|
+
|
46
|
+
[`git commit -s`]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--s
|
47
|
+
|
48
|
+
```
|
49
|
+
Developer Certificate of Origin
|
50
|
+
Version 1.1
|
51
|
+
|
52
|
+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
53
|
+
|
54
|
+
Everyone is permitted to copy and distribute verbatim copies of this
|
55
|
+
license document, but changing it is not allowed.
|
56
|
+
|
57
|
+
|
58
|
+
Developer's Certificate of Origin 1.1
|
59
|
+
|
60
|
+
By making a contribution to this project, I certify that:
|
61
|
+
|
62
|
+
(a) The contribution was created in whole or in part by me and I
|
63
|
+
have the right to submit it under the open source license
|
64
|
+
indicated in the file; or
|
65
|
+
|
66
|
+
(b) The contribution is based upon previous work that, to the best
|
67
|
+
of my knowledge, is covered under an appropriate open source
|
68
|
+
license and I have the right under that license to submit that
|
69
|
+
work with modifications, whether created in whole or in part
|
70
|
+
by me, under the same open source license (unless I am
|
71
|
+
permitted to submit under a different license), as indicated
|
72
|
+
in the file; or
|
73
|
+
|
74
|
+
(c) The contribution was provided directly to me by some other
|
75
|
+
person who certified (a), (b) or (c) and I have not modified
|
76
|
+
it.
|
77
|
+
|
78
|
+
(d) I understand and agree that this project and the contribution
|
79
|
+
are public and that a record of the contribution (including all
|
80
|
+
personal information I submit with it, including my sign-off) is
|
81
|
+
maintained indefinitely and may be redistributed consistent with
|
82
|
+
this project or the open source license(s) involved.
|
83
|
+
```
|
84
|
+
|
85
|
+
We require that every contribution to lib_discord is signed with a Developer
|
86
|
+
Certificate of Origin. Please use your real name or a pseudonym, and an email
|
87
|
+
address at which you may be contacted in the future if the (unlikely) need
|
88
|
+
arises. Patches submitted without a signed DCO **will not be accepted**.
|
data/README.md
CHANGED
@@ -5,26 +5,26 @@
|
|
5
5
|
[mailing lists]: https://sr.ht/~komidore64/lib_discord/lists
|
6
6
|
[bug tracker]: https://todo.sr.ht/~komidore64/lib_discord
|
7
7
|
|
8
|
-
|
8
|
+
Straightforward Ruby-bindings for Discord's Web API
|
9
9
|
|
10
10
|
[project] -- [sources] -- [mailing lists] -- [bug tracker]
|
11
11
|
|
12
|
+
[](https://nogithub.codeberg.page)
|
12
13
|
[](https://builds.sr.ht/~komidore64/lib_discord/commits/main/.build.yml)
|
13
14
|
[](https://rubygems.org/gems/lib_discord)
|
14
15
|
|
15
16
|
## Installation
|
16
17
|
|
17
18
|
`lib_discord` requires an installed [Ruby runtime](https://www.ruby-lang.org/)
|
18
|
-
`>= 3.
|
19
|
+
`>= 3.3`.
|
19
20
|
|
20
|
-
Install the gem and add to
|
21
|
+
Install the gem and add it to your application's Gemfile:
|
21
22
|
|
22
23
|
```sh
|
23
24
|
bundle add lib_discord
|
24
25
|
```
|
25
26
|
|
26
|
-
If bundler is not being used to manage dependencies, install the gem
|
27
|
-
executing:
|
27
|
+
If bundler is not being used to manage dependencies, install the gem with:
|
28
28
|
|
29
29
|
```sh
|
30
30
|
gem install lib_discord
|
@@ -32,91 +32,64 @@ gem install lib_discord
|
|
32
32
|
|
33
33
|
## Usage
|
34
34
|
|
35
|
+
Use the Client for communicating with Discord's web endpoints
|
36
|
+
|
35
37
|
```ruby
|
36
38
|
require "lib_discord"
|
37
|
-
|
39
|
+
|
40
|
+
client = LibDiscord.client("Bot my.amazing.bot.token") # => LibDiscord::Client
|
41
|
+
resp = client.create_message("<channel_id>", {content: "Hi, Mom!"}) # => LibDiscord::Response
|
42
|
+
resp.success? # => true
|
38
43
|
```
|
39
44
|
|
40
|
-
|
45
|
+
Compare permissions:
|
41
46
|
|
42
47
|
```ruby
|
43
|
-
|
44
|
-
# =>
|
45
|
-
# ["application",
|
46
|
-
# "application_command",
|
47
|
-
# "application_role_connection_metadata",
|
48
|
-
# "audit_log",
|
49
|
-
# "auto_moderation",
|
50
|
-
# "channel",
|
51
|
-
# "emoji",
|
52
|
-
# "guild",
|
53
|
-
# "guild_scheduled_event",
|
54
|
-
# "guild_template",
|
55
|
-
# "interaction",
|
56
|
-
# "invite",
|
57
|
-
# "poll",
|
58
|
-
# "stage_instance",
|
59
|
-
# "sticker",
|
60
|
-
# "user",
|
61
|
-
# "voice",
|
62
|
-
# "webhook"]
|
63
|
-
|
64
|
-
client["application"]
|
65
|
-
# => #<LibDiscord::Application: ... >
|
66
|
-
```
|
48
|
+
p = LibDiscord.permissions # => Hash
|
67
49
|
|
68
|
-
|
69
|
-
mapped to the "Resources" described in [Discord's developer documentation].
|
50
|
+
my_permissions = p[:SEND_MESSAGES] + p[:ADD_REACTIONS] # => 2112
|
70
51
|
|
71
|
-
|
72
|
-
|
52
|
+
# Check for permission flags that are set.
|
53
|
+
my_permissions & p[:SEND_MESSAGES] == p[:SEND_MESSAGES] # => true
|
73
54
|
|
74
|
-
|
75
|
-
# =>
|
55
|
+
# Check for permission flags that are not set.
|
56
|
+
my_permissions & p[:KICK_MEMBERS] == p[:KICK_MEMBERS] # => false
|
57
|
+
```
|
58
|
+
|
59
|
+
Use maps for Discord's encoded values:
|
76
60
|
|
77
|
-
|
78
|
-
# => Hash
|
61
|
+
```ruby
|
62
|
+
aco_types = LibDiscord.maps[:ApplicationCommand][:OptionTypes] # => Hash
|
63
|
+
aco_types[:CHANNEL] # => 7
|
64
|
+
```
|
79
65
|
|
80
|
-
|
81
|
-
# => JSON body deserialized to a Hash
|
66
|
+
Format Discord specific objects to render in messages:
|
82
67
|
|
83
|
-
|
84
|
-
|
68
|
+
```ruby
|
69
|
+
fmt = LibDiscord.formatter
|
70
|
+
fmt.user(12345678) # => "<@12345678>"
|
85
71
|
```
|
86
72
|
|
87
|
-
[
|
73
|
+
See [documentation](https://rdoc.info/gems/lib_discord) for more details.
|
88
74
|
|
89
75
|
## Getting help
|
90
76
|
|
91
|
-
Please use the [mailing lists] if you have questions or need
|
77
|
+
Please use the [mailing lists] if you have questions or need assistance.
|
92
78
|
|
93
79
|
## Contributing
|
94
80
|
|
95
81
|
Bug reports and patch submissions are welcome on SourceHut via the [bug
|
96
82
|
tracker] and [mailing lists], respectively. This project is intended to be a
|
97
|
-
safe
|
98
|
-
adhere to the [code of
|
99
|
-
|
100
|
-
[code of conduct]: https://git.sr.ht/~komidore64/lib_discord/tree/main/item/CODE_OF_CONDUCT.md
|
101
|
-
|
102
|
-
### Code style
|
103
|
-
|
104
|
-
This project adheres to [Standard Ruby] style rules.
|
83
|
+
safe and welcoming space for collaboration. All participants are expected to
|
84
|
+
adhere to the [code of
|
85
|
+
conduct](https://git.sr.ht/~komidore64/lib_discord/tree/main/item/CODE_OF_CONDUCT.md).
|
105
86
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
linter. As such, there is no tool to enforce an 80 character line length.
|
110
|
-
|
111
|
-
[Standard Ruby]: https://github.com/standardrb/standard
|
112
|
-
|
113
|
-
## Code of Conduct
|
114
|
-
|
115
|
-
Everyone interacting in the `lib_discord` project's codebase, bug trackers,
|
116
|
-
chat rooms, and mailing lists is expected to follow the [code of conduct].
|
87
|
+
See
|
88
|
+
[CONTRIBUTING.md](https://git.sr.ht/~komidore64/lib_discord/tree/main/item/CONTRIBUTING.md)
|
89
|
+
for more details.
|
117
90
|
|
118
91
|
## Licenses
|
119
92
|
|
120
|
-
See files in the
|
121
|
-
|
122
|
-
|
93
|
+
See files in the
|
94
|
+
[LICENSES/](https://git.sr.ht/~komidore64/lib_discord/tree/main/item/LICENSES)
|
95
|
+
directory.
|