Documentation ¶
Overview ¶
Package bot contains all bots implementations and tests to them Multibot is a manager for all bots to simply distribute messages to all bots
Index ¶
Constants ¶
View Source
const ( ChatTypePrivate = 0 ChatTypeGroup = 1 ChatTypeChannel = 2 )
All recognizable chat types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot interface { OnMessage(msg Message) *Response // nil if nothing to send Help() string // returns help message - how to use this bot }
Bot describes a particular bot, that reacts on messages and sends whatever
type GroupBot ¶
type GroupBot struct {
GroupBotParams
}
GroupBot gathers usernames into one mention, like @admins
func NewGroupBot ¶
func NewGroupBot(params GroupBotParams) *GroupBot
NewGroupBot initializes an instance of GroupBot
type GroupBotParams ¶
type GroupBotParams struct { Store groups.Store RespondAllCommands bool GetGroupMembers func(chatID string) ([]User, error) }
GroupBotParams describes all necessary parameters for correct working of GroupBot
type Message ¶
type Message struct { ID string ChatID string ChatType ChatType From *User Sent time.Time Text string `json:",omitempty"` AddedBotToChat bool }
Message to pass data from/to bot
type MockBot ¶
MockBot is an autogenerated mock type for the Bot type
type Response ¶
type Response struct { Text string // text of the message Pin bool // enable pin Unpin bool // unpin current pinned message Preview bool // enable web preview Reply bool // message that we have to reply to, might be nil, if caused by other action BanInterval time.Duration // bot banning user set the interval }
Response describes bot's answer on particular message
Click to show internal directories.
Click to hide internal directories.