This project is no longer in development
A discord bot that gets the latest tweets and display it in the text channel
How to use the bot
Add the bot to your server, add users to follow by typing '-follow {the tweet account id (start with @)}'
The bot will start getting new tweets from the user and display it in the channel where the command is executed
A discord developer account to create a bot token for the discord bot
An account on replit
A twitter developer account
Create a twitter app in your twitter developer portal , remember to keep the keys as it will only be shown on the creation of the app, otherwise have to be regenerated.
Create a discord bot application in your discord developer portal with channel permissions and remember the bot token
Download the code and upload it to replit, create a .env file with the following properties
The following 4 keys are obtained in your twitter developer portal
- ACCESS_KEY
- ACCESS_SECRET
- CONSUMER_KEY
- CONSUMER_SECRET
- bot_token, this is the bot token generated on discord developer portal
Default prefix= '-'
follow @{username}, username is the twitter user's unique name, '@' can be ignored
stopfollow @{username}, unfollows a user in your followed list
followlist, displays a list of the users you followed in the text channel
help, displays all command names
On the free plan of a twitter developer account, the limit is one request a second. The delay of each request in the code is 2 seconds, change it by going to main.py and manually change the async time to your desired amount.
The code will run prefectly on replit but if the web session is closed for more than an hour, replit will push the code into a idle state. The bot will enter a sleep mode and can be re-activate by logging back the replit account and open the code.
To prevent the bot to enter sleep mode
Constantly ping your bot, I recommend using UptimeRobot
How to use UptimeRobot
When running the bot, you will find a box appeared on top of your console/shell showing "running" with a link on top. Copy the link.
Log into your UptimeRobot account and click on "Add New Monitor" and enter the following.
- Monitor Type: HTTP(s)
- Friendly Name: {Put whatever name your want here}
- URL (or IP): {Put the link mentioned above here}
- Monitoring Interval: under 15 minutes
Change the rest of the setting to your likings or keep it default
Click "Create Monitor" and you're done, add the bot to your discord server and start using it.