himbot/command/hs.go

31 lines
690 B
Go
Raw Normal View History

package command
import (
2024-10-21 23:50:17 -06:00
"fmt"
2024-10-21 23:50:17 -06:00
"github.com/bwmarrin/discordgo"
)
2024-10-21 23:50:17 -06:00
func HsCommand(s *discordgo.Session, i *discordgo.InteractionCreate) {
options := i.ApplicationCommandData().Options
nickname := options[0].StringValue()
2024-10-21 23:50:17 -06:00
var username string
if i.Member != nil {
username = i.Member.User.Username
} else if i.User != nil {
username = i.User.Username
} else {
username = "User"
}
2024-10-21 23:50:17 -06:00
response := fmt.Sprintf("%s was %s's nickname in highschool!", nickname, username)
2024-10-21 23:50:17 -06:00
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: response,
},
})
}