diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-04 10:57:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-04 10:57:03 +0300 |
| commit | 618676cbead6eb6bfdc57ebbc34227306a707dfa (patch) | |
| tree | e9f1b92e180ea73346e877dc2482f7ab155c792c /internal/run.go | |
| parent | c40a0fc690a94ab1e9f3253f4e85b394769b3617 (diff) | |
can post to mastodon
Diffstat (limited to 'internal/run.go')
| -rw-r--r-- | internal/run.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/run.go b/internal/run.go index 4d600f0..3f27300 100644 --- a/internal/run.go +++ b/internal/run.go @@ -4,8 +4,10 @@ import ( "context" "errors" "log" + "strings" "codeberg.org/snonux/gos/internal/config" + "codeberg.org/snonux/gos/internal/platforms/mastodon" "codeberg.org/snonux/gos/internal/queue" "codeberg.org/snonux/gos/internal/schedule" ) @@ -29,6 +31,22 @@ func Run(ctx context.Context, args config.Args) error { } log.Println("Scheduling", ent) + switch strings.ToLower(platform) { + case "mastodon": + if args.DryRun { + log.Println("Not posting", ent, "to", platform, "as dry-run enabled") + continue + } + if err := mastodon.Post(ctx, args, ent); err != nil { + return err + } + if err := ent.MarkPosted(); err != nil { + return err + } + log.Println("Posted", ent, "to", platform) + default: + log.Println("WARNING: Platform", platform, "not yet implemented") + } } return nil |
