From ae7480317d8a563dd081362c5e3685297dfa251e Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 23 Apr 2025 12:49:03 -0500 Subject: [PATCH] add better readme --- readme.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ readme.txt | 5 ---- 2 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 readme.md delete mode 100644 readme.txt diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..95674c0 --- /dev/null +++ b/readme.md @@ -0,0 +1,78 @@ +# markov + +minimally modified fork of [kopper's markov bot](https://activitypub.software/kopper/markov) to post to iceshrimp.net. while still only taking in misskey exports. that's all i needed. + +## use + +clone the repository somewhere: +```sh +git clone https://forged.synth.download/sneexy/markov.git +cd markov +``` + +ideally, create a venv first: +```sh +python -m venv venv +source ./venv/bin/activate # assuming we're still in the markov folder - you'll need to do this everytime you want to use the bot, make a script or something to make it easier +``` + +now install everything: +```sh +pip install -r requirements.txt +python -m spacy download en_core_web_sm +``` + +import your misskey notes export: +```sh +python import-misskey.py name-of-your-notes-export.json # will take a bit depending on how large your export is +mv xxxxx.model.json model.json # exported file will be named something else, rename it to model.json to prevent it from erroring out when generating +``` + +add your iceshrimp.net user/bot account token: +```sh +echo "TOKEN='InsertVerySecureTokenHere'" > secrets__.py +``` + +...then edit `generate.py` and modify the `requests.post` section near the bottom to point the url to your instance. + +ℹ️ alternatively, if you'd like to use this to post to misskey, replace it with this (replacing `yourinstance.tld` with your instance): +```python +requests.post("https://yourinstance.tld/api/notes/create", json={ + 'i': secrets__.TOKEN, + + 'visibility': 'home', + 'noExtractMentions': True, + 'noExtractHashtags': True, + + 'text': text, + #'cw': 'markov chain generated post' +}) + +``` + +...or perhaps with mastodon (untested): +```python +requests.post("https://yourinstance.tld/api/v1/statuses", json={ + "status": text, + #"spoiler_text": "markov chain generated post", + "visibility": "unlisted" +}, headers={"Authorization": f"Bearer {secrets__.TOKEN}"}) +``` + +finally, make a markov generated post: +```sh +python generate.py +``` + +### example script + +here's a dumb and probably over engineered script i made to interact with the post. you may edit this and use it to your own will and needs. +```bash +#!/bin/bash +# cding into the markov directory is required otherwise it fails to load the model +CURRENT_DIR=$(pwd) +cd /home/ruben/markov && \ + source /home/ruben/markov/venv/bin/activate && \ + python /home/ruben/markov/generate.py && \ + cd $CURRENT_DIR +``` \ No newline at end of file diff --git a/readme.txt b/readme.txt deleted file mode 100644 index 34112f6..0000000 --- a/readme.txt +++ /dev/null @@ -1,5 +0,0 @@ - pip install -r requirements.txt - python -m spacy download en_core_web_sm - python import-misskey.py notes-XXXX-XX-XX-XX-XX-XX.json - echo "TOKEN=''" > secrets__.py - python generate.py