A bot that toots out new Pleroma releases. https://social.bn4t.me/PleromaReleases
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.

31 lines
616B

  1. package main
  2. import (
  3. "context"
  4. "github.com/mattn/go-mastodon"
  5. "log"
  6. "os"
  7. )
  8. func FileExists(filename string) bool {
  9. info, err := os.Stat(filename)
  10. if os.IsNotExist(err) {
  11. return false
  12. }
  13. return !info.IsDir()
  14. }
  15. func initMastoApp() (clientId string, clientSecret string) {
  16. app, err := mastodon.RegisterApp(context.Background(), &mastodon.AppConfig{
  17. Server: os.Getenv("SERVER_URL"),
  18. ClientName: "pleroma-release-bot",
  19. Scopes: "read write follow",
  20. Website: "https://git.bn4t.me/bn4t/pleroma-release-bot",
  21. })
  22. if err != nil {
  23. log.Fatal(err)
  24. }
  25. return app.ClientID, app.ClientSecret
  26. }