Skip to content

Instantly share code, notes, and snippets.

@shinderuman
Created September 13, 2019 15:46
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/03925ef1bafb960148f6725feb3d2a6b to your computer and use it in GitHub Desktop.
Save shinderuman/03925ef1bafb960148f6725feb3d2a6b 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 {
if /* クソコードスレイヤーからのメンション付き発言だったら */ {
continue
}
c.PostStatus(context.Background(), &mastodon.Toot{
Status: "@nacika 「またプリン買ったの?プリン食べ過ぎだよ」",
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment