本文整理匯總了Golang中github.com/wcharczuk/jarvis/jarvis/core.Bot.JobManager方法的典型用法代碼示例。如果您正苦於以下問題:Golang Bot.JobManager方法的具體用法?Golang Bot.JobManager怎麽用?Golang Bot.JobManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/wcharczuk/jarvis/jarvis/core.Bot
的用法示例。
在下文中一共展示了Bot.JobManager方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handleJobEnable
func (j *Jobs) handleJobEnable(b core.Bot, m *slack.Message) error {
messageWithoutMentions := util.TrimWhitespace(core.LessMentions(m.Text))
pieces := strings.Split(messageWithoutMentions, " ")
if len(pieces) > 1 {
taskName := pieces[len(pieces)-1]
b.JobManager().EnableJob(taskName)
return b.Sayf(m.Channel, "enabled job `%s`", taskName)
}
return exception.New("unhandled response.")
}
示例2: handleJobsStatus
func (j *Jobs) handleJobsStatus(b core.Bot, m *slack.Message) error {
statusText := "current job statuses:\n"
for _, status := range b.JobManager().Status() {
if len(status.RunningFor) != 0 {
statusText = statusText + fmt.Sprintf(">`%s` - state: %s running for: %s\n", status.Name, status.State, status.RunningFor)
} else {
statusText = statusText + fmt.Sprintf(">`%s` - state: %s\n", status.Name, status.State)
}
}
return b.Say(m.Channel, statusText)
}
示例3: handleJobRun
func (j *Jobs) handleJobRun(b core.Bot, m *slack.Message) error {
messageWithoutMentions := util.TrimWhitespace(core.LessMentions(m.Text))
pieces := strings.Split(messageWithoutMentions, " ")
if len(pieces) > 1 {
jobName := pieces[len(pieces)-1]
b.JobManager().RunJob(jobName)
return b.Sayf(m.Channel, "ran job `%s`", jobName)
}
b.JobManager().RunAllJobs()
return b.Say(m.Channel, "ran all jobs")
}
示例4: Init
// Init does nothing right now.
func (j *Jobs) Init(b core.Bot) error {
b.JobManager().LoadJob(jobs.NewClock(b))
b.JobManager().DisableJob("clock")
return nil
}