package main import ( "os" "path/filepath" "github.com/line/line-bot-sdk-go/v7/linebot" "github.com/rs/zerolog/log" ) func Mkdir(args ...interface{}) error { var path string var mode os.FileMode mode = 0755 for _, arg := range args { switch arg := arg.(type) { case string: path = filepath.Join(path, arg) case os.FileMode: mode = arg } } return os.MkdirAll(path, mode) } func Hit(name, uid string) { n := &Node{ Name: name, UserID: uid, } go DB.Create(n) } func SendMessage(replyToken string, to string, messages ...linebot.SendingMessage) (*linebot.BasicResponse, error) { if replyToken != "" { res, err := bot.ReplyMessage(replyToken, messages...).Do() if err != nil { log.Error().Err(err).Caller().Interface("response", res).Msg("reply error") } return res, err } else { res, err := bot.PushMessage(to, messages...).Do() if err != nil { log.Error().Err(err).Caller().Interface("response", res).Msg("push error") } return res, err } }