twitter-together / action

:bird: A GitHub action to tweet from a repository

Home Page:https://github.com/marketplace/actions/twitter-together

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`.tweet` Front Matter syntax for replies, retweets, schedule, media, and more

gr2m opened this issue Β· comments

Here is a list of previous feature requests that I'd like to cover

Suggestion

A Front Matter for *.tweet files, similar to Jekyll's Front Matter

Most simple example

Front Matter would be optional, so the simplest *.tweet file would only contain text:

Hi, this is my tweet

Threads

Multiple tweets can be seperated by --- surrounded by empty lines

Hi, this is my first tweet

---

And this is my second twee

The delimiter can be configured, similar to a multipart email boundary

---
thread-delimiter: ~~~
---

Hi, this is my first tweet

~~~

And this is my second twee

Reply

---
reply: https://twitter.com/coderefine/status/1311044915602903043
---

Reply text here

Retweets

With text

---
retweet: https://twitter.com/coderefine/status/1311044915602903043
---

quote text heer

Without text

---
retweet: https://twitter.com/coderefine/status/1311044915602903043
---

Attachments

Gif

---
media:
- url: https://media2.giphy.com/media/vFKqnCdLPNOKc/giphy.gif
  alt: Alternative text here
---

My tweet here

My understanding is that max 1 video or one gif can be attached, or up to 4 images.

Schedule a tweet

Timezones are hard. I'd go with the simplest and only accept UTC.

---
schedule: 2021-11-13T00:10:12Z
---

My tweet here

I'm open to suggestions. We could alternatively accept an object with time and datetime properteties, e.g.

---
schedule: 
  time-zone: America/Los_Angeles
  date: 2021-11-13
  time: 16:10
---

My tweet here

But this can quickly become a rabbit whole of complexity.

Polls

The current twitter-together supports polls with a special syntax in the text body, but when we introduce front matter I'd rather use that to be coherent.

---
poll: 
- option 1
- option 2
- option 3
- option 4
---

Tweet text shown above the poll here

Please let me know what you think! If you asked for or would like to use any of the twitter features that twitter-together is not supporting today please let me know if the syntax would cover it

I realize that one thing the current format does not cover is media attachments & polls in tweets other than the first when sending a thread.

I guess the front-matter could be repeated, but then only a few options are permitted for subsequent thread tweets, so it might get confusing pretty quick.

An alternative would be not use front-matter for attachments and polls. We currently support polls with this syntax

My text

( ) option 1
( ) option 2
( ) option 3
( ) option 4

And we discussed a syntax for attachments like this

^ https://media2.giphy.com/media/vFKqnCdLPNOKc/giphy.gif|Alternative text here

We could use front-matter to define alternative characters to define uploads and poll options, similar to

---
thread-delimiter: ~~~
---

These look like solid improvements πŸ’₯

I agree timezones are hard --- and YAML error prone. I +1 your thinking 😊

If anyone is interested in helping: the first step will be to create a validator for the new syntax. I'll create a dedicated repository for that shortly. If you'd like to help or if you can share advice on creating parsers for custom file formats like the one we discuss here, or if you are aware of another file format which has parsers / validators / formatters that we could research as a reference point, please let me know.

If anyone is interested in helping: the first step will be to create a validator for the new syntax. I'll create a dedicated repository for that shortly. If you'd like to help or if you can share advice on creating parsers for custom file formats like the one we discuss here, or if you are aware of another file format which has parsers / validators / formatters that we could research as a reference point, please let me know.

I'm interested in helping build this πŸ™Œ. I've built a parser before using ANTLR (though if I were to go for it again for a pure JS project I'd use Chevrotain)

I realize that one thing the current format does not cover is media attachments & polls in tweets other than the first when sending a thread.

I guess the front-matter could be repeated, but then only a few options are permitted for subsequent thread tweets, so it might get confusing pretty quick.

An alternative would be not use front-matter for attachments and polls. We currently support polls with this syntax ...

And we discussed a syntax for attachments like this ...

We could use front-matter to define alternative characters to define uploads and poll options, similar to ...

What seems clear here is that the front-matter data could be extracted using a YAML parser, and custom parsing could be built to get syntax specific to twitter-together (ie. a DSL).

Splitting the two contexts:

  • Front-matter for configuration in YAML
  • Content (per-tweet) using the DSL (ex. polls, attachments)

I'm interested in helping build this πŸ™Œ

w00p πŸ™ŒπŸΌ

Splitting the two contexts:

* Front-matter for configuration in YAML

* Content (per-tweet) using the DSL (ex. polls, attachments)

sounds good!

How would you like to build this? I think we should create a separate repository for the parser, then once we are happy with it, update the twitter-together action. I planned to move twitter-together to an org anyway, we can move the repo over and I can make you a co maintainer, if you are interested?

πŸ‘‹ Hey folks, I put together a rough pass at parsing the front matter out of a tweet, and from a thread of tweets: gr2m/twitter-together@master...MattIPv4:frontmatter-parsing

This should support all the options discussed in the original issue, in terms of parsing them out. I haven't implemented any support for actually doing anything with them though.

πŸ‘‹ With #177 merged, #41 left open, and #200/#201 split out based on the remaining items from that PR, would folks be happy for this mega-issue to be closed out now as core support for frontmatter with many of the requested options now exists?

yeah let's close it. Outstanding work @MattIPv4

@all-contributors please add @MattIPv4 for code, doc, research, test, and ideas

@gr2m

I've put up a pull request to add @MattIPv4! πŸŽ‰