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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +88 -0
  3. data/README.md +40 -67
  4. data/lib/lib_discord/client.rb +2667 -138
  5. data/lib/lib_discord/formatter.rb +108 -0
  6. data/lib/lib_discord/maps.rb +730 -0
  7. data/lib/lib_discord/permissions.rb +84 -0
  8. data/lib/lib_discord/urls.rb +9 -15
  9. data/lib/lib_discord/version.rb +1 -4
  10. data/lib/lib_discord.rb +3 -5
  11. metadata +12 -120
  12. data/CHANGELOG.md +0 -152
  13. data/lib/lib_discord/application.rb +0 -43
  14. data/lib/lib_discord/application_command.rb +0 -341
  15. data/lib/lib_discord/application_role_connection_metadata.rb +0 -52
  16. data/lib/lib_discord/audit_log.rb +0 -36
  17. data/lib/lib_discord/auto_moderation.rb +0 -106
  18. data/lib/lib_discord/channel.rb +0 -716
  19. data/lib/lib_discord/emoji.rb +0 -106
  20. data/lib/lib_discord/errors.rb +0 -31
  21. data/lib/lib_discord/guild.rb +0 -830
  22. data/lib/lib_discord/guild_scheduled_event.rb +0 -133
  23. data/lib/lib_discord/guild_template.rb +0 -128
  24. data/lib/lib_discord/interaction.rb +0 -163
  25. data/lib/lib_discord/invite.rb +0 -47
  26. data/lib/lib_discord/mappers/application_command_option_types.rb +0 -22
  27. data/lib/lib_discord/mappers/application_command_permission_types.rb +0 -14
  28. data/lib/lib_discord/mappers/application_command_types.rb +0 -14
  29. data/lib/lib_discord/mappers/application_integration_types.rb +0 -13
  30. data/lib/lib_discord/mappers/application_role_connection_metadata_types.rb +0 -19
  31. data/lib/lib_discord/mappers/audit_log_events.rb +0 -67
  32. data/lib/lib_discord/mappers/auto_moderation_action_types.rb +0 -14
  33. data/lib/lib_discord/mappers/auto_moderation_event_types.rb +0 -12
  34. data/lib/lib_discord/mappers/auto_moderation_keyword_preset_types.rb +0 -14
  35. data/lib/lib_discord/mappers/auto_moderation_trigger_types.rb +0 -15
  36. data/lib/lib_discord/mappers/channel_forum_layout_types.rb +0 -14
  37. data/lib/lib_discord/mappers/channel_message_activity_types.rb +0 -15
  38. data/lib/lib_discord/mappers/channel_message_types.rb +0 -42
  39. data/lib/lib_discord/mappers/channel_sort_order_types.rb +0 -13
  40. data/lib/lib_discord/mappers/channel_types.rb +0 -24
  41. data/lib/lib_discord/mappers/channel_video_quality_modes.rb +0 -13
  42. data/lib/lib_discord/mappers/guild_default_message_notification_levels.rb +0 -13
  43. data/lib/lib_discord/mappers/guild_explicit_content_filter_levels.rb +0 -14
  44. data/lib/lib_discord/mappers/guild_integration_expire_behaviors.rb +0 -13
  45. data/lib/lib_discord/mappers/guild_mfa_levels.rb +0 -13
  46. data/lib/lib_discord/mappers/guild_nsfw_levels.rb +0 -15
  47. data/lib/lib_discord/mappers/guild_onboarding_modes.rb +0 -13
  48. data/lib/lib_discord/mappers/guild_premium_tiers.rb +0 -15
  49. data/lib/lib_discord/mappers/guild_prompt_types.rb +0 -13
  50. data/lib/lib_discord/mappers/guild_scheduled_event_entity_types.rb +0 -14
  51. data/lib/lib_discord/mappers/guild_scheduled_event_privacy_levels.rb +0 -12
  52. data/lib/lib_discord/mappers/guild_scheduled_event_statuses.rb +0 -15
  53. data/lib/lib_discord/mappers/guild_verification_levels.rb +0 -16
  54. data/lib/lib_discord/mappers/interaction_callback_types.rb +0 -19
  55. data/lib/lib_discord/mappers/interaction_context_types.rb +0 -14
  56. data/lib/lib_discord/mappers/interaction_types.rb +0 -16
  57. data/lib/lib_discord/mappers/invite_target_types.rb +0 -13
  58. data/lib/lib_discord/mappers/message_component_button_styles.rb +0 -16
  59. data/lib/lib_discord/mappers/message_component_text_input_styles.rb +0 -13
  60. data/lib/lib_discord/mappers/message_component_types.rb +0 -19
  61. data/lib/lib_discord/mappers/poll_layout_types.rb +0 -12
  62. data/lib/lib_discord/mappers/stage_instance_privacy_levels.rb +0 -13
  63. data/lib/lib_discord/mappers/sticker_format_types.rb +0 -15
  64. data/lib/lib_discord/mappers/sticker_types.rb +0 -13
  65. data/lib/lib_discord/mappers/user_premium_types.rb +0 -15
  66. data/lib/lib_discord/mappers/user_visibility_types.rb +0 -13
  67. data/lib/lib_discord/mappers/webhooks_types.rb +0 -14
  68. data/lib/lib_discord/mappers.rb +0 -87
  69. data/lib/lib_discord/poll.rb +0 -62
  70. data/lib/lib_discord/resource.rb +0 -133
  71. data/lib/lib_discord/response.rb +0 -43
  72. data/lib/lib_discord/stage_instance.rb +0 -79
  73. data/lib/lib_discord/sticker.rb +0 -132
  74. data/lib/lib_discord/types.rb +0 -47
  75. data/lib/lib_discord/user.rb +0 -174
  76. data/lib/lib_discord/voice.rb +0 -29
  77. data/lib/lib_discord/webhook.rb +0 -299
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ PERMISSIONS = {
5
+ CREATE_INSTANT_INVITE: 1 << 0,
6
+ KICK_MEMBERS: 1 << 1,
7
+ BAN_MEMBERS: 1 << 2,
8
+ ADMINISTRATOR: 1 << 3,
9
+ MANAGE_CHANNELS: 1 << 4,
10
+ MANAGE_GUILD: 1 << 5,
11
+ ADD_REACTIONS: 1 << 6,
12
+ VIEW_AUDIT_LOG: 1 << 7,
13
+ PRIORITY_SPEAKER: 1 << 8,
14
+ STREAM: 1 << 9,
15
+ VIEW_CHANNEL: 1 << 10,
16
+ SEND_MESSAGES: 1 << 11,
17
+ SEND_TTS_MESSAGES: 1 << 12,
18
+ MANAGE_MESSAGES: 1 << 13,
19
+ EMBED_LINKS: 1 << 14,
20
+ ATTACH_FILES: 1 << 15,
21
+ READ_MESSAGE_HISTORY: 1 << 16,
22
+ MENTION_EVERYONE: 1 << 17,
23
+ USE_EXTERNAL_EMOJIS: 1 << 18,
24
+ VIEW_GUILD_INSIGHTS: 1 << 19,
25
+ CONNECT: 1 << 20,
26
+ SPEAK: 1 << 21,
27
+ MUTE_MEMBERS: 1 << 22,
28
+ DEAFEN_MEMBERS: 1 << 23,
29
+ MOVE_MEMBERS: 1 << 24,
30
+ USE_VAD: 1 << 25,
31
+ CHANGE_NICKNAME: 1 << 26,
32
+ MANAGE_NICKNAMES: 1 << 27,
33
+ MANAGE_ROLES: 1 << 28,
34
+ MANAGE_WEBHOOKS: 1 << 29,
35
+ MANAGE_GUILD_EXPRESSIONS: 1 << 30,
36
+ USE_APPLICATION_COMMANDS: 1 << 31,
37
+ REQUEST_TO_SPEAK: 1 << 32,
38
+ MANAGE_EVENTS: 1 << 33,
39
+ MANAGE_THREADS: 1 << 34,
40
+ CREATE_PUBLIC_THREADS: 1 << 35,
41
+ CREATE_PRIVATE_THREADS: 1 << 36,
42
+ USE_EXTERNAL_STICKERS: 1 << 37,
43
+ SEND_MESSAGES_IN_THREADS: 1 << 38,
44
+ USE_EMBEDDED_ACTIVITIES: 1 << 39,
45
+ MODERATE_MEMBERS: 1 << 40,
46
+ VIEW_CREATOR_MONETIZATION_ANALYTICS: 1 << 41,
47
+ USE_SOUNDBOARD: 1 << 42,
48
+ CREATE_GUILD_EXPRESSIONS: 1 << 43,
49
+ CREATE_EVENTS: 1 << 44,
50
+ USE_EXTERNAL_SOUNDS: 1 << 45,
51
+ SEND_VOICE_MESSAGES: 1 << 46,
52
+ SEND_POLLS: 1 << 49,
53
+ USE_EXTERNAL_APPS: 1 << 50
54
+ }.freeze
55
+
56
+ ##
57
+ # Get the data structure for Discord permissions. Use this data structure for
58
+ # permissions calculations, permissions comparisons, and to help reduce magic
59
+ # numbers in your code when making requests to Discord and parsing Discord
60
+ # responses.
61
+ #
62
+ # @return [Hash]
63
+ #
64
+ # @example
65
+ # p = LibDiscord.permissions
66
+ # p[:ADD_REACTIONS] # => 64
67
+ #
68
+ # @example Permissions value that can SEND_MESSAGES and ADD_REACTIONS
69
+ # my_perms = p[:SEND_MESSAGES] + p[:ADD_REACTIONS] # => 2112
70
+ #
71
+ # @example Check for permission flags that are set.
72
+ # my_perms & p[:ADD_REACTIONS] == p[:ADD_REACTIONS] # => true
73
+ #
74
+ # @example Check for permission flags that are not set.
75
+ # my_perms & p[:KICK_MEMBERS] == p[:KICK_MEMBERS] # => false
76
+ #
77
+ # @see https://docs.ruby-lang.org/en/3.3/Integer.html#method-i-26 Integer
78
+ # bitwise AND
79
+ # @see https://en.wikipedia.org/wiki/Magic_number_(programming) Wikipedia -
80
+ # Magic number (programming)
81
+ # @see https://discord.com/developers/docs/topics/permissions Discord
82
+ # documentation "Permissions"
83
+ def self.permissions = PERMISSIONS
84
+ end
@@ -1,27 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibDiscord
4
- ##
5
- # Project URL
6
- #
7
4
  # @api private
8
- PROJECT_URL = "https://sr.ht/~komidore64/lib_discord"
5
+ BUG_TRACKER_URL = "https://todo.sr.ht/~komidore64/lib_discord"
9
6
 
10
- ##
11
- # Source code URL
12
- #
13
7
  # @api private
14
- SOURCE_URL = "https://git.sr.ht/~komidore64/lib_discord"
8
+ DISCORD_BASE_URL = "https://discord.com"
15
9
 
16
- ##
17
- # Bug tracker URL
18
- #
19
10
  # @api private
20
- BUG_TRACKER_URL = "https://todo.sr.ht/~komidore64/lib_discord"
11
+ DOCUMENTATION_URL = "https://rdoc.info/gems/lib_discord"
21
12
 
22
- ##
23
- # Mailing list URLs
24
- #
25
13
  # @api private
26
14
  MAILING_LIST_URL = "https://sr.ht/~komidore64/lib_discord/lists"
15
+
16
+ # @api private
17
+ PROJECT_URL = "https://sr.ht/~komidore64/lib_discord"
18
+
19
+ # @api private
20
+ SOURCE_URL = "https://git.sr.ht/~komidore64/lib_discord"
27
21
  end
@@ -1,11 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibDiscord
4
- ##
5
- # Get the rubygem's version.
6
- #
7
4
  # @api private
8
5
  def self.version
9
- @version ||= Gem::Version.new("0.1.3")
6
+ @version ||= Gem::Version.new("1.0.1")
10
7
  end
11
8
  end
data/lib/lib_discord.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ##
4
- # Module to namespace all LibDiscord classes, constants, types, etc.
5
- module LibDiscord; end
6
-
7
3
  require "lib_discord/client"
8
- require "lib_discord/mappers"
4
+ require "lib_discord/formatter"
5
+ require "lib_discord/maps"
6
+ require "lib_discord/permissions"
metadata CHANGED
@@ -1,31 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lib_discord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-26 00:00:00.000000000 Z
10
+ date: 2025-06-06 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: dry-container
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.11'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0.11'
27
- - !ruby/object:Gem::Dependency
28
- name: dry-struct
13
+ name: logger
29
14
  requirement: !ruby/object:Gem::Requirement
30
15
  requirements:
31
16
  - - "~>"
@@ -38,124 +23,32 @@ dependencies:
38
23
  - - "~>"
39
24
  - !ruby/object:Gem::Version
40
25
  version: '1.6'
41
- - !ruby/object:Gem::Dependency
42
- name: dry-types
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.7'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.7'
55
- - !ruby/object:Gem::Dependency
56
- name: http
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '5.1'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '5.1'
69
- description:
70
26
  email:
71
27
  - komidore64@gmail.com
72
28
  executables: []
73
29
  extensions: []
74
30
  extra_rdoc_files: []
75
31
  files:
76
- - CHANGELOG.md
77
32
  - CODE_OF_CONDUCT.md
33
+ - CONTRIBUTING.md
78
34
  - LICENSES/AGPL-3.0-only.txt
79
35
  - README.md
80
36
  - lib/lib_discord.rb
81
- - lib/lib_discord/application.rb
82
- - lib/lib_discord/application_command.rb
83
- - lib/lib_discord/application_role_connection_metadata.rb
84
- - lib/lib_discord/audit_log.rb
85
- - lib/lib_discord/auto_moderation.rb
86
- - lib/lib_discord/channel.rb
87
37
  - lib/lib_discord/client.rb
88
- - lib/lib_discord/emoji.rb
89
- - lib/lib_discord/errors.rb
90
- - lib/lib_discord/guild.rb
91
- - lib/lib_discord/guild_scheduled_event.rb
92
- - lib/lib_discord/guild_template.rb
93
- - lib/lib_discord/interaction.rb
94
- - lib/lib_discord/invite.rb
95
- - lib/lib_discord/mappers.rb
96
- - lib/lib_discord/mappers/application_command_option_types.rb
97
- - lib/lib_discord/mappers/application_command_permission_types.rb
98
- - lib/lib_discord/mappers/application_command_types.rb
99
- - lib/lib_discord/mappers/application_integration_types.rb
100
- - lib/lib_discord/mappers/application_role_connection_metadata_types.rb
101
- - lib/lib_discord/mappers/audit_log_events.rb
102
- - lib/lib_discord/mappers/auto_moderation_action_types.rb
103
- - lib/lib_discord/mappers/auto_moderation_event_types.rb
104
- - lib/lib_discord/mappers/auto_moderation_keyword_preset_types.rb
105
- - lib/lib_discord/mappers/auto_moderation_trigger_types.rb
106
- - lib/lib_discord/mappers/channel_forum_layout_types.rb
107
- - lib/lib_discord/mappers/channel_message_activity_types.rb
108
- - lib/lib_discord/mappers/channel_message_types.rb
109
- - lib/lib_discord/mappers/channel_sort_order_types.rb
110
- - lib/lib_discord/mappers/channel_types.rb
111
- - lib/lib_discord/mappers/channel_video_quality_modes.rb
112
- - lib/lib_discord/mappers/guild_default_message_notification_levels.rb
113
- - lib/lib_discord/mappers/guild_explicit_content_filter_levels.rb
114
- - lib/lib_discord/mappers/guild_integration_expire_behaviors.rb
115
- - lib/lib_discord/mappers/guild_mfa_levels.rb
116
- - lib/lib_discord/mappers/guild_nsfw_levels.rb
117
- - lib/lib_discord/mappers/guild_onboarding_modes.rb
118
- - lib/lib_discord/mappers/guild_premium_tiers.rb
119
- - lib/lib_discord/mappers/guild_prompt_types.rb
120
- - lib/lib_discord/mappers/guild_scheduled_event_entity_types.rb
121
- - lib/lib_discord/mappers/guild_scheduled_event_privacy_levels.rb
122
- - lib/lib_discord/mappers/guild_scheduled_event_statuses.rb
123
- - lib/lib_discord/mappers/guild_verification_levels.rb
124
- - lib/lib_discord/mappers/interaction_callback_types.rb
125
- - lib/lib_discord/mappers/interaction_context_types.rb
126
- - lib/lib_discord/mappers/interaction_types.rb
127
- - lib/lib_discord/mappers/invite_target_types.rb
128
- - lib/lib_discord/mappers/message_component_button_styles.rb
129
- - lib/lib_discord/mappers/message_component_text_input_styles.rb
130
- - lib/lib_discord/mappers/message_component_types.rb
131
- - lib/lib_discord/mappers/poll_layout_types.rb
132
- - lib/lib_discord/mappers/stage_instance_privacy_levels.rb
133
- - lib/lib_discord/mappers/sticker_format_types.rb
134
- - lib/lib_discord/mappers/sticker_types.rb
135
- - lib/lib_discord/mappers/user_premium_types.rb
136
- - lib/lib_discord/mappers/user_visibility_types.rb
137
- - lib/lib_discord/mappers/webhooks_types.rb
138
- - lib/lib_discord/poll.rb
139
- - lib/lib_discord/resource.rb
140
- - lib/lib_discord/response.rb
141
- - lib/lib_discord/stage_instance.rb
142
- - lib/lib_discord/sticker.rb
143
- - lib/lib_discord/types.rb
38
+ - lib/lib_discord/formatter.rb
39
+ - lib/lib_discord/maps.rb
40
+ - lib/lib_discord/permissions.rb
144
41
  - lib/lib_discord/urls.rb
145
- - lib/lib_discord/user.rb
146
42
  - lib/lib_discord/version.rb
147
- - lib/lib_discord/voice.rb
148
- - lib/lib_discord/webhook.rb
149
- homepage:
150
43
  licenses:
151
44
  - AGPL-3.0-only
152
45
  metadata:
153
- rubygems_mfa_required: 'true'
154
46
  bug_tracker_uri: https://todo.sr.ht/~komidore64/lib_discord
47
+ documentation_uri: https://rdoc.info/gems/lib_discord
155
48
  homepage_uri: https://sr.ht/~komidore64/lib_discord
156
49
  mailing_list_uri: https://sr.ht/~komidore64/lib_discord/lists
50
+ rubygems_mfa_required: 'true'
157
51
  source_code_uri: https://git.sr.ht/~komidore64/lib_discord
158
- post_install_message:
159
52
  rdoc_options: []
160
53
  require_paths:
161
54
  - lib
@@ -163,15 +56,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
56
  requirements:
164
57
  - - ">="
165
58
  - !ruby/object:Gem::Version
166
- version: '3.2'
59
+ version: '3.3'
167
60
  required_rubygems_version: !ruby/object:Gem::Requirement
168
61
  requirements:
169
62
  - - ">="
170
63
  - !ruby/object:Gem::Version
171
64
  version: '0'
172
65
  requirements: []
173
- rubygems_version: 3.5.15
174
- signing_key:
66
+ rubygems_version: 3.6.2
175
67
  specification_version: 4
176
- summary: Unfancy Discord API Ruby-bindings
68
+ summary: Straightforward Ruby-bindings for Discord's Web API
177
69
  test_files: []
data/CHANGELOG.md DELETED
@@ -1,152 +0,0 @@
1
- # CHANGELOG
2
-
3
- ## [0.1.3] - 2024-07-26
4
-
5
- ### chore
6
- - bundle update
7
- - tiny bit of clarity added
8
- - bundle update
9
-
10
- ### fix
11
- - allow for any kind of JSON payload
12
-
13
- ## [0.1.2] - 2024-05-13
14
-
15
- ### chore
16
- - sort modules alphabetically
17
- - unified error raising style
18
- - bump version to 0.1.2
19
-
20
- ### fix
21
- - allow for loggers other than Logger descendants
22
- - forgot how to raise errors :facepalm:
23
- - arguments for ConstraintError
24
- - use `#debug()` convenience method rather than `#add()`
25
-
26
- ## [0.1.1] - 2024-04-24
27
-
28
- ### chore
29
- - Revert "fix: remove gem version badge"
30
- - include additional files for yardoc
31
- - bump version to 0.1.1
32
-
33
- ### fix
34
- - remove gem version badge
35
- - name dry-container keys correctly
36
-
37
- ## [0.1.0] - 2024-04-24
38
-
39
- ### chore
40
- - generate CHANGELOG.md
41
- - typo fix
42
- - use `standard` gem rather than `standardrb` alias
43
- - shields always make a project cooler
44
- - move resources into the lib_discord dir
45
- - add yardoc for application
46
- - yardoc for application_command
47
- - yardoc for application_role_connection_metadata
48
- - yardoc for audit_log
49
- - yardoc for auto_moderation
50
- - yardoc for channel
51
- - yardoc for emoji
52
- - yardoc for guild
53
- - yardoc for guild_scheduled_event and guild_template
54
- - yardoc for stage_instance
55
- - yardoc for sticker
56
- - yardoc for user
57
- - yardoc for voice
58
- - yardoc for webhook
59
- - finish yardoc
60
- - add changelog to generated yardoc
61
- - note all the parameters that are discord snowflakes
62
- - reduce line length to 80 columns, where it makes sense
63
- - application-commands - copy descriptions
64
- - application - copy descriptions
65
- - interactions - copy descriptions
66
- - application-role-connection-metadata - copy descriptions
67
- - let's leave the endpoint descriptions to Discord
68
- - use our binstubs
69
- - document the mappers module
70
-
71
- ### feat
72
- - polls came out since i started working on this library!
73
- - [**breaking**] authorization header for client is now a positional argument
74
- - account for endpoints that don't require auth
75
- - add convenience constants for discord integer encodings
76
- - bump to version 0.1.0
77
-
78
- ### fix
79
- - bad yardoc
80
- - incorrect ruby-object `#inspect` output in documentation
81
-
82
- ## [0.1.0.pre2] - 2024-04-15
83
-
84
- ### chore
85
- - generate CHANGELOG.md
86
- - bump version to 0.1.0.pre2
87
-
88
- ### fix
89
- - let's not leak Discord Bot Tokens to stdout
90
-
91
- ## [0.1.0.pre] - 2024-04-15
92
-
93
- ### chore
94
- - initial rspec scaffold
95
- - move shared_examples into a single file
96
- - add code coverage reporting
97
- - mark development dependencies as such
98
- - don't test HTTP if we don't need to
99
- - make sure we can do non-200 responses
100
- - yard and debug version contraints
101
- - add standardrb tooling
102
- - add sourcehut build manifest
103
- - add coverage reports to builds.sr.ht artifact list
104
- - remove unused fixture tooling
105
-
106
- ### feat
107
- - finish guild
108
- - add guild_scheduled_event
109
- - empty files for the rest of the resources
110
- - add invites
111
- - add stage instance endpoints
112
- - add sticker endpoints
113
- - add user endpoints
114
- - add voice endpoints
115
- - add webhook endpoints
116
- - more rspec scaffolding
117
- - basic tests for application resource
118
- - add application_role_connection_metadata_spec
119
- - add audit_log_spec
120
- - add auto_moderation_spec
121
- - more test scaffolding
122
- - finished channel_spec
123
- - fill out emoji_spec
124
- - fill out guild_scheduled_event_spec
125
- - fill out guild_spec and guild_template_spec
126
- - fill out invite_spec and stage_instance_spec
127
- - fill out sticker_spec
128
- - fill out user_spec and voice_spec
129
- - fill out webhook_spec
130
- - make sure the client can access all resources
131
- - add fixture support
132
- - expose the container via delegators
133
- - implement `#send_request` for Resource
134
- - discord requests that we provide a user-agent
135
- - introduce type checking for our inputs
136
- - include query parameters for endpoints
137
- - add interaction resource and interaction_spec
138
- - add application_command and application_command_spec
139
- - use custom matcher for lib_discord/response struct
140
- - add a logger into the system
141
- - test resource logging when mime-type is unknown
142
- - update readme and ancillary documents
143
- - add git-cliff for changelog generation
144
-
145
- ### fix
146
- - i missed a bunch of guild endpoints
147
- - ensure we're testing all the code
148
- - contain the abstraction if HTTP throws an error
149
-
150
- ---
151
-
152
- generated by [git-cliff](https://git-cliff.org/)
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lib_discord/resource"
4
-
5
- module LibDiscord
6
- ##
7
- # Application Resource
8
- #
9
- # Do not instantiate an {Application} directly. Instead request one from an
10
- # instance of {Client}.
11
- #
12
- # client = LibDiscord::Client.new("Bot auth.token")
13
- # a = client["application"]
14
- #
15
- # @see https://discord.com/developers/docs/resources/application Discord
16
- # documentation "Application Resource"
17
- class Application < Resource
18
- ##
19
- # @return [Response]
20
- #
21
- # @raise [TimeoutError] if the HTTP request times out
22
- #
23
- # @see https://discord.com/developers/docs/resources/application#get-current-application
24
- # Discord documentation "Get Current Application"
25
- def get_current_application
26
- send_request(:get, "/applications/@me")
27
- end
28
-
29
- ##
30
- # @param json [#to_json] JSON serializable payload
31
- #
32
- # @return [Response]
33
- #
34
- # @raise [TimeoutError] if the HTTP request times out
35
- # @raise [ConstraintError] if +json+ cannot be serialized to JSON
36
- #
37
- # @see https://discord.com/developers/docs/resources/application#edit-current-application
38
- # Discord documentation "Edit Current Application"
39
- def edit_current_application(json:)
40
- send_request(:patch, "/applications/@me", json:)
41
- end
42
- end
43
- end