Retweet all tweets matching a regex with the Retweet bot

When using the Retweet bot to retweet some tweets from a Twitter account to another one, you may need some complex patterns, not easy to match with the common string you usually use.

The match feature

Starting from Retweet version 0.10 and thanks to a great contribution by @vanekjar, you are now able to use the parameter match in the [retweet] section of the configuration file  to use regular expressions for your pattern matching. Have a look at the following configuration file:

[retweet]
match=[Rr]etweet v.* available

The following configuration will retweet any tweet with a pattern matching the regular expression above, like “retweet v0.10 available” or “Retweet v1.0 available”.  Pretty cool hmm?

Full setup for Retweet

Ok, now, lets setup a full environment. First lets install the last version of retweet

# pip3 install retweet

Then lets create a retweet user with the home /var/lib/retweet:

# adduser --home /var/lib/retweet retweet

The proper way to store our configuration file is to put it in the /etc/retweet directory:

# mkdir -p /etc/retweet

Now lets write our configuration file. You have a full example available in the Configure section of the official Retweet documentation.

# vim /etc/retweet/retweet.ini

Almost ready! Last step: write a line in the crontab in order to launch Retweet on a regular basis:

*/10 * * * retweet retweet /etc/retweet/retweet.ini

And voila! Your Retweet bot is ready.

… and finally

You can help the Retweet Bot by donating anything through Liberaypay (also possible with cryptocurrencies). That’s a big factor motivation 😉

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *