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