Documentation ¶
Overview ¶
The controller package implements the Team type.
Index ¶
- Constants
- func MigrateModuleConfig(c *database.Conn) error
- type AllProtectedModuleConfig
- type DBModuleConfig
- func (c *DBModuleConfig) Add(key string, defaultValue string)
- func (c *DBModuleConfig) AddProtect(key string, defaultValue string, protect bool)
- func (c *DBModuleConfig) Get(key string) (string, error)
- func (c *DBModuleConfig) GetIsDefault(key string) (string, bool, error)
- func (c *DBModuleConfig) GetIsDefaultNotProtected(key string) (string, bool, error)
- func (c *DBModuleConfig) ListDefaults() map[string]string
- func (c *DBModuleConfig) ListProtected() map[string]bool
- func (c *DBModuleConfig) LockDefaults()
- func (c *DBModuleConfig) OnModify(f func(key string))
- func (c *DBModuleConfig) Set(key, value string) error
- func (c *DBModuleConfig) SetDefault(key string) error
- type Team
- func (t *Team) AbsoluteURL(path string) string
- func (t *Team) ArchiveURL(msgID slack.MessageID) string
- func (t *Team) BotUser() slack.UserID
- func (t *Team) ChannelIDByName(chName string) slack.ChannelID
- func (t *Team) ChannelMemberCount(channel slack.ChannelID) int
- func (t *Team) ChannelMemberList(channel slack.ChannelID) []slack.UserID
- func (t *Team) ChannelName(channel slack.ChannelID) string
- func (t *Team) ConnectHTTP(l net.Listener)
- func (t *Team) ConnectRTM(c *rtm.Client)
- func (t *Team) DB() *database.Conn
- func (t *Team) DependModule(self marvin.Module, dependID marvin.ModuleID, ptr *marvin.Module) int
- func (t *Team) DisableModule(ident marvin.ModuleID) error
- func (t *Team) DispatchCommand(args *marvin.CommandArguments) marvin.CommandResult
- func (t *Team) Domain() string
- func (t *Team) EnableModule(ident marvin.ModuleID) error
- func (t *Team) EnableModules() bool
- func (t *Team) FormatChannel(channel slack.ChannelID) string
- func (t *Team) GetAllEnabledModules() []marvin.ModuleStatus
- func (t *Team) GetAllModules() []marvin.ModuleStatus
- func (t *Team) GetIM(user slack.UserID) (slack.ChannelID, error)
- func (t *Team) GetIMOtherUser(im slack.ChannelID) (slack.UserID, error)
- func (t *Team) GetModule(ident marvin.ModuleID) marvin.Module
- func (t *Team) GetModuleStatus(ident marvin.ModuleID) marvin.ModuleStatus
- func (t *Team) GetRTMClient() interface{}
- func (t *Team) HTTPMiddleware(f func(http.Handler) http.Handler)
- func (t *Team) HandleHTTP(folder string, handler http.Handler) *mux.Route
- func (t *Team) Help(args *marvin.CommandArguments) marvin.CommandResult
- func (t *Team) ModuleConfig(ident marvin.ModuleID) marvin.ModuleConfig
- func (t *Team) ModuleConfigList() []marvin.ModuleID
- func (t *Team) OffAllEvents(mod marvin.ModuleID)
- func (t *Team) OnEvent(mod marvin.ModuleID, event string, f func(slack.RTMRawMessage))
- func (t *Team) OnEveryEvent(mod marvin.ModuleID, f func(slack.RTMRawMessage))
- func (t *Team) OnNormalMessage(mod marvin.ModuleID, f func(slack.RTMRawMessage))
- func (t *Team) OnSpecialMessage(mod marvin.ModuleID, msgSubtype []string, f func(slack.RTMRawMessage))
- func (t *Team) PrivateChannelInfo(channel slack.ChannelID) (*slack.Channel, error)
- func (t *Team) PublicChannelInfo(channel slack.ChannelID) (*slack.Channel, error)
- func (t *Team) ReactMessage(msgID slack.MessageID, emojiName string) error
- func (t *Team) RegisterCommand(name string, c marvin.SubCommand)
- func (t *Team) RegisterCommandFunc(name string, c marvin.SubCommandFunc, help string) marvin.SubCommand
- func (t *Team) ReportError(err error, source marvin.ActionSource)
- func (t *Team) ResolveChannelName(input string) slack.ChannelID
- func (t *Team) ResolveUserName(input string) slack.UserID
- func (t *Team) Router() *mux.Router
- func (t *Team) SendComplexMessage(channelID slack.ChannelID, message slack.OutgoingSlackMessage) (slack.MessageTS, slack.RTMRawMessage, error)
- func (t *Team) SendMessage(channel slack.ChannelID, message string) (slack.MessageTS, slack.RTMRawMessage, error)
- func (t *Team) Shutdown()
- func (t *Team) SlackAPIPostJSON(method string, form url.Values, result interface{}) error
- func (t *Team) SlackAPIPostRaw(method string, form url.Values) (*http.Response, error)
- func (t *Team) TeamConfig() *marvin.TeamConfig
- func (t *Team) TeamID() slack.TeamID
- func (t *Team) UnregisterCommand(name string)
- func (t *Team) UserInChannels(user slack.UserID, channels ...slack.ChannelID) map[slack.ChannelID]bool
- func (t *Team) UserInfo(user slack.UserID) (*slack.User, error)
- func (t *Team) UserLevel(user slack.UserID) marvin.AccessLevel
- func (t *Team) UserName(user slack.UserID) string
Constants ¶
const ConfTurnOffModule = "off"
Variables ¶
This section is empty.
Functions ¶
func MigrateModuleConfig ¶
Types ¶
type AllProtectedModuleConfig ¶
type AllProtectedModuleConfig struct {
*DBModuleConfig
}
func (AllProtectedModuleConfig) GetIsDefaultNotProtected ¶
func (c AllProtectedModuleConfig) GetIsDefaultNotProtected(key string) (string, bool, error)
type DBModuleConfig ¶
type DBModuleConfig struct { ModuleIdentifier marvin.ModuleID // All writes to the maps must happen during the Load() phase. // DefaultsLocked is set afterwards, in single-thread code. DefaultsLocked bool // contains filtered or unexported fields }
func (*DBModuleConfig) Add ¶
func (c *DBModuleConfig) Add(key string, defaultValue string)
func (*DBModuleConfig) AddProtect ¶
func (c *DBModuleConfig) AddProtect(key string, defaultValue string, protect bool)
func (*DBModuleConfig) GetIsDefault ¶
func (c *DBModuleConfig) GetIsDefault(key string) (string, bool, error)
GetIsDefault gets a module configuration value, but does not require the key have been initialized.
1) If the key was not initialized with Add(), value is the empty string, isDefault is true, and err is ErrConfNoDefault. 2) If the key was initialized, but has no override, value is the default value, isDefault is true, and err is nil. 3) If the key has an override, value is the override, isDefault is false, and err is nil.
implements marvin.ModuleConfig.GetIsDefault
func (*DBModuleConfig) GetIsDefaultNotProtected ¶
func (c *DBModuleConfig) GetIsDefaultNotProtected(key string) (string, bool, error)
func (*DBModuleConfig) ListDefaults ¶
func (c *DBModuleConfig) ListDefaults() map[string]string
func (*DBModuleConfig) ListProtected ¶
func (c *DBModuleConfig) ListProtected() map[string]bool
func (*DBModuleConfig) LockDefaults ¶
func (c *DBModuleConfig) LockDefaults()
func (*DBModuleConfig) OnModify ¶
func (c *DBModuleConfig) OnModify(f func(key string))
func (*DBModuleConfig) Set ¶
func (c *DBModuleConfig) Set(key, value string) error
func (*DBModuleConfig) SetDefault ¶
func (c *DBModuleConfig) SetDefault(key string) error
type Team ¶
type Team struct {
// contains filtered or unexported fields
}
func (*Team) AbsoluteURL ¶
MakeURL takes a (non-rooted) path to the webserver and makes it absolute.
func (*Team) ChannelMemberList ¶
func (*Team) ConnectHTTP ¶
func (*Team) ConnectRTM ¶
func (*Team) DependModule ¶
DependModule places the instance of the requested module in the given pointer.
If the requested module is already enabled, the pointer is filled immediately and the function returns 1. If the requested module has errored, the pointer is left along and the function returns -2. During loading, when the requested module has not been enabled yet, the function returns 0 and remembers the pointer. If the requested module is not known, the function returns -1.
func (*Team) DispatchCommand ¶
func (t *Team) DispatchCommand(args *marvin.CommandArguments) marvin.CommandResult
func (*Team) EnableModules ¶
func (*Team) GetAllEnabledModules ¶
func (t *Team) GetAllEnabledModules() []marvin.ModuleStatus
func (*Team) GetAllModules ¶
func (t *Team) GetAllModules() []marvin.ModuleStatus
func (*Team) GetIMOtherUser ¶
func (*Team) GetModuleStatus ¶
func (t *Team) GetModuleStatus(ident marvin.ModuleID) marvin.ModuleStatus
func (*Team) GetRTMClient ¶
func (t *Team) GetRTMClient() interface{}
func (*Team) Help ¶
func (t *Team) Help(args *marvin.CommandArguments) marvin.CommandResult
func (*Team) ModuleConfig ¶
func (t *Team) ModuleConfig(ident marvin.ModuleID) marvin.ModuleConfig
func (*Team) ModuleConfigList ¶
func (*Team) OffAllEvents ¶
func (*Team) OnEveryEvent ¶
func (t *Team) OnEveryEvent(mod marvin.ModuleID, f func(slack.RTMRawMessage))
func (*Team) OnNormalMessage ¶
func (t *Team) OnNormalMessage(mod marvin.ModuleID, f func(slack.RTMRawMessage))
func (*Team) OnSpecialMessage ¶
func (*Team) PrivateChannelInfo ¶
func (*Team) PublicChannelInfo ¶
func (*Team) ReactMessage ¶
func (*Team) RegisterCommand ¶
func (t *Team) RegisterCommand(name string, c marvin.SubCommand)
func (*Team) RegisterCommandFunc ¶
func (t *Team) RegisterCommandFunc(name string, c marvin.SubCommandFunc, help string) marvin.SubCommand
func (*Team) ReportError ¶
func (t *Team) ReportError(err error, source marvin.ActionSource)
func (*Team) SendComplexMessage ¶
func (t *Team) SendComplexMessage(channelID slack.ChannelID, message slack.OutgoingSlackMessage) (slack.MessageTS, slack.RTMRawMessage, error)
func (*Team) SendMessage ¶
func (*Team) SlackAPIPostJSON ¶
func (*Team) SlackAPIPostRaw ¶
func (*Team) TeamConfig ¶
func (t *Team) TeamConfig() *marvin.TeamConfig