package commands import ( "code.lowsec.club/okawari/go-discord-bot/lib/helpers" "context" "github.com/bwmarrin/discordgo" "github.com/rs/zerolog/log" ) type StockCommand struct{} func (s StockCommand) CreateCommand() *discordgo.ApplicationCommand { return &discordgo.ApplicationCommand{ ID: "stock", Name: "stock", Description: "Change stock of traded commodity", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionString, Name: "commodity", Description: "Ticker of wanted commodity", Required: true, MinLength: helpers.Pointer(1), MaxLength: 3, }, { Type: discordgo.ApplicationCommandOptionInteger, Name: "amount", Description: "Amount of commodity in stock", Required: true, MinValue: helpers.Pointer(0.0), }, }, } } func (s StockCommand) Handle(ctx context.Context, session *discordgo.Session, command *discordgo.InteractionCreate) { logger := log.Ctx(ctx) err := session.InteractionRespond(command.Interaction, helpers.EphemeralResponse("Surprise 2!")) if err != nil { logger.Error().Str("user", command.User.Username).Err(err).Msg("Unable to respond to request from user") } } func NewStockCommand() StockCommand { return StockCommand{} }