shardlab / discordrb

Discord API for Ruby
MIT License
536 stars 98 forks source link

Fix edit_application_command with global scope. #253

Closed jackorp closed 2 months ago

jackorp commented 9 months ago

Summary

A condition has errors when editing globally scoped command. Firstly, #type is called on object that might be nil, which results into: "Exception: #<NoMethodError: undefined method `type' for nil:NilClass>" in the logs.

Secondly, fix the method name itself as it should be edit_global_command, since guild commands are dealt with in previous branch.


Excuse the brevity of the following sections, but this is a very simple one-line fix for an error encountered when programming my bot.

Fixed

Fix Exception: #<NoMethodError: undefined methodtype' for nil:NilClass>`

and (once the passed in arguments is fixed) Exception: #<Discordrb::Errors::UnknownError: Discordrb::Errors::UnknownError>

wouterdedroog commented 2 months ago

@swarley I included the fix as proposed here in #254, which is now merged.

swarley commented 2 months ago

That's interesting given that the diff looked to be in order Edit: aaah i see

swarley commented 2 months ago

Sorry about that, that's on me for not being more proactive in checking through these. I appreciate the work but I'll be closing this now that it's redundant.