Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMsgs = map[ParseError]error{ ErrParseInt: errors.New("failed to parse integer. For /track, you must supply the tracking rounds (last argumemt) in integer"), ErrParseFloat: errors.New("failed to parse float. For /alert, you must supply the target price (last argument) in floating point number"), ErrInvalidSign: errors.New("failed to parse comparison sign. For /alert, you may only supply '>' or '<' before the target price as comparison condition"), ErrInvalidBidAskSwitch: errors.New("failed to parse bid/ask switch. For /alert with bid/ask price, you may only supply 'bid' or 'ask' before the comparison sign"), ErrInvalidQuoteTypeBid: errors.New("source does not support bid price. Omit the bid keyword"), ErrInvalidQuoteTypeAsk: errors.New("source does not support ask price. Omit the ask keyword"), ErrInvalidQuoteTypeLast: errors.New("source does not support last price. Add either 'bid' or 'ask' keyword before the comparison sign"), }
Functions ¶
This section is empty.
Types ¶
type BotCommand ¶
type BotCommand struct { Help helpCommand `json:"-"` Quote quoteCommand `json:"quote,omitempty"` Track trackCommand `json:"track,omitempty"` Alert usecase.Alert `json:"alert,omitempty"` }
The commands are parsed from UserCommand into BotCommand. quoteCommand and trackCommand are almost identical in their usecases, so they share quoteCommand, which has []usecase.Security. On the other hand, alertCommand is imported directly as usecase.Alert, which also has usecase.Security (not slice).
type ParseError ¶
type ParseError int
const ( // These errors are non-zero NoErr ParseError = iota ErrParseInt ErrParseFloat ErrInvalidSign ErrInvalidBidAskSwitch ErrInvalidQuoteTypeBid ErrInvalidQuoteTypeAsk ErrInvalidQuoteTypeLast )
type UserCommand ¶
type UserCommand struct { Text string `json:"chat,omitempty"` TargetBot enums.BotType `json:"command,omitempty"` }
The commands are parsed from UserCommand into BotCommand. quoteCommand and trackCommand are almost identical in their usecases, so they share quoteCommand, which has []usecase.Security. On the other hand, alertCommand is imported directly as usecase.Alert, which also has usecase.Security (not slice).
func (UserCommand) Parse ¶
func (c UserCommand) Parse() (cmd BotCommand, e ParseError)
Parse parses UserCommand to BotCommand
Click to show internal directories.
Click to hide internal directories.