API IS DOWN. NOW IS NOT AVAILABLE.
自動推送推特所有最新狀態到Discord頻道機器人
Help you to push the newest status of people you want to follow on Twitter to a Discord channel.
As Twitter changed its API policy, most of the Twitter bots are dead or turn to paid service. This bot is a simple solution to push the newest status of a Twitter user to a Discord channel with GitHub Actions or Docker.
- Fork this repository.
- Create a Discord Bot and get the token.
- Create a Twitter app and get the consumer key, consumer secret, access token, and access token secret.
- Add the above secrets to your repository's secrets.
DISCORD_BOT_TOKEN
,TWITTER_CONSUMER_KEY
,TWITTER_CONSUMER_SECRET
,TWITTER_ACCESS_TOKEN
,TWITTER_ACCESS_TOKEN_SECRET
. - Allow Workflow permissions to have access to read and write permissions for the repository.
- Edit the
.github/workflows/main.yml
file to change the schedule time. Default is*/30 * * *
which means run every 30 minutes. We recommend you that do not set the time less than default. - Edit the
id.csv
file to add the Twitter account you want to push and the Discord channel ID you want to push to (Remember to make your bot join the server). Then commit the changes. - Done.
-
Create a Discord Bot and get the token.
-
Create a Twitter app and get the consumer key, consumer secret, access token, and access token secret.
-
Pull the image from Docker Hub.
docker pull jim137/twasap
-
Run the image with the following startup script.
docker run -e DISCORD_BOT_TOKEN=[Your DISCORD_BOT_TOKEN] \ -e TWITTER_CONSUMER_KEY=[Your TWITTER_CONSUMER_KEY] \ -e TWITTER_CONSUMER_SECRET=[Your TWITTER_CONSUMER_SECRET] \ -e TWITTER_ACCESS_TOKEN_KEY=[Your TWITTER_ACCESS_TOKEN_KEY] \ -e TWITTER_ACCESS_TOKEN_SECRET=[Your TWITTER_ACCESS_TOKEN_SECRET] \ -e TWITTER_ID=[TWITTER_ID] \ -e DISCORD_CHANNEL_ID=[DISCORD_CHANNEL_ID] \ [(optional) -e TWITTER_ID1= -e DISCORD_CHANNEL_ID1= -e TWITTER_ID2= -e DISCORD_CHANNEL_ID2= \ ] jim137/twasap
-
Done. But if you want to re-start the container, you can use the following command.
docker container ls -a # Get CONTAINER_ID docker start -a CONTAINER_ID # Start the container
-
If you want to run the container as scheduled, you can set up a cron job.
crontab -e
Then add the following line to the file.
*/30 * * * * docker container start CONTAINER_ID
This will run the container every half an hour.
- Scheduled run on GitHub Actions.
- Push the newest status of a Twitter user to a specific Discord channel.
- Support multiple Twitter users and Discord channels.