本文整理匯總了Golang中github.com/kyokomi/slackbot/plugins.BotEvent.Reply方法的典型用法代碼示例。如果您正苦於以下問題:Golang BotEvent.Reply方法的具體用法?Golang BotEvent.Reply怎麽用?Golang BotEvent.Reply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kyokomi/slackbot/plugins.BotEvent
的用法示例。
在下文中一共展示了BotEvent.Reply方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool {
c := CronCommand{}
if err := c.Scan(message); err != nil {
log.Printf("error %s", err)
return false
}
switch c.Action {
case AddAction, RandomAddAction:
message := p.cron.AddCronCommand(event.Channel(), c)
p.cron.RefreshCron(&event, event.Channel())
event.Reply(message)
case DelAction, DeleteAction, StopAction:
message := p.cron.DelCronCommand(event.Channel(), c)
p.cron.RefreshCron(&event, event.Channel())
event.Reply(message)
case ListAction:
message := p.cron.ListCronCommand(event.Channel(), c)
event.Reply(message)
case RefreshAction:
p.cron.RefreshCron(&event, event.Channel())
event.Reply("```\nrefresh ok\n```")
case HelpAction:
message := p.cron.HelpCronCommand(event.Channel(), c)
event.Reply(message)
}
return false
}
示例2: DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool {
sendMessage, isNext := GetLGTMImageURL(p.buildRandomURL(message))
event.Reply(sendMessage)
return isNext // next stop
}
示例3: DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool {
cmdArgs := strings.Fields(message)
if _, ok := p.commandMap[cmdArgs[0]]; !ok {
return true
}
event.Reply(p.executeCommand(cmdArgs...))
return false // next ok
}
示例4: DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool {
query := strings.Replace(strings.TrimLeft(message, "image me"), "image me", "", 1)
links, err := p.client.GetImageLinks(query)
if err != nil {
log.Println(err)
return false
}
idx := int(p.rd.Int() % len(links))
event.Reply(links[idx])
return false // next ng
}
示例5: DoAction
func (r plugin) DoAction(event plugins.BotEvent, message string) bool {
// Contextを取得
redisKey := buildRoomContextKey(event.Channel())
dialogueCtx, _ := r.repository.Load(redisKey)
// 雑談API叩く
name := event.SenderName()
req := docomo.DialogueRequest{
Utt: &message,
Context: &dialogueCtx,
Nickname: &name,
}
res, err := r.client.Dialogue.Get(req, false)
if err != nil {
event.Reply("はて?")
return true
} else if res.RequestError.PolicyException.MessageID != "" {
event.Reply(fmt.Sprintf("%s: %s",
res.RequestError.PolicyException.MessageID,
res.RequestError.PolicyException.Text),
)
return true
}
// 結果を返す
event.Reply(res.Utt)
// Contextを保存
if dialogueCtx == "" {
r.repository.Save(redisKey, res.Context)
}
return false // next ok
}
示例6: DoAction
func (r *plugin) DoAction(event plugins.BotEvent, message string) bool {
size := utf8.RuneCountInString(message)
header := ""
for i := 0; i < size+2; i++ {
header += "人"
}
fotter := ""
for i := 0; i < size; i++ {
fotter += "^Y"
}
reMessage := "_" + header + "_"
reMessage += "\n"
reMessage += "> " + message + " <"
reMessage += "\n"
reMessage += " ̄Y" + fotter + " ̄"
event.Reply(reMessage)
return false // next ok
}
示例7: DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool {
event.Reply(message)
return true // next ok
}
示例8: DoAction
func (r plugin) DoAction(event plugins.BotEvent, message string) bool {
event.Reply(r.kohaAPI.GetImageURL())
return false // next ng
}
示例9: DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool {
event.Reply(p.getRandomNaruhodo())
return false // next ng
}
示例10: DoAction
func (p *plugin) DoAction(event plugins.BotEvent, message string) bool {
daisuki := strings.Replace(strings.TrimLeft(message, keyword), keyword, "", 1)
event.Reply(fmt.Sprintf("わぁい%s あかり%s大好き", daisuki, daisuki))
return false // next ok
}