Skip to content

Commit

Permalink
fix getbynameoptional return order
Browse files Browse the repository at this point in the history
  • Loading branch information
zekroTJA committed Oct 5, 2021
1 parent 0d0424a commit b5b19ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (co CommandOptions) Options(i int) CommandOptions {
// name does not exist, the returned value for ok is false.
//
// This should be used for non-required options.
func (co CommandOptions) GetByNameOptional(name string) (ok bool, opt *discordgo.ApplicationCommandInteractionDataOption) {
func (co CommandOptions) GetByNameOptional(name string) (opt *discordgo.ApplicationCommandInteractionDataOption, ok bool) {
for _, c := range co {
if c.Name == name {
ok = true
Expand All @@ -45,6 +45,6 @@ func (co CommandOptions) GetByNameOptional(name string) (ok bool, opt *discordgo
//
// This should only be used on required options.
func (co CommandOptions) GetByName(name string) (opt *discordgo.ApplicationCommandInteractionDataOption) {
_, opt = co.GetByNameOptional(name)
opt, _ = co.GetByNameOptional(name)
return
}

0 comments on commit b5b19ab

Please sign in to comment.