|
|
|
@ -13,16 +13,18 @@ import (
@@ -13,16 +13,18 @@ import (
|
|
|
|
|
|
|
|
|
|
// Options holds... run... options...
|
|
|
|
|
type Options struct { |
|
|
|
|
KeybaseLoction string // Optional, but required if keybase is not in your path
|
|
|
|
|
HomeDir string // Only use this if you know what you're doing
|
|
|
|
|
EnableTyping bool // Show others a typing notification while the bot is working on a command
|
|
|
|
|
BotLiteMode bool // Defaults to true - only disable if you need to.
|
|
|
|
|
KeybaseLoction string // Optional, but required if keybase is not in your path
|
|
|
|
|
HomeDir string // Only use this if you know what you're doing
|
|
|
|
|
EnableTyping bool // Show others a typing notification while the bot is working on a command
|
|
|
|
|
BotLiteMode bool // Defaults to true - only disable if you need to.
|
|
|
|
|
ChannelBufferSize int // The size of the channel buffers, may vary on rate of message ingestion
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewOptions returns a new instance of *Options with sensible defaults
|
|
|
|
|
func NewOptions() *Options { |
|
|
|
|
return &Options{ |
|
|
|
|
BotLiteMode: true, |
|
|
|
|
BotLiteMode: true, |
|
|
|
|
ChannelBufferSize: 10, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -83,9 +85,9 @@ type KeybaseAPIResponse struct {
@@ -83,9 +85,9 @@ type KeybaseAPIResponse struct {
|
|
|
|
|
func NewAPI(options *Options) *ChatAPI { |
|
|
|
|
return &ChatAPI{ |
|
|
|
|
opts: options, |
|
|
|
|
inChan: make(chan []byte), |
|
|
|
|
outChan: make(chan []byte), |
|
|
|
|
errChan: make(chan error), |
|
|
|
|
inChan: make(chan []byte, options.ChannelBufferSize), |
|
|
|
|
outChan: make(chan []byte, options.ChannelBufferSize), |
|
|
|
|
errChan: make(chan error, options.ChannelBufferSize), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|