add content warning support
This commit is contained in:
parent
a8d664456f
commit
9af70e2ee4
|
@ -57,8 +57,12 @@ def edit_post(post: str) -> str:
|
|||
return post
|
||||
|
||||
# display post contents and verify with the user
|
||||
def post_check(post: str) -> bool:
|
||||
def post_check(post: str, cw: str) -> bool:
|
||||
print('You are about to post')
|
||||
# If content warning is given
|
||||
if (cw != ''):
|
||||
print()
|
||||
print(f"CW: \"{cw}\"")
|
||||
print()
|
||||
print(post)
|
||||
print()
|
||||
|
@ -76,14 +80,22 @@ def main():
|
|||
phlog_file = input('Post location (leave blank for root): ')
|
||||
urls = gen_url(config_data, phlog_file)
|
||||
|
||||
# get post description, generate post text
|
||||
# TODO: content warnings
|
||||
# Read content warning
|
||||
cw = input('Content Warning? (Leave blank for none): ')
|
||||
|
||||
# Edit post
|
||||
post = f"<Replace with your post description>\n\nGopher: {urls['gopher']}\nHTML Proxy: {urls['proxy']}"
|
||||
post = edit_post(post)
|
||||
|
||||
# verify the post with the user and post it
|
||||
if post_check(post):
|
||||
toot_dict = m.status_post(post, visibility=config_data['visibility'])
|
||||
print()
|
||||
# Verify the post with the user and post it
|
||||
if post_check(post, cw):
|
||||
# Check if content warning is given
|
||||
if (cw == ''):
|
||||
toot_dict = m.status_post(post, visibility = config_data['visibility'])
|
||||
else:
|
||||
toot_dict = m.status_post(post, visibility = config_data['visibility'], spoiler_text = cw)
|
||||
|
||||
print(f"Posted at {toot_dict['url']}")
|
||||
else:
|
||||
print('Aborted.')
|
||||
|
|
Loading…
Reference in New Issue