Automatically generate and post sentences to Misskey like your daily tweets by using markov chain.
- Python 3.x
- pandas
- MeCab
- mecab-python3
- Misskey.py
- Download your tweets from Twitter (Download an archive of your data).
- Convert
tweets.jstotweets.csvby using Twitter archive JS to CSV converter.
Warning: Don't forget to rename.csvfile! - Put
tweets.csvintodata/(please create new directory). - Set environment variable in
docker-compose.yml - Copy
banned.json.sampleasbanned.json. - Configure banned words in
banned.jsonas you like.
- Install Python 3.x, MeCab in the way of your environment.
- Run
pip install -r requirements.txtto install depending Python packages. - Download your tweets from Twitter (Download an archive of your data).
- Convert
tweets.jstotweets.csvby using Twitter archive JS to CSV converter.
Warning: Don't forget to rename.csvfile! - Put
tweets.csvintoapp/. - Copy
.env.sampleas.env. - Put your tokens related to Twitter into
.env. (You can get one from Developer Portal.) - Copy
banned.json.sampleasbanned.json. - Configure banned words in
banned.jsonas you like.
python3 run.py
- Create
docker-compose.ymland paste the below and set your token in this file.version: '3' services: markov-note: restart: always container_name: markov-note image: ghcr.io/yuderobot/markov-note:master volumes: - "./data:/app/data" environment: # Twitter API related - CK= - CS= - AT= - AS= # Length of sentence - N=1 - Run
docker-compose up -d. To update, rundocker-compose pullbefore firing up the container.
- If you already run this bot, please delete
triplets.pkl. - Run
python3 clean.pyon this repository.
Warning: Make sure you havetweets.csvinside the bot directory! - Rename
tweets.csvastweets.csv.bak. - Rename
tweets_processed.csvastweets.csv. - Run the bot.
- Open
.envordocker-compose.ymland change the value ofN. - Run the bot.
Use crontab to run this bot regularly.
If you use Docker image, you don't need to do this (already configured).
*/20 * * * * cd /path/to/your/markov-tweet; /usr/bin/python3 /path/to/your/run.py
This definition make this bot run every 20 minutes. (*:00, *:20, *:40)
This project is licensed under the MIT License.