Compare commits

..

No commits in common. "a19c366fa4af9db480422211c966741a5c97ec54" and "4f0ea22656faf071c1b1ea703c6753a752746dc3" have entirely different histories.

2 changed files with 5 additions and 5 deletions

View File

@ -1 +1 @@
0 * * * * python misskey-szuru-bot.py --instance misskey.io --token token_here --booru szurubooru.com --username my-username --apiKey szuru-login-token
0 * * * * python misskey-szuru-bot.py --instance misskey.io --token token_here --booru szurubooru.com --username my-username --apiKey szuru-login-token --query "sort:random"

View File

@ -2,7 +2,6 @@
import argparse
import pyszuru
import requests
import random
from misskey import Misskey
# arguments
@ -19,13 +18,14 @@ parser.add_argument('-u', '--username', metavar='username', type=str,
help='Username for szurubooru account', required=True)
parser.add_argument('-a', '--apiKey', metavar='apiKey', type=str,
help='API key for szurubooru account', required=True)
parser.add_argument('-q', '--query', metavar='query', type=str,
help='Query to search szurubooru', default="sort:random")
args = parser.parse_args()
# get truly random post
# get post
booru = pyszuru.API(f"https://{args.booru}", username=args.username, token=args.apiKey)
highest_post = next(booru.search_post("sort:id", page_size=1))
post = booru.getPost(random.randint(0, highest_post.id_))
post = next(booru.search_post(args.query))
# compose note
text = f"link: {post.content}"