A retweet bot written in pure Rust. Currently uses API polling to bulk retweet.
This bot has a caching system that prevents API rate limiting by storing already retweeted tweet ids and ignoring the retweet command if the cache contains the tweet.
This bot requires a twitter developer account. Apply for one here. The developer account does NOT have to be on the account you're sending retweets on!
Once you have an account, create a new app and give it Read/Write permissions.
Finally, grab the consumer key and token to be used later.
Download the latest binary from the releases and use FTP or SCP to push the file to your server! (Alternatively, you can use wget or curl to download the binary directly to the server itself).
Then, copy info.sample.json to info.json in the project directory. From there, add all the following credentials from twitter.
- consumer_key
- consumer_secret
There are also optional parameters (Measure the amount of mentions the account gets in every x minutes. The goal is to capture as many new mentions as possible) :
- rt_delay: Delay between api checks (Default: 3 minutes)
- page_size: Amount of fetched mentions per check (Default: 5)
Once you're done, type the following command in the terminal inside the binary directory:
./simple-retweets info.json
The included systemd service is HIGHLY RECOMMENDED to run this bot in a server. Running in interactive mode is not advised.
The service assumes you're under a user called simplerts
and the binary is inside a directory called Simple-Retweets
with the binary name being simple-retweets
.
Copy the simplerts.service file into /etc/systemd/system/simplerts.service.
This service makes use of the linux TTY virtual terminals to authenticate as a twitter user as indicated within this line of the file.
To get the appropriate TTY number, run sudo fgconsole -n
and replace the dev/tty3
path with that number.
Then, run these commands
sudo systemctl reload-daemon
sudo systemctl enable simplerts.service
sudo systemctl start simplerts.service
To input the authorization, we must access the TTY added in the systemd service.
You can either remote into the console using conspy
(Available on most package managers) OR use chvt
to change into the tty.
To input the authorization pin, use one of the two command to remote in
For Conspy
sudo conspy <TTY number>
For chvt
sudo chvt <TTY number>
Conspy is recommended because it shows the actual remote terminal on the existing window, but use chvt if you can't use conspy.
From there, follow the prompts on the TTY terminal.
sudo systemctl status simplerts.service
sudo journalctl -u simplerts -f
It's easy! All you have to do is delete the bot directory and the systemd file from /etc/systemd/system/simplerts.service
Currently, this bot is allowed for use outside of the developer's server. I try to make the comments as detailed as possible, but if you don't understand something, please contact me via the Discord server or Twitter! I'm always happy to talk!
Creator/Developer: Brian Dashore
Developer Twitter: @kingbri1st
Developer Discord: kingbri#6666
Join the support discord here (get the king-updates role to access the channel): https://discord.gg/pswt7by