Skip to content

Commit

Permalink
refactor: rename optmap to optionMap
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed May 10, 2024
1 parent 3f07774 commit 9cd45fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/bwmarrin/discordgo"
)

type optmap = map[string]*discordgo.ApplicationCommandInteractionDataOption
type optionMap = map[string]*discordgo.ApplicationCommandInteractionDataOption

func parseOpts(options []*discordgo.ApplicationCommandInteractionDataOption) (om optmap) {
om = make(optmap)
func parseOptions(options []*discordgo.ApplicationCommandInteractionDataOption) (om optionMap) {
om = make(optionMap)
for _, opt := range options {
om[opt.Name] = opt
}
Expand All @@ -27,7 +27,7 @@ func interactionAuthor(i *discordgo.Interaction) *discordgo.User {
return i.User
}

func handleEcho(s *discordgo.Session, i *discordgo.InteractionCreate, opts optmap) {
func handleEcho(s *discordgo.Session, i *discordgo.InteractionCreate, opts optionMap) {
builder := new(strings.Builder)
if v, ok := opts["author"]; ok && v.BoolValue() {
author := interactionAuthor(i.Interaction)
Expand Down Expand Up @@ -91,7 +91,7 @@ func main() {
return
}

handleEcho(s, i, parseOpts(data.Options))
handleEcho(s, i, parseOptions(data.Options))
})

session.AddHandler(func(s *discordgo.Session, r *discordgo.Ready) {
Expand Down

0 comments on commit 9cd45fc

Please sign in to comment.