fix crash on empty toot
This commit is contained in:
parent
a4b5440be5
commit
7ee1f9a7aa
21
tooter.py
21
tooter.py
|
@ -9,6 +9,7 @@ import re
|
|||
import socket
|
||||
import sys
|
||||
|
||||
HELPTEXT = "helo i can send toots from irc: @tildeverse@tilde.zone - from @tildeteam from the #team channel)"
|
||||
|
||||
def masto_from_json(conf):
|
||||
conf = json.load(conf)
|
||||
|
@ -38,20 +39,20 @@ def think(line):
|
|||
if len(words) > 0 and line.hostmask.nickname != config["botnick"]:
|
||||
cmd = words[0].lower()
|
||||
if cmd == "!toot":
|
||||
status = emoji.emojize(" ".join(words[1:]), use_aliases=True)
|
||||
if chan == "#team":
|
||||
res = tildeteam.toot(status)
|
||||
if len(words) >= 2:
|
||||
status = emoji.emojize(" ".join(words[1:]), use_aliases=True)
|
||||
if chan == "#team":
|
||||
res = tildeteam.toot(status)
|
||||
else:
|
||||
res = tildeverse.toot(status)
|
||||
print(res)
|
||||
send(chan, "tooted! {}".format(res["url"]))
|
||||
else:
|
||||
res = tildeverse.toot(status)
|
||||
print(res)
|
||||
send(chan, "tooted! {}".format(res["url"]))
|
||||
send(chan, HELPTEXT)
|
||||
elif cmd == "!source":
|
||||
send(chan, "https://tildegit.org/ben/tooter")
|
||||
elif cmd in ["!botlist", "!toothelp"]:
|
||||
send(
|
||||
chan,
|
||||
"helo i can send toots from irc: @tildeverse@tilde.zone - from @tildeteam from the #team channel)",
|
||||
)
|
||||
send(chan, HELPTEXT)
|
||||
|
||||
|
||||
# do setup
|
||||
|
|
Loading…
Reference in New Issue