Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export(parse_stream)
export(post_list_accounts)
export(post_list_create)
export(post_status)
export(post_thread)
export(post_toot)
export(post_user)
export(rtoot)
Expand Down
48 changes: 48 additions & 0 deletions R/post.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,51 @@ post_status <- function(
}
invisible(r)
}

#' Post a thread
#'
#' Create a thread of your messages.
#' @inheritParams post_toot
#' @returns A character vector with the ids of the toots posted.
#' @export
#' @examples
#' \dontrun{
#' pt <- post_thread(visibility = "direct")
#' }
post_thread <- function(
status = c("my first rtoot #rstats", "my first thread with rtoot"),
# media = NULL,
# alt_text = NULL,
token = NULL,
sensitive = FALSE,
spoiler_text = NULL,
visibility = "public",
scheduled_at = NULL,
language = NULL,
verbose = TRUE
) {
token <- check_token_rtoot(token)
if (!is.character(status)) {
cli::cli_abort("`status` must be a string, it is a {typeof(status)}.")
}
toot_id <- NULL
ids <- vector("character", length = length(status))
for (msg_i in seq_along(status)) {
toot <- post_toot(status[msg_i],
in_reply_to_id = toot_id,
token = token,
sensitive = sensitive,
spoiler_text = spoiler_text,
visibility = visibility,
scheduled_at = scheduled_at,
language = language,
verbose = FALSE)
resp <- httr::content(toot)
ids[msg_i] <- resp$id
toot_id <- ids[msg_i]
}
if (sum(!nzchar(ids)) == length(status)) {
sayif(verbose, "Your thread has been posted")
}
invisible(ids)
}
45 changes: 45 additions & 0 deletions man/post_thread.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading