@@ -22,7 +22,7 @@ class Application
2222 # @return [String] the application's name.
2323 attr_reader :name
2424
25- # @return [String] the application's description.
25+ # @return [String] the application's description, or an empty string if the application doesn't have a description .
2626 attr_reader :description
2727
2828 # @return [Array<String>] the application's origins permitted to use RPC.
@@ -42,10 +42,6 @@ class Application
4242 attr_reader :public
4343 alias_method :public? , :public
4444
45- # @return [Profile] the user object of the associated bot for this application.
46- attr_reader :profile
47- alias_method :bot , :profile
48-
4945 # @return [true, false] whether the bot requires the full OAuth2 code grant in order to join servers.
5046 attr_reader :requires_code_grant
5147 alias_method :requires_code_grant? , :requires_code_grant
@@ -170,7 +166,7 @@ def add_integration_type(type:, scopes: nil, permissions: nil)
170166 # Update the flags of this application. I recommend using this instead of {#flags=}.
171167 # @param add [Array<Integer, Symbol> Integer, Symbol] The flags to add to the application.
172168 # @param remove [Array<Integer, Symbol> Integer, Symbol] The flags to remove from the application.
173- # @note The flags will be removed first, then added. Only limited intent flags can be updated.
169+ # @note The flags will be removed first, and then added. Only limited intent flags can be updated.
174170 def update_flags ( add : 0 , remove : 0 )
175171 flags = lambda do |value |
176172 [ *value ] . map { |flag_bit | FLAGS [ flag_bit ] || flag_bit . to_i } . reduce ( &:| )
@@ -217,45 +213,45 @@ def flags=(flags)
217213 end
218214
219215 # Set the description for the application.
220- # @param description [String] The new description for the application.
216+ # @param description [String, nil ] The new description for the application.
221217 def description = ( description )
222- update_application ( description : description )
223- end
224-
225- # Set the URL that webhook events will be sent to for the application.
226- # @param events_url [String] The new URL that webhook events will be sent to.
227- def webhook_events_url = ( events_url )
228- update_application ( event_webhooks_url : events_url )
229- end
230-
231- # Set the custom installation URL for the application.
232- # @param install_url [String] The new default custom authorization URL for the application.
233- def custom_install_url = ( install_url )
234- update_application ( custom_install_url : install_url )
218+ update_application ( description : description || '' )
235219 end
236220
237221 # Set the webhook events that the applicaton is subscribed to.
238- # @param event_types [Array<String>] The new webhook event types to subscribe to for the application .
222+ # @param event_types [Array<String>] The new webhook event types to subscribe to.
239223 def webhook_event_types = ( event_types )
240224 update_application ( event_webhooks_types : event_types )
241225 end
242226
243227 # Set the status of webhook events for the application.
244- # @param events_status [Integer] The new status of webhook events. `1` for disabled, `2` for enabled .
228+ # @param events_status [Integer] The new webhook events status for the application .
245229 def webhook_events_status = ( events_status )
246230 update_application ( event_webhooks_status : events_status )
247231 end
248232
233+ # Set the URL that webhook events will be sent to for the application.
234+ # @param events_url [String, nil] The new URL that webhook events will be sent to.
235+ def webhook_events_url = ( events_url )
236+ update_application ( event_webhooks_url : events_url || '' )
237+ end
238+
239+ # Set the custom installation URL for the application.
240+ # @param install_url [String, nil] The new default custom authorization URL for the application.
241+ def custom_install_url = ( install_url )
242+ update_application ( custom_install_url : install_url || '' )
243+ end
244+
249245 # Set the endpoint that will reccieve interaction over HTTP POST for the application.
250- # @param endpoint_url [String] The new endpoint. Must pass security validation or the request will fail .
246+ # @param endpoint_url [String, nil ] The new interactions endpoint. Must pass security validation.
251247 def interactions_endpoint_url = ( endpoint_url )
252- update_application ( interactions_endpoint_url : endpoint_url )
248+ update_application ( interactions_endpoint_url : endpoint_url || '' )
253249 end
254250
255251 # Set the role connection verification URL for the application.
256- # @param verification_url [String] The new role connections verification URL for the application.
252+ # @param verification_url [String, nil ] The new role connections verification URL for the application.
257253 def role_connections_verification_url = ( verification_url )
258- update_application ( role_connections_verification_url : verification_url )
254+ update_application ( role_connections_verification_url : verification_url || '' )
259255 end
260256
261257 # The inspect method is overwritten to give more useful output.
@@ -301,7 +297,6 @@ def update_data(new_data)
301297 @owner = new_data [ 'owner' ] ? @bot . ensure_user ( new_data [ 'owner' ] ) : nil
302298
303299 @public = new_data [ 'bot_public' ]
304- @profile = new_data [ 'bot' ] ? Profile . new ( new_data [ 'bot' ] , @bot ) : nil
305300 @requires_code_grant = new_data [ 'bot_require_code_grant' ]
306301 @terms_of_service_url = new_data [ 'terms_of_service_url' ]
307302 @privacy_policy_url = new_data [ 'privacy_policy_url' ]
0 commit comments