Documentation
¶
Index ¶
- type CSVLogger
- type CompositeLogger
- type GroupMeBot
- func (b *GroupMeBot) AddHook(trigger string, response func(InboundMessage) string)
- func (b *GroupMeBot) ConfigureFromJson(filename string) error
- func (b *GroupMeBot) HandleMessage(msg InboundMessage)
- func (b *GroupMeBot) Handler() http.HandlerFunc
- func (b *GroupMeBot) SendMessage(outMessage string) (*http.Response, error)
- type InboundMessage
- type Logger
- type OutboundMessage
- type StdOutLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSVLogger ¶
type CSVLogger struct {
LogFile string
}
func (CSVLogger) LogMessage ¶
func (logger CSVLogger) LogMessage(msg InboundMessage)
type CompositeLogger ¶
type CompositeLogger struct {
Loggers []Logger
}
func (CompositeLogger) LogMessage ¶
func (suite CompositeLogger) LogMessage(msg InboundMessage)
type GroupMeBot ¶
type GroupMeBot struct { ID string `json:"bot_id"` GroupID string `json:"group_id"` Host string `json:"host"` Port string `json:"port"` TrackBotMessages bool `json:"trackbotmessages"` Server string Hooks map[string]func(InboundMessage) string Logger }
func (*GroupMeBot) AddHook ¶
func (b *GroupMeBot) AddHook(trigger string, response func(InboundMessage) string)
func (*GroupMeBot) ConfigureFromJson ¶
func (b *GroupMeBot) ConfigureFromJson(filename string) error
/ This reads a json file containing the keys / See the example bot_cfg.json / Updates existing bot with parameters from JSON filename / Returns err from ioutil if file can not be read
func (*GroupMeBot) HandleMessage ¶
func (b *GroupMeBot) HandleMessage(msg InboundMessage)
func (*GroupMeBot) Handler ¶
func (b *GroupMeBot) Handler() http.HandlerFunc
This is legitimate black magic, this is pretty cool, not usually able to do things like this in other languages. This is a function that takes a list of trigger functions and returns a function that can handle the Server Requests
func (*GroupMeBot) SendMessage ¶
func (b *GroupMeBot) SendMessage(outMessage string) (*http.Response, error)
type InboundMessage ¶
type InboundMessage struct { Id string `json:"id"` Avatar_url string `json:"avatar_url"` Name string `json:"name"` Sender_id string `json:"sender_id"` Sender_type string `json:"sender_type"` System bool `json:"system"` Text string `json:"text"` Source_guid string `json:"source_guid"` Created_at int `json:"created_at"` User_id string `json:"user_id"` Group_id string `json:"group_id"` Favorited_by []string `json:"favorited_by"` Attachments []map[string]interface{} `json:"attachments"` }
type Logger ¶
type Logger interface {
LogMessage(msg InboundMessage)
}
A CSVLogger comes with the bot, but any logger can be substituted so long as it satisfies this interface
type OutboundMessage ¶
type StdOutLogger ¶
type StdOutLogger struct { }
func (StdOutLogger) LogMessage ¶
func (logger StdOutLogger) LogMessage(msg InboundMessage)
Click to show internal directories.
Click to hide internal directories.