basic cleanup
This commit is contained in:
parent
e6b17d38fb
commit
b083eca53f
1 changed files with 10 additions and 7 deletions
9
gen.py
9
gen.py
|
@ -12,6 +12,7 @@ parser.add_argument('-s', '--simulate', dest='simulate', action='store_true',
|
|||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.simulate:
|
||||
client = Mastodon(
|
||||
client_id="clientcred.secret",
|
||||
access_token="usercred.secret",
|
||||
|
@ -30,8 +31,10 @@ if not args.simulate:
|
|||
try:
|
||||
client.status_post(toot, visibility = 'unlisted')
|
||||
except Exception as err:
|
||||
toot = "Mistress @lynnesbian@fedi.lynnesbian.space, something has gone terribly" \
|
||||
+ " wrong! While attempting to post a toot, I received the following" \
|
||||
+ " error:\n" + "\n".join(traceback.format_tb(sys.exc_info()[2]))
|
||||
toot = "Arr, @lynnesbian@fedi.lynnesbian.space, ye scallywag!" \
|
||||
+ " I've encountered an error most dire!" \
|
||||
+ " Check error.log in ye bot directory!!"
|
||||
with open("error.log", "w") as f:
|
||||
f.write("\n".join(traceback.format_tb(sys.exc_info()[2])))
|
||||
client.status_post(toot, visibility = 'unlisted', spoiler_text = "Error!")
|
||||
print(toot)
|
||||
|
|
Loading…
Reference in a new issue