mirror of
https://git.kiwifarms.net/mint/ebooks.git
synced 2024-10-22 23:29:06 +00:00
Option to post in public
This commit is contained in:
parent
b5befe7393
commit
f79a749e9e
3 changed files with 12 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"site": "https://botsin.space",
|
"site": "https://botsin.space",
|
||||||
|
"public": false,
|
||||||
"cw": null,
|
"cw": null,
|
||||||
"fetch_delay": 1,
|
"fetch_delay": 1,
|
||||||
"learn_from_cw": false,
|
"learn_from_cw": false,
|
||||||
|
|
7
gen.py
7
gen.py
|
@ -24,6 +24,11 @@ async def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
cfg = utils.load_config(args.cfg)
|
cfg = utils.load_config(args.cfg)
|
||||||
|
|
||||||
|
if cfg['public']:
|
||||||
|
visibility = 'public'
|
||||||
|
else:
|
||||||
|
visibility = 'unlisted'
|
||||||
|
|
||||||
toot = await utils.make_post(cfg, mode=utils.TextGenerationMode.__members__[args.mode])
|
toot = await utils.make_post(cfg, mode=utils.TextGenerationMode.__members__[args.mode])
|
||||||
if cfg['strip_paired_punctuation']:
|
if cfg['strip_paired_punctuation']:
|
||||||
toot = PAIRED_PUNCTUATION.sub("", toot)
|
toot = PAIRED_PUNCTUATION.sub("", toot)
|
||||||
|
@ -33,7 +38,7 @@ async def main():
|
||||||
if not args.simulate:
|
if not args.simulate:
|
||||||
async with Pleroma(api_base_url=cfg['site'], access_token=cfg['access_token']) as pl:
|
async with Pleroma(api_base_url=cfg['site'], access_token=cfg['access_token']) as pl:
|
||||||
try:
|
try:
|
||||||
await pl.post(toot, visibility='unlisted', cw=cfg['cw'])
|
await pl.post(toot, visibility=visibility, cw=cfg['cw'])
|
||||||
except Exception:
|
except Exception:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,11 @@ class Pleroma:
|
||||||
|
|
||||||
content = ''.join('@' + x + ' ' for x in mentioned_accounts.values()) + content
|
content = ''.join('@' + x + ' ' for x in mentioned_accounts.values()) + content
|
||||||
|
|
||||||
visibility = 'unlisted' if to_status['visibility'] == 'public' else to_status['visibility']
|
if cfg['public']:
|
||||||
|
visibility = 'public'
|
||||||
|
else:
|
||||||
|
visibility = 'unlisted'
|
||||||
|
visibility = visibility if to_status['visibility'] == 'public' else to_status['visibility']
|
||||||
if not cw and 'spoiler_text' in to_status and to_status['spoiler_text']:
|
if not cw and 'spoiler_text' in to_status and to_status['spoiler_text']:
|
||||||
cw = 're: ' + to_status['spoiler_text']
|
cw = 're: ' + to_status['spoiler_text']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue