add user signature

This commit is contained in:
Ben Harris 2022-05-09 17:35:25 -04:00
parent 389665eda6
commit b138921886
3 changed files with 10 additions and 6 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
toot.json toot.json
venv/

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
Mastodon.py==1.5.1
emoji~=1.6.3
click==8.1.3

12
toot
View File

@ -1,10 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
import click
import emoji
import getpass
import json import json
import os import os
import sys import sys
import click
import emoji
from mastodon import Mastodon from mastodon import Mastodon
@click.command() @click.command()
@ -31,12 +31,12 @@ def toot(status, creds):
status = emoji.emojize(status, use_aliases=True) status = emoji.emojize(status, use_aliases=True)
# check status length and post status # check status length and post status
if len(status) > 500: if len(status) > 5000:
print("Status is too long, try again") print("Status is too long, try again")
elif len(status) == 0: elif len(status) == 0:
print("Did you type a status?") print("Did you type a status?")
else: else:
print(mastodon.toot(status)["uri"]) print(mastodon.toot(f"{status}\n~{getpass.getuser()}")["uri"])
if __name__=='__main__': if __name__=='__main__':
toot() toot()