lib_discord 0.1.0.pre2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lib_discord/application.rb +43 -0
  3. data/lib/lib_discord/application_command.rb +341 -0
  4. data/lib/lib_discord/application_role_connection_metadata.rb +52 -0
  5. data/lib/lib_discord/audit_log.rb +36 -0
  6. data/lib/lib_discord/auto_moderation.rb +106 -0
  7. data/lib/lib_discord/channel.rb +716 -0
  8. data/lib/lib_discord/client.rb +124 -14
  9. data/lib/lib_discord/emoji.rb +106 -0
  10. data/lib/lib_discord/errors.rb +24 -0
  11. data/lib/lib_discord/guild.rb +830 -0
  12. data/lib/lib_discord/guild_scheduled_event.rb +133 -0
  13. data/lib/lib_discord/guild_template.rb +128 -0
  14. data/lib/lib_discord/interaction.rb +163 -0
  15. data/lib/lib_discord/invite.rb +47 -0
  16. data/lib/lib_discord/mappers/application_command_option_types.rb +22 -0
  17. data/lib/lib_discord/mappers/application_command_permission_types.rb +14 -0
  18. data/lib/lib_discord/mappers/application_command_types.rb +14 -0
  19. data/lib/lib_discord/mappers/application_integration_types.rb +13 -0
  20. data/lib/lib_discord/mappers/application_role_connection_metadata_types.rb +19 -0
  21. data/lib/lib_discord/mappers/audit_log_events.rb +67 -0
  22. data/lib/lib_discord/mappers/auto_moderation_action_types.rb +14 -0
  23. data/lib/lib_discord/mappers/auto_moderation_event_types.rb +12 -0
  24. data/lib/lib_discord/mappers/auto_moderation_keyword_preset_types.rb +14 -0
  25. data/lib/lib_discord/mappers/auto_moderation_trigger_types.rb +15 -0
  26. data/lib/lib_discord/mappers/channel_forum_layout_types.rb +14 -0
  27. data/lib/lib_discord/mappers/channel_message_activity_types.rb +15 -0
  28. data/lib/lib_discord/mappers/channel_message_types.rb +42 -0
  29. data/lib/lib_discord/mappers/channel_sort_order_types.rb +13 -0
  30. data/lib/lib_discord/mappers/channel_types.rb +24 -0
  31. data/lib/lib_discord/mappers/channel_video_quality_modes.rb +13 -0
  32. data/lib/lib_discord/mappers/guild_default_message_notification_levels.rb +13 -0
  33. data/lib/lib_discord/mappers/guild_explicit_content_filter_levels.rb +14 -0
  34. data/lib/lib_discord/mappers/guild_integration_expire_behaviors.rb +13 -0
  35. data/lib/lib_discord/mappers/guild_mfa_levels.rb +13 -0
  36. data/lib/lib_discord/mappers/guild_nsfw_levels.rb +15 -0
  37. data/lib/lib_discord/mappers/guild_onboarding_modes.rb +13 -0
  38. data/lib/lib_discord/mappers/guild_premium_tiers.rb +15 -0
  39. data/lib/lib_discord/mappers/guild_prompt_types.rb +13 -0
  40. data/lib/lib_discord/mappers/guild_scheduled_event_entity_types.rb +14 -0
  41. data/lib/lib_discord/mappers/guild_scheduled_event_privacy_levels.rb +12 -0
  42. data/lib/lib_discord/mappers/guild_scheduled_event_statuses.rb +15 -0
  43. data/lib/lib_discord/mappers/guild_verification_levels.rb +16 -0
  44. data/lib/lib_discord/mappers/interaction_callback_types.rb +19 -0
  45. data/lib/lib_discord/mappers/interaction_context_types.rb +14 -0
  46. data/lib/lib_discord/mappers/interaction_types.rb +16 -0
  47. data/lib/lib_discord/mappers/invite_target_types.rb +13 -0
  48. data/lib/lib_discord/mappers/message_component_button_styles.rb +16 -0
  49. data/lib/lib_discord/mappers/message_component_text_input_styles.rb +13 -0
  50. data/lib/lib_discord/mappers/message_component_types.rb +19 -0
  51. data/lib/lib_discord/mappers/poll_layout_types.rb +12 -0
  52. data/lib/lib_discord/mappers/stage_instance_privacy_levels.rb +13 -0
  53. data/lib/lib_discord/mappers/sticker_format_types.rb +15 -0
  54. data/lib/lib_discord/mappers/sticker_types.rb +13 -0
  55. data/lib/lib_discord/mappers/user_premium_types.rb +15 -0
  56. data/lib/lib_discord/mappers/user_visibility_types.rb +13 -0
  57. data/lib/lib_discord/mappers/webhooks_types.rb +14 -0
  58. data/lib/lib_discord/mappers.rb +87 -0
  59. data/lib/lib_discord/poll.rb +62 -0
  60. data/lib/lib_discord/resource.rb +91 -21
  61. data/lib/lib_discord/response.rb +39 -7
  62. data/lib/lib_discord/stage_instance.rb +79 -0
  63. data/lib/lib_discord/sticker.rb +132 -0
  64. data/lib/lib_discord/types.rb +35 -11
  65. data/lib/lib_discord/urls.rb +20 -12
  66. data/lib/lib_discord/user.rb +174 -0
  67. data/lib/lib_discord/version.rb +5 -1
  68. data/lib/lib_discord/voice.rb +29 -0
  69. data/lib/lib_discord/webhook.rb +299 -0
  70. data/lib/lib_discord.rb +5 -0
  71. metadata +77 -20
  72. data/lib/lib_discord/resources/application.rb +0 -15
  73. data/lib/lib_discord/resources/application_command.rb +0 -71
  74. data/lib/lib_discord/resources/application_role_connection_metadata.rb +0 -15
  75. data/lib/lib_discord/resources/audit_log.rb +0 -11
  76. data/lib/lib_discord/resources/auto_moderation.rb +0 -27
  77. data/lib/lib_discord/resources/channel.rb +0 -168
  78. data/lib/lib_discord/resources/emoji.rb +0 -27
  79. data/lib/lib_discord/resources/guild.rb +0 -196
  80. data/lib/lib_discord/resources/guild_scheduled_event.rb +0 -31
  81. data/lib/lib_discord/resources/guild_template.rb +0 -35
  82. data/lib/lib_discord/resources/interaction.rb +0 -39
  83. data/lib/lib_discord/resources/invite.rb +0 -15
  84. data/lib/lib_discord/resources/stage_instance.rb +0 -23
  85. data/lib/lib_discord/resources/sticker.rb +0 -35
  86. data/lib/lib_discord/resources/user.rb +0 -51
  87. data/lib/lib_discord/resources/voice.rb +0 -11
  88. data/lib/lib_discord/resources/webhook.rb +0 -67
  89. data/lib/lib_discord/resources.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ae3f9c953b2390c8747f37d3d70fb8169a694a81469eba034a343badfffd1e7
4
- data.tar.gz: a7f5b5cf92875e3911973f25b7a1bd1ddab7351c9c9f6aad2c2d5c0bbcdfa44d
3
+ metadata.gz: fcbf266ea220ffa7a4901969dea1216fb6d577b2628f2e6f2aac6fad3ca7ed8b
4
+ data.tar.gz: c81814eb3b442d6f44398697ac6db5b8a85f9dfe689f11036d24add22739df44
5
5
  SHA512:
6
- metadata.gz: e7310c98cfbf7f99ef6cb655172295347ca32ff03840e9c6ad3f3310ad7f27640661047b398139cae38704d2fe57b71e6d779c8a1ba9f9e4e4e1e64667c70c28
7
- data.tar.gz: c29182660904ea451dfd131b3118b5d65b587e1966469a52ff818209dcdf18bab49a9c9191a4eac8fcf83ac7d306601739378ae1d4d3ea6271fe0df1333de9e5
6
+ metadata.gz: 7b611007899028a8ce743b5a31b8bdc7e4f15703bdd93bdebf2a66d44dd6e9b7fc9bcf499b1adb88c0271bf17817813ad4c3c0bd80e51fb440d0f1d5cfc1f464
7
+ data.tar.gz: 3d9e5574d4cd67fd156a527de4c58fe77bbb383165e80ea21df424edc92d87bc1eb643e89ab4c3f3c2235f7d0f77dd7778ef065acedb56e224ec7193c358affe
@@ -0,0 +1,43 @@
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 [Hash] 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
@@ -0,0 +1,341 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Application Commands
8
+ #
9
+ # Do not instantiate an {ApplicationCommand} directly. Instead request one
10
+ # from an instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # a = client["application_command"]
14
+ #
15
+ # @see https://discord.com/developers/docs/interactions/application-commands
16
+ # Discord documentation "Application Commands"
17
+ # @see https://discord.com/developers/docs/interactions/application-commands#permissions
18
+ # Discord documentation "Permissions"
19
+ class ApplicationCommand < Resource
20
+ ##
21
+ # @param application_id [#to_s]
22
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
23
+ # documentation "Snowflakes"}
24
+ # @param params [Hash] optional HTTP query parameters
25
+ #
26
+ # @return [Response]
27
+ #
28
+ # @raise [TimeoutError] if the HTTP request times out
29
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
30
+ # parameters string
31
+ #
32
+ # @see https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
33
+ # Discord documentation "Get Global Application Commands"
34
+ def get_global_application_commands(application_id:, params: {})
35
+ send_request(:get, "/applications/#{application_id}/commands", params:)
36
+ end
37
+
38
+ ##
39
+ # @param application_id [#to_s]
40
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
41
+ # documentation "Snowflakes"}
42
+ # @param json [Hash] JSON serializable payload
43
+ #
44
+ # @return [Response]
45
+ #
46
+ # @raise [TimeoutError] if the HTTP request times out
47
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
48
+ #
49
+ # @see https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
50
+ # Discord documentation "Create Global Application Command"
51
+ def create_global_application_command(application_id:, json:)
52
+ send_request(:post, "/applications/#{application_id}/commands", json:)
53
+ end
54
+
55
+ ##
56
+ # @param application_id [#to_s]
57
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
58
+ # documentation "Snowflakes"}
59
+ # @param command_id [#to_s]
60
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
61
+ # documentation "Snowflakes"}
62
+ #
63
+ # @return [Response]
64
+ #
65
+ # @raise [TimeoutError] if the HTTP request times out
66
+ #
67
+ # @see https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
68
+ # Discord documentation "Get Global Application Command"
69
+ def get_global_application_command(application_id:, command_id:)
70
+ send_request(:get, "/applications/#{application_id}/commands/#{command_id}")
71
+ end
72
+
73
+ ##
74
+ # @param application_id [#to_s]
75
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
76
+ # documentation "Snowflakes"}
77
+ # @param command_id [#to_s]
78
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
79
+ # documentation "Snowflakes"}
80
+ # @param json [Hash] JSON serializable payload
81
+ #
82
+ # @return [Response]
83
+ #
84
+ # @raise [TimeoutError] if the HTTP request times out
85
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
86
+ #
87
+ # @see https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
88
+ # Discord documentation "Edit Global Application Command"
89
+ def edit_global_application_command(application_id:, command_id:, json:)
90
+ send_request(:patch, "/applications/#{application_id}/commands/#{command_id}", json:)
91
+ end
92
+
93
+ ##
94
+ # @param application_id [#to_s]
95
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
96
+ # documentation "Snowflakes"}
97
+ # @param command_id [#to_s]
98
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
99
+ # documentation "Snowflakes"}
100
+ #
101
+ # @return [Response]
102
+ #
103
+ # @raise [TimeoutError] if the HTTP request times out
104
+ #
105
+ # @see https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command
106
+ # Discord documentation "Delete Global Application Command"
107
+ def delete_global_application_command(application_id:, command_id:)
108
+ send_request(:delete, "/applications/#{application_id}/commands/#{command_id}")
109
+ end
110
+
111
+ ##
112
+ # @param application_id [#to_s]
113
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
114
+ # documentation "Snowflakes"}
115
+ # @param json [Hash]
116
+ #
117
+ # @return [Response]
118
+ #
119
+ # @raise [TimeoutError] if the HTTP request times out
120
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
121
+ #
122
+ # @see https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
123
+ # Discord documentation "Bulk Overwrite Global Application Commands"
124
+ def bulk_overwrite_global_application_commands(application_id:, json:)
125
+ send_request(:put, "/applications/#{application_id}/commands", json:)
126
+ end
127
+
128
+ ##
129
+ # @param application_id [#to_s]
130
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
131
+ # documentation "Snowflakes"}
132
+ # @param guild_id [#to_s]
133
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
134
+ # documentation "Snowflakes"}
135
+ # @param params [Hash] optional HTTP query parameters
136
+ #
137
+ # @return [Response]
138
+ #
139
+ # @raise [TimeoutError] if the HTTP request times outs
140
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
141
+ # parameters string
142
+ #
143
+ # @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
144
+ # Discord documentation "Get Guild Application Commands"
145
+ def get_guild_application_commands(application_id:, guild_id:, params: {})
146
+ send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands", params:)
147
+ end
148
+
149
+ ##
150
+ # @param application_id [#to_s]
151
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
152
+ # documentation "Snowflakes"}
153
+ # @param guild_id [#to_s]
154
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
155
+ # documentation "Snowflakes"}
156
+ # @param json [Hash]
157
+ #
158
+ # @return [Response]
159
+ #
160
+ # @raise [TimeoutError] if the HTTP request times out
161
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
162
+ #
163
+ # @see https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
164
+ # Discord documentation "Create Guild Application Command"
165
+ def create_guild_application_command(application_id:, guild_id:, json:)
166
+ send_request(:post, "/applications/#{application_id}/guilds/#{guild_id}/commands", json:)
167
+ end
168
+
169
+ ##
170
+ # @param application_id [#to_s]
171
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
172
+ # documentation "Snowflakes"}
173
+ # @param guild_id [#to_s]
174
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
175
+ # documentation "Snowflakes"}
176
+ # @param command_id [#to_s]
177
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
178
+ # documentation "Snowflakes"}
179
+ #
180
+ # @return [Response]
181
+ #
182
+ # @raise [TimeoutError] if the HTTP request times out
183
+ #
184
+ # @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command
185
+ # Discord documentation "Get Guild Application Command"
186
+ def get_guild_application_command(application_id:, guild_id:, command_id:)
187
+ send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}")
188
+ end
189
+
190
+ ##
191
+ # @param application_id [#to_s]
192
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
193
+ # documentation "Snowflakes"}
194
+ # @param guild_id [#to_s]
195
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
196
+ # documentation "Snowflakes"}
197
+ # @param command_id [#to_s]
198
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
199
+ # documentation "Snowflakes"}
200
+ # @param json [Hash]
201
+ #
202
+ # @return [Response]
203
+ #
204
+ # @raise [TimeoutError] if the HTTP request times out
205
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
206
+ #
207
+ # @see https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
208
+ # Discord documentation "Edit Guild Application Command"
209
+ def edit_guild_application_command(application_id:, guild_id:, command_id:, json:)
210
+ send_request(:patch, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}", json:)
211
+ end
212
+
213
+ ##
214
+ # @param application_id [#to_s]
215
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
216
+ # documentation "Snowflakes"}
217
+ # @param guild_id [#to_s]
218
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
219
+ # documentation "Snowflakes"}
220
+ # @param command_id [#to_s]
221
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
222
+ # documentation "Snowflakes"}
223
+ #
224
+ # @return [Response]
225
+ #
226
+ # @raise [TimeoutError] if the HTTP request times out
227
+ #
228
+ # @see https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command
229
+ # Discord documentation "Delete Guild Application Command"
230
+ def delete_guild_application_command(application_id:, guild_id:, command_id:)
231
+ send_request(:delete, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}")
232
+ end
233
+
234
+ ##
235
+ # @param application_id [#to_s]
236
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
237
+ # documentation "Snowflakes"}
238
+ # @param guild_id [#to_s]
239
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
240
+ # documentation "Snowflakes"}
241
+ # @param json [Hash]
242
+ #
243
+ # @return [Response]
244
+ #
245
+ # @raise [TimeoutError] if the HTTP request times out
246
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
247
+ #
248
+ # @see https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
249
+ # Discord documentation "Bulk Overwrite Guild Application Commands"
250
+ def bulk_overwrite_guild_application_commands(application_id:, guild_id:, json:)
251
+ send_request(:put, "/applications/#{application_id}/guilds/#{guild_id}/commands", json:)
252
+ end
253
+
254
+ ##
255
+ # @param application_id [#to_s]
256
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
257
+ # documentation "Snowflakes"}
258
+ # @param guild_id [#to_s]
259
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
260
+ # documentation "Snowflakes"}
261
+ #
262
+ # @return [Response]
263
+ #
264
+ # @raise [TimeoutError] if the HTTP request times out
265
+ #
266
+ # @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
267
+ # Discord documentation "Get Guild Application Command Permissions"
268
+ def get_guild_application_command_permissions(application_id:, guild_id:)
269
+ send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands/permissions")
270
+ end
271
+
272
+ ##
273
+ # @param application_id [#to_s]
274
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
275
+ # documentation "Snowflakes"}
276
+ # @param guild_id [#to_s]
277
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
278
+ # documentation "Snowflakes"}
279
+ # @param command_id [#to_s]
280
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
281
+ # documentation "Snowflakes"}
282
+ #
283
+ # @raise [TimeoutError] if the HTTP request times out
284
+ #
285
+ # @see https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
286
+ # Discord documentation "Get Application Command Permissions"
287
+ def get_application_command_permissions(application_id:, guild_id:, command_id:)
288
+ send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions")
289
+ end
290
+
291
+ ##
292
+ # @param application_id [#to_s]
293
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
294
+ # documentation "Snowflakes"}
295
+ # @param guild_id [#to_s]
296
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
297
+ # documentation "Snowflakes"}
298
+ # @param command_id [#to_s]
299
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
300
+ # documentation "Snowflakes"}
301
+ # @param json [Hash]
302
+ #
303
+ # @return [Response]
304
+ #
305
+ # @raise [TimeoutError] if the HTTP request times out
306
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
307
+ #
308
+ # @see https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
309
+ # Discord documentation "Edit Application Command Permissions"
310
+ def edit_application_command_permissions(application_id:, guild_id:, command_id:, json:)
311
+ send_request(:put, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions", json:)
312
+ end
313
+
314
+ ##
315
+ # @deprecated This endpoint has been disabled with
316
+ # {https://discord.com/developers/docs/change-log#updated-command-permissions
317
+ # updates to command permissions (Permissions v2)}. Instead, you can
318
+ # {#edit_application_command_permissions edit each application command
319
+ # permissions} (though you should be careful to handle any potential
320
+ # {https://discord.com/developers/docs/topics/rate-limits rate limits}).
321
+ #
322
+ # @param application_id [#to_s]
323
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
324
+ # documentation "Snowflakes"}
325
+ # @param guild_id [#to_s]
326
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
327
+ # documentation "Snowflakes"}
328
+ # @param json [Hash]
329
+ #
330
+ # @return [Response]
331
+ #
332
+ # @raise [TimeoutError] if the HTTP request times out
333
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
334
+ #
335
+ # @see https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
336
+ # Discord documentation "Batch Edit Application Command Permissions"
337
+ def batch_edit_application_command_permissions(application_id:, guild_id:, json:)
338
+ send_request(:put, "/applications/#{application_id}/guilds/#{guild_id}/commands/permissions", json:)
339
+ end
340
+ end
341
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Application Role Connection Metadata
8
+ #
9
+ # Do not instantiate an {ApplicationRoleConnectionMetadata} directly. Instead
10
+ # request one from an instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # a = client["application_role_connection_metadata"]
14
+ #
15
+ # @see https://discord.com/developers/docs/resources/application-role-connection-metadata
16
+ # Discord documentation "Application Role Connection Metadata"
17
+ class ApplicationRoleConnectionMetadata < Resource
18
+ ##
19
+ # @param application_id [#to_s]
20
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
21
+ # documentation "Snowflakes"}
22
+ #
23
+ # @return [Response]
24
+ #
25
+ # @raise [TimeoutError] if the HTTP request times out
26
+ #
27
+ # @see https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records
28
+ # Discord documentation "Get Application Role Connection Metadata
29
+ # Records"
30
+ def get_application_role_connection_metadata_records(application_id:)
31
+ send_request(:get, "/applications/#{application_id}/role-connections/metadata")
32
+ end
33
+
34
+ ##
35
+ # @param application_id [#to_s]
36
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
37
+ # documentation "Snowflakes"}
38
+ # @param json [Hash] JSON serializable payload
39
+ #
40
+ # @return [Response]
41
+ #
42
+ # @raise [TimeoutError] if the HTTP request times out
43
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
44
+ #
45
+ # @see https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records
46
+ # Discord documentation "Update Application Role Connection Metadata
47
+ # Records"
48
+ def update_application_role_connection_metadata_records(application_id:, json:)
49
+ send_request(:put, "/applications/#{application_id}/role-connections/metadata", json:)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Audit Logs Resource
8
+ #
9
+ # Do not instantiate an {AuditLog} directly. Instead request one from an
10
+ # instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # a = client["audit_log"]
14
+ #
15
+ # @see https://discord.com/developers/docs/resources/audit-log#audit-logs-resource
16
+ # Discord documentation "Audit Logs Resource"
17
+ class AuditLog < Resource
18
+ ##
19
+ # @param guild_id [#to_s]
20
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
21
+ # documentation "Snowflakes"}
22
+ # @param params [Hash] optional HTTP query parameters
23
+ #
24
+ # @return [Response]
25
+ #
26
+ # @raise [TimeoutError] if the HTTP request times out
27
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
28
+ # parameters string
29
+ #
30
+ # @see https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
31
+ # Discord documentation "Get Guild Audit Log"
32
+ def get_guild_audit_log(guild_id:, params: {})
33
+ send_request(:get, "/guilds/#{guild_id}/audit-logs", params:)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Auto Moderation
8
+ #
9
+ # Do not instantiate an {AutoModeration} directly. Instead request one from
10
+ # an instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # a = client["auto_moderation"]
14
+ #
15
+ # @see https://discord.com/developers/docs/resources/auto-moderation Discord
16
+ # documentation "Auto Moderation"
17
+ class AutoModeration < Resource
18
+ ##
19
+ # @param guild_id [#to_s]
20
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
21
+ # documentation "Snowflakes"}
22
+ #
23
+ # @return [Response]
24
+ #
25
+ # @raise [TimeoutError] if the HTTP request times out
26
+ #
27
+ # @see https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild
28
+ # Discord documentation "List Auto Moderation Rules for Guild"
29
+ def list_auto_moderation_rules_for_guild(guild_id:)
30
+ send_request(:get, "/guilds/#{guild_id}/auto-moderation/rules")
31
+ end
32
+
33
+ ##
34
+ # @param guild_id [#to_s]
35
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
36
+ # documentation "Snowflakes"}
37
+ # @param auto_moderation_rule_id [#to_s]
38
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
39
+ # documentation "Snowflakes"}
40
+ #
41
+ # @return [Response]
42
+ #
43
+ # @raise [TimeoutError] if the HTTP request times out
44
+ #
45
+ # @see https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule
46
+ # Discord documentation "Get Auto Moderation Rule"
47
+ def get_auto_moderation_rule(guild_id:, auto_moderation_rule_id:)
48
+ send_request(:get, "/guilds/#{guild_id}/auto-moderation/rules/#{auto_moderation_rule_id}")
49
+ end
50
+
51
+ ##
52
+ # @param guild_id [#to_s]
53
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
54
+ # documentation "Snowflakes"}
55
+ # @param json [Hash] JSON serializable payload
56
+ #
57
+ # @return [Response]
58
+ #
59
+ # @raise [TimeoutError] if the HTTP request times out
60
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
61
+ #
62
+ # @see https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
63
+ # Discord documentation "Create Auto Moderation Rule"
64
+ def create_auto_moderation_rule(guild_id:, json:)
65
+ send_request(:post, "/guilds/#{guild_id}/auto-moderation/rules", json:)
66
+ end
67
+
68
+ ##
69
+ # @param guild_id [#to_s]
70
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
71
+ # documentation "Snowflakes"}
72
+ # @param auto_moderation_rule_id [#to_s]
73
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
74
+ # documentation "Snowflakes"}
75
+ # @param json [Hash] JSON serializable payload
76
+ #
77
+ # @return [Response]
78
+ #
79
+ # @raise [TimeoutError] if the HTTP request times out
80
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
81
+ #
82
+ # @see https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
83
+ # Discord documentation "Modify Auto Moderation Rule"
84
+ def modify_auto_moderation_rule(guild_id:, auto_moderation_rule_id:, json:)
85
+ send_request(:patch, "/guilds/#{guild_id}/auto-moderation/rules/#{auto_moderation_rule_id}", json:)
86
+ end
87
+
88
+ ##
89
+ # @param guild_id [#to_s]
90
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
91
+ # documentation "Snowflakes"}
92
+ # @param auto_moderation_rule_id [#to_s]
93
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
94
+ # documentation "Snowflakes"}
95
+ #
96
+ # @return [Response]
97
+ #
98
+ # @raise [TimeoutError] if the HTTP request times out
99
+ #
100
+ # @see https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule
101
+ # Discord documentation "Delete Auto Moderation Rule"
102
+ def delete_auto_moderation_rule(guild_id:, auto_moderation_rule_id:)
103
+ send_request(:delete, "/guilds/#{guild_id}/auto-moderation/rules/#{auto_moderation_rule_id}")
104
+ end
105
+ end
106
+ end