__pycache__ | ||
.env | ||
.gitignore | ||
.gitlab-ci.yml | ||
get_apps.py | ||
image_source.py | ||
main.py | ||
readme.md | ||
requirements.txt |
imagebot
A bot to post images to a *key server. Includes an easy way to program a new source for images.
Source can be found at Julimiro/imagebot, documentation can be found here.
Usage
*Only required if using danbooru image source,
1. Clone the repo
git clone https://git.gay/Julimiro/imagebot.git
2. Install modules
pip install dotenv requests
4. Create an account for the bot on your *key server.*
5. Generate an api key by navigating to /settings/api
of the server and clicking generate access token. Below is a list of permissions the bot needs. After setting the permissions, give the token a name and press done. Make sure to keep note of the token that flashes on screen.
- Access your Drive files and folders
- Compose or delete notes
6. Open the .env file
- Change baseurl to your *key instances url including /api.
- Change the searchquery to what you want, make sure to keep
rating:general order:random
. *rating:general
keeps it safe for work andorder:random
ensures a post isnt duplicated(probably) . - Change
danbooru_user
to the bots danbooru username.* - Change
danbooru_apikey
to an api key generated by going to your danbooru user page, scrolling own to "API Key" and clicking view. * -Changeapi_key
to an your token generated earlier in step 5.. secret
should not be modified yet.- Save the file.
7. Run get_apps.py
.
8. Enter the output of get_apps.py into the secret
option in .env.
9. Now when main.py
is ran, an image should be posted.
Making an image source
The image_source.py
file must have a main
function which doesnt take arguments but returns string: post_url, string: image_url, string: artists