Skip to contents

This function posts the toots from a toot_df to Mastodon. It used a token that must be stored in an environment variable (see rtoot::auth_setup() and rtoot::convert_token_to_envvar()(,

Usage

post_thread_from_df(
  x,
  tokenname = getOption("quartodon_tokenname", "RTOOT_DEFAULT_TOKEN"),
  ...
)

Arguments

x

A toot_df as produced by a call to prep_and_check_toot_df() or append_thread_counter(); or the object produced by a call to split_to_toots(), or the toot_df contained in such an object (in $df).

tokenname

The name of the environment variable containing the rtoot token produced with rtoot::auth_setup() and rtoot::convert_token_to_envvar().

...

Any additional arguments are passed to the call to rtoot::post_toot().

Value

An object with the results of the calls to rtoot::post_toot().

Examples

### Get example post directory
examplePostDir <-
  system.file("example-post",
              package = "quartodon");

### Get an example text (see the intro vignette)
exampleText <-
  readLines(
    file.path(examplePostDir, "quartodon.Rmd"),
    encoding = "UTF-8"
  );

### Extract toots, add thread counters, prepare and
### check the toots, and preview the thread in the viewer
toot_df <-
  quartodon::get_prep_check_toots(
    exampleText,
    postsPath = examplePostDir
  );

### Post the thread - note that this requires
### your {rtoot} token to be stored in an
### environment variable called
### "RTOOT_DEFAULT_TOKEN".
if (FALSE) {
  quartodon::post_thread_from_df(
    toot_df
  );
}