Skip to content

Instantly share code, notes, and snippets.

@shinderuman
Created September 13, 2019 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinderuman/33139c940171deb713973088e197f606 to your computer and use it in GitHub Desktop.
Save shinderuman/33139c940171deb713973088e197f606 to your computer and use it in GitHub Desktop.
c := mastodon.NewClient(&mastodon.Config{
Server: "",
ClientID: "",
ClientSecret: "",
})
wsc := c.NewWSClient()
q, err := wsc.StreamingWSPublic(context.Background(), true)
if err != nil {
log.Fatal(err)
}
for e := range q {
if t, ok := e.(*mastodon.UpdateEvent); ok {
c.PostStatus(context.Background(), &mastodon.Toot{
Status: t.Status.Content,
})
}
}
D∂
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment