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
@@ -0,0 +1,133 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Guild Scheduled Event
8
+ #
9
+ # Do not instantiate a {GuildScheduledEvent} directly. Instead request one
10
+ # from an instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # g = client["guild_scheduled_event"]
14
+ #
15
+ # @see https://discord.com/developers/docs/resources/guild-scheduled-event
16
+ # Discord documentation "Guild Scheduled Event"
17
+ class GuildScheduledEvent < 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/guild-scheduled-event#list-scheduled-events-for-guild
31
+ # Discord documentation "List Scheduled Events for Guild"
32
+ def list_scheduled_events_for_guild(guild_id:, params: {})
33
+ send_request(:get, "/guilds/#{guild_id}/scheduled-events", params:)
34
+ end
35
+
36
+ ##
37
+ # @param guild_id [#to_s]
38
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
39
+ # documentation "Snowflakes"}
40
+ # @param json [Hash] JSON serializable payload
41
+ #
42
+ # @return [Response]
43
+ #
44
+ # @raise [TimeoutError] if the HTTP request times out
45
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
46
+ #
47
+ # @see https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
48
+ # Discord documentation "Create Guild Scheduled Event"
49
+ def create_guild_scheduled_event(guild_id:, json:)
50
+ send_request(:post, "/guilds/#{guild_id}/scheduled-events", json:)
51
+ end
52
+
53
+ ##
54
+ # @param guild_id [#to_s]
55
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
56
+ # documentation "Snowflakes"}
57
+ # @param guild_scheduled_event_id [#to_s]
58
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
59
+ # documentation "Snowflakes"}
60
+ # @param params [Hash] optional HTTP query parameters
61
+ #
62
+ # @return [Response]
63
+ #
64
+ # @raise [TimeoutError] if the HTTP request times out
65
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
66
+ # parameters string
67
+ #
68
+ # @see https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event
69
+ # Discord documentation "Get Guild Scheduled Event"
70
+ def get_guild_scheduled_event(guild_id:, guild_scheduled_event_id:, params: {})
71
+ send_request(:get, "/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}", params:)
72
+ end
73
+
74
+ ##
75
+ # @param guild_id [#to_s]
76
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
77
+ # documentation "Snowflakes"}
78
+ # @param guild_scheduled_event_id [#to_s]
79
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
80
+ # documentation "Snowflakes"}
81
+ # @param json [Hash] JSON serializable payload
82
+ #
83
+ # @return [Response]
84
+ #
85
+ # @raise [TimeoutError] if the HTTP request times out
86
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
87
+ #
88
+ # @see https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
89
+ # Discord documentation "Modify Guild Scheduled Event"
90
+ def modify_guild_scheduled_event(guild_id:, guild_scheduled_event_id:, json:)
91
+ send_request(:patch, "/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}", json:)
92
+ end
93
+
94
+ ##
95
+ # @param guild_id [#to_s]
96
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
97
+ # documentation "Snowflakes"}
98
+ # @param guild_scheduled_event_id [#to_s]
99
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
100
+ # documentation "Snowflakes"}
101
+ #
102
+ # @return [Response]
103
+ #
104
+ # @raise [TimeoutError] if the HTTP request times out
105
+ #
106
+ # @see https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event
107
+ # Discord documentation "Delete Guild Scheduled Event"
108
+ def delete_guild_scheduled_event(guild_id:, guild_scheduled_event_id:)
109
+ send_request(:delete, "/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}")
110
+ end
111
+
112
+ ##
113
+ # @param guild_id [#to_s]
114
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
115
+ # documentation "Snowflakes"}
116
+ # @param guild_scheduled_event_id [#to_s]
117
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
118
+ # documentation "Snowflakes"}
119
+ # @param params [Hash] optional HTTP query parameters
120
+ #
121
+ # @return [Response]
122
+ #
123
+ # @raise [TimeoutError] if the HTTP request times out
124
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
125
+ # parameters string
126
+ #
127
+ # @see https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
128
+ # Discord documentation "Get Guild Scheduled Event Users"
129
+ def get_guild_scheduled_event_users(guild_id:, guild_scheduled_event_id:, params: {})
130
+ send_request(:get, "/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}/users", params:)
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Guild Template Resource
8
+ #
9
+ # Do not instantiate a {GuildTemplate} directly. Instead request from an
10
+ # instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # g = client["guild_template"]
14
+ #
15
+ # @see https://discord.com/developers/docs/resources/guild-template#get-guild-template
16
+ # Discord documentation "Guild Template Resource"
17
+ class GuildTemplate < Resource
18
+ ##
19
+ # @param template_code [#to_s]
20
+ #
21
+ # @return [Response]
22
+ #
23
+ # @raise [TimeoutError] if the HTTP request times out
24
+ #
25
+ # @see https://discord.com/developers/docs/resources/guild-template#get-guild-template
26
+ # Discord documentation "Get Guild Template"
27
+ def get_guild_template(template_code:)
28
+ send_request(:get, "/guilds/templates/#{template_code}")
29
+ end
30
+
31
+ ##
32
+ # @param template_code [#to_s]
33
+ # @param json [Hash] JSON serializable payload
34
+ #
35
+ # @return [Response]
36
+ #
37
+ # @raise [TimeoutError] if the HTTP request times out
38
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
39
+ #
40
+ # @see https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template
41
+ # Discord documentation "Create Guild from Guild Template"
42
+ def create_guild_from_guild_template(template_code:, json:)
43
+ send_request(:post, "/guilds/templates/#{template_code}", json:)
44
+ end
45
+
46
+ ##
47
+ # @param guild_id [#to_s]
48
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
49
+ # documentation "Snowflakes"}
50
+ #
51
+ # @return [Response]
52
+ #
53
+ # @raise [TimeoutError] if the HTTP request times out
54
+ #
55
+ # @see https://discord.com/developers/docs/resources/guild-template#get-guild-templates
56
+ # Discord documentation "Get Guild Templates"
57
+ def get_guild_templates(guild_id:)
58
+ send_request(:get, "/guilds/#{guild_id}/templates")
59
+ end
60
+
61
+ ##
62
+ # @param guild_id [#to_s]
63
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
64
+ # documentation "Snowflakes"}
65
+ # @param json [Hash] JSON serializable payload
66
+ #
67
+ # @return [Response]
68
+ #
69
+ # @raise [TimeoutError] if the HTTP request times out
70
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
71
+ #
72
+ # @see https://discord.com/developers/docs/resources/guild-template#create-guild-template
73
+ # Discord documentation "Create Guild Template"
74
+ def create_guild_template(guild_id:, json:)
75
+ send_request(:post, "/guilds/#{guild_id}/templates", json:)
76
+ end
77
+
78
+ ##
79
+ # @param guild_id [#to_s]
80
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
81
+ # documentation "Snowflakes"}
82
+ # @param template_code [#to_s]
83
+ #
84
+ # @return [Response]
85
+ #
86
+ # @raise [TimeoutError] if the HTTP request times out
87
+ #
88
+ # @see https://discord.com/developers/docs/resources/guild-template#sync-guild-template
89
+ # Discord documentation "Sync Guild Template"
90
+ def sync_guild_template(guild_id:, template_code:)
91
+ send_request(:put, "/guilds/#{guild_id}/templates/#{template_code}")
92
+ end
93
+
94
+ ##
95
+ # @param guild_id [#to_s]
96
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
97
+ # documentation "Snowflakes"}
98
+ # @param template_code [#to_s]
99
+ # @param json [Hash] JSON serializable payload
100
+ #
101
+ # @return [Response]
102
+ #
103
+ # @raise [TimeoutError] if the HTTP request times out
104
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
105
+ #
106
+ # @see https://discord.com/developers/docs/resources/guild-template#modify-guild-template
107
+ # Discord documentation "Modify Guild Template"
108
+ def modify_guild_template(guild_id:, template_code:, json:)
109
+ send_request(:patch, "/guilds/#{guild_id}/templates/#{template_code}", json:)
110
+ end
111
+
112
+ ##
113
+ # @param guild_id [#to_s]
114
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
115
+ # documentation "Snowflakes"}
116
+ # @param template_code [#to_s]
117
+ #
118
+ # @return [Response]
119
+ #
120
+ # @raise [TimeoutError] if the HTTP request times out
121
+ #
122
+ # @see https://discord.com/developers/docs/resources/guild-template#delete-guild-template
123
+ # Discord documentation "Delete Guild Template"
124
+ def delete_guild_template(guild_id:, template_code:)
125
+ send_request(:delete, "/guilds/#{guild_id}/templates/#{template_code}")
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,163 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Interactions
8
+ #
9
+ # Do not instantiate an {Interaction} directly. Instead request one from an
10
+ # instance fo {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # i = client["interaction"]
14
+ #
15
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding
16
+ # Discord documentation "Interactions"
17
+ class Interaction < Resource
18
+ ##
19
+ # @param interaction_id [#to_s]
20
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
21
+ # documentation "Snowflakes"}
22
+ # @param interaction_token [#to_s]
23
+ # @param json [Hash] JSON serializable payload
24
+ #
25
+ # @return [Response]
26
+ #
27
+ # @raise [TimeoutError] if the HTTP request times out
28
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
29
+ #
30
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
31
+ # Discord documentation "Create Interaction Response"
32
+ def create_interaction_response(interaction_id:, interaction_token:, json:)
33
+ send_request(:post, "/interactions/#{interaction_id}/#{interaction_token}/callback", json:)
34
+ end
35
+
36
+ ##
37
+ # @param application_id [#to_s]
38
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
39
+ # documentation "Snowflakes"}
40
+ # @param interaction_token [#to_s]
41
+ #
42
+ # @return [Response]
43
+ #
44
+ # @raise [TimeoutError] if the HTTP request times out
45
+ #
46
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
47
+ # Discord documentation "Get Original Interaction Response"
48
+ def get_original_interaction_response(application_id:, interaction_token:)
49
+ send_request(:get, "/webhooks/#{application_id}/#{interaction_token}/messages/@original")
50
+ end
51
+
52
+ ##
53
+ # @param application_id [#to_s]
54
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
55
+ # documentation "Snowflakes"}
56
+ # @param interaction_token [#to_s]
57
+ # @param json [Hash] JSON serializable payload
58
+ #
59
+ # @return [Response]
60
+ #
61
+ # @raise [TimeoutError] if the HTTP request times out
62
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
63
+ #
64
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
65
+ # Discord documentation "Edit Original Interaction Response"
66
+ def edit_original_interaction_response(application_id:, interaction_token:, json:)
67
+ send_request(:patch, "/webhooks/#{application_id}/#{interaction_token}/messages/@original", json:)
68
+ end
69
+
70
+ ##
71
+ # @param application_id [#to_s]
72
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
73
+ # documentation "Snowflakes"}
74
+ # @param interaction_token [#to_s]
75
+ #
76
+ # @return [Response]
77
+ #
78
+ # @raise [TimeoutError] if the HTTP request times out
79
+ #
80
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
81
+ # Discord documentation "Delete Original Interaction Response"
82
+ def delete_original_interaction_response(application_id:, interaction_token:)
83
+ send_request(:delete, "/webhooks/#{application_id}/#{interaction_token}/messages/@original")
84
+ end
85
+
86
+ ##
87
+ # @param application_id [#to_s]
88
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
89
+ # documentation "Snowflakes"}
90
+ # @param interaction_token [#to_s]
91
+ # @param json [Hash] JSON serializable payload
92
+ #
93
+ # @return [Response]
94
+ #
95
+ # @raise [TimeoutError] if the HTTP request times out
96
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
97
+ #
98
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
99
+ # Discord documentation "Create Followup Message"
100
+ def create_followup_message(application_id:, interaction_token:, json:)
101
+ send_request(:post, "/webhooks/#{application_id}/#{interaction_token}", json:)
102
+ end
103
+
104
+ ##
105
+ # @param application_id [#to_s]
106
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
107
+ # documentation "Snowflakes"}
108
+ # @param interaction_token [#to_s]
109
+ # @param message_id [#to_s]
110
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
111
+ # documentation "Snowflakes"}
112
+ #
113
+ # @return [Response]
114
+ #
115
+ # @raise [TimeoutError] if the HTTP request times out
116
+ #
117
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
118
+ # Discord documentation "Get Followup Message"
119
+ def get_followup_message(application_id:, interaction_token:, message_id:)
120
+ send_request(:get, "/webhooks/#{application_id}/#{interaction_token}/messages/#{message_id}")
121
+ end
122
+
123
+ ##
124
+ # @param application_id [#to_s]
125
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
126
+ # documentation "Snowflakes"}
127
+ # @param interaction_token [#to_s]
128
+ # @param message_id [#to_s]
129
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
130
+ # documentation "Snowflakes"}
131
+ # @param json [Hash] JSON serializable payload
132
+ #
133
+ # @return [Response]
134
+ #
135
+ # @raise [TimeoutError] if the HTTP request times out
136
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
137
+ #
138
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
139
+ # Discord documentation "Edit Followup Message"
140
+ def edit_followup_message(application_id:, interaction_token:, message_id:, json:)
141
+ send_request(:patch, "/webhooks/#{application_id}/#{interaction_token}/messages/#{message_id}", json:)
142
+ end
143
+
144
+ ##
145
+ # @param application_id [#to_s]
146
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
147
+ # documentation "Snowflakes"}
148
+ # @param interaction_token [#to_s]
149
+ # @param message_id [#to_s]
150
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
151
+ # documentation "Snowflakes"}
152
+ #
153
+ # @return [Response]
154
+ #
155
+ # @raise [TimeoutError] if the HTTP request times out
156
+ #
157
+ # @see https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
158
+ # Discord documentation "Delete Followup Message"
159
+ def delete_followup_message(application_id:, interaction_token:, message_id:)
160
+ send_request(:delete, "/webhooks/#{application_id}/#{interaction_token}/messages/#{message_id}")
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Invite Resource
8
+ #
9
+ # Do not instantiate an {Invite} directly. Instead request one from an
10
+ # instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # i = client["invite"]
14
+ #
15
+ # @see https://discord.com/developers/docs/resources/invite Discord
16
+ # documentation "Invite Resource"
17
+ class Invite < Resource
18
+ ##
19
+ # @param invite_code [#to_s]
20
+ # @param params [Hash] optional HTTP query parameters
21
+ #
22
+ # @return [Response]
23
+ #
24
+ # @raise [TimeoutError] if the HTTP request times out
25
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
26
+ # parameters string
27
+ #
28
+ # @see https://discord.com/developers/docs/resources/invite#get-invite
29
+ # Discord documentation "Get Invite"
30
+ def get_invite(invite_code:, params: {})
31
+ send_request(:get, "/invites/#{invite_code}", params:)
32
+ end
33
+
34
+ ##
35
+ # @param invite_code [#to_s]
36
+ #
37
+ # @return [Response]
38
+ #
39
+ # @raise [TimeoutError] if the HTTP request times out
40
+ #
41
+ # @see https://discord.com/developers/docs/resources/invite#delete-invite
42
+ # Discord documentation "Delete Invite"
43
+ def delete_invite(invite_code:)
44
+ send_request(:delete, "/invites/#{invite_code}")
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
7
+ # Application Command Option Types}
8
+ module ApplicationCommandOptionTypes
9
+ SUB_COMMAND = 1
10
+ SUB_COMMAND_GROUP = 2
11
+ STRING = 3
12
+ INTEGER = 4
13
+ BOOLEAN = 5
14
+ USER = 6
15
+ CHANNEL = 7
16
+ ROLE = 8
17
+ MENTIONABLE = 9
18
+ NUMBER = 10
19
+ ATTACHMENT = 11
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
7
+ # Application Command Permission Types}
8
+ module ApplicationCommandPermissionTypes
9
+ ROLE = 1
10
+ USER = 2
11
+ CHANNEL = 3
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
7
+ # Application Command Types}
8
+ module ApplicationCommandTypes
9
+ CHAT_INPUT = 1
10
+ USER = 2
11
+ MESSAGE = 3
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/resources/application#application-object-application-integration-types
7
+ # Application Integrations Types}
8
+ module ApplicationIntegrationTypes
9
+ GUILD_INSTALL = 0
10
+ USER_INSTALL = 1
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type
7
+ # Application Role Connection Metadata Types}
8
+ module ApplicationRoleConnectionMetadataTypes
9
+ INTEGER_LESS_THAN_OR_EQUAL = 1
10
+ INTEGER_GREATER_THAN_OR_EQUAL = 2
11
+ INTEGER_EQUAL = 3
12
+ INTEGER_NOT_EQUAL = 4
13
+ DATETIME_LESS_THAN_OR_EQUAL = 5
14
+ DATETIME_GREATER_THAN_OR_EQUAL = 6
15
+ BOOLEAN_EQUAL = 7
16
+ BOOLEAN_NOT_EQUAL = 8
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
7
+ # Audit Log Events}
8
+ module AuditLogEvents
9
+ GUILD_UPDATE = 1
10
+ CHANNEL_CREATE = 10
11
+ CHANNEL_UPDATE = 11
12
+ CHANNEL_DELETE = 12
13
+ CHANNEL_OVERWRITE_CREATE = 13
14
+ CHANNEL_OVERWRITE_UPDATE = 14
15
+ CHANNEL_OVERWRITE_DELETE = 15
16
+ MEMBER_KICK = 20
17
+ MEMBER_PRUNE = 21
18
+ MEMBER_BAN_ADD = 22
19
+ MEMBER_BAN_REMOVE = 23
20
+ MEMBER_UPDATE = 24
21
+ MEMBER_ROLE_UPDATE = 25
22
+ MEMBER_MOVE = 26
23
+ MEMBER_DISCONNECT = 27
24
+ BOT_ADD = 28
25
+ ROLE_CREATE = 30
26
+ ROLE_UPDATE = 31
27
+ ROLE_DELETE = 32
28
+ INVITE_CREATE = 40
29
+ INVITE_UPDATE = 41
30
+ INVITE_DELETE = 42
31
+ WEBHOOK_CREATE = 50
32
+ WEBHOOK_UPDATE = 51
33
+ WEBHOOK_DELETE = 52
34
+ EMOJI_CREATE = 60
35
+ EMOJI_UPDATE = 61
36
+ EMOJI_DELETE = 62
37
+ MESSAGE_DELETE = 72
38
+ MESSAGE_BULK_DELETE = 73
39
+ MESSAGE_PIN = 74
40
+ MESSAGE_UNPIN = 75
41
+ INTEGRATION_CREATE = 80
42
+ INTEGRATION_UPDATE = 81
43
+ INTEGRATION_DELETE = 82
44
+ STAGE_INSTANCE_CREATE = 83
45
+ STAGE_INSTANCE_UPDATE = 84
46
+ STAGE_INSTANCE_DELETE = 85
47
+ STICKER_CREATE = 90
48
+ STICKER_UPDATE = 91
49
+ STICKER_DELETE = 92
50
+ GUILD_SCHEDULED_EVENT_CREATE = 100
51
+ GUILD_SCHEDULED_EVENT_UPDATE = 101
52
+ GUILD_SCHEDULED_EVENT_DELETE = 102
53
+ THREAD_CREATE = 110
54
+ THREAD_UPDATE = 111
55
+ THREAD_DELETE = 112
56
+ APPLICATION_COMMAND_PERMISSION_UPDATE = 121
57
+ AUTO_MODERATION_RULE_CREATE = 140
58
+ AUTO_MODERATION_RULE_UPDATE = 141
59
+ AUTO_MODERATION_RULE_DELETE = 142
60
+ AUTO_MODERATION_BLOCK_MESSAGE = 143
61
+ AUTO_MODERATION_FLAG_TO_CHANNEL = 144
62
+ AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145
63
+ CREATOR_MONETIZATION_REQUEST_CREATED = 150
64
+ CREATOR_MONETIZATION_TERMS_ACCEPTED = 151
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
7
+ # Auto Moderation Action Types}
8
+ module AutoModerationActionTypes
9
+ BLOCK_MESSAGE = 1
10
+ SEND_ALERT_MESSAGE = 2
11
+ TIMEOUT = 3
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
7
+ # Auto Moderation Event Types}
8
+ module AutoModerationEventTypes
9
+ MESSAGE_SEND = 1
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibDiscord
4
+ module Mappers
5
+ ##
6
+ # {https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types
7
+ # Auto Moderation Keyword Preset Types}
8
+ module AutoModerationKeywordPresetTypes
9
+ PROFANITY = 1
10
+ SEXUAL_CONTENT = 2
11
+ SLURS = 3
12
+ end
13
+ end
14
+ end