Deliver Atom feed items on Misskey
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
743 B

package publisher
import (
"path"
"gitea.code-infection.com/efertone/kiki/pkg/misskey"
)
// Misskey publisher.
type Misskey struct {
Client misskey.ClientInterface
}
const (
misskeyName = "misskey"
)
// NewMisskey creates a new Misskey publisher.
func NewMisskey(baseURL, token string) *Misskey {
return &Misskey{
Client: misskey.NewClient(baseURL, token),
}
}
// Name returns with the name of the publisher.
func (m *Misskey) Name() string {
return misskeyName
}
// Publish simply publishes a Note.
func (m *Misskey) Publish(content, image string) error {
var file *misskey.FileCreateResponse
if image != "" {
file, _ = m.Client.CreateFileFromURL(image, path.Base(image))
}
return m.Client.CreateNote(content, file)
}