Files
slack2asana/slack2asana.go

49 lines
651 B
Go
Raw Normal View History

2022-10-20 22:03:07 -07:00
package main
import (
2022-10-23 06:10:46 +00:00
"fmt"
2022-10-20 22:03:07 -07:00
)
2022-10-23 06:10:46 +00:00
func main() {
2022-10-28 06:30:08 +00:00
ac := NewAsanaClient()
2022-10-27 23:38:49 +00:00
sc := NewSlackClient()
2022-10-20 22:03:07 -07:00
2022-10-27 23:38:49 +00:00
stars, err := sc.GetStars()
2022-10-23 06:10:46 +00:00
if err != nil {
panic(err)
}
for _, item := range stars {
if item.Type != "message" {
continue
}
2022-10-27 23:38:49 +00:00
user, err := sc.GetUser(item.Message.User)
2022-10-23 23:14:24 +00:00
if err != nil {
panic(err)
}
2022-10-27 23:38:49 +00:00
channel, err := sc.GetChannel(item.Channel)
2022-10-23 23:14:24 +00:00
if err != nil {
panic(err)
}
2022-10-27 23:38:49 +00:00
title, err := sc.GetTitle(item, user, channel)
2022-10-23 23:14:24 +00:00
if err != nil {
panic(err)
}
2022-10-23 23:14:24 +00:00
fmt.Printf("%s\n", title)
2022-10-27 22:51:06 +00:00
2022-10-28 06:30:08 +00:00
err = ac.CreateTask(title)
if err != nil {
panic(err)
}
2022-10-27 23:38:49 +00:00
err = sc.RemoveStar(item)
2022-10-27 22:51:06 +00:00
if err != nil {
panic(err)
}
2022-10-23 23:14:24 +00:00
}
}