added multiline from main branch

This commit is contained in:
Sean Corrigan 2020-12-03 10:09:55 -05:00
parent 5b57def069
commit 51a3cae4f3

View File

@ -20,11 +20,19 @@ def listfromAPI(message):
def fixformatting(message):
try:
fixedmessage = [""]
counter = 0
for word in message.split(" "):
pass
if counter + len(word) >= 22:
counter = 0
fixedmessage.append("\n")
fixedmessage.append("{} ".format(word))
else:
counter += len(word)
fixedmessage.append("{} ".format(word))
return "".join(fixedmessage)
except:
return message
return "".join(fixedmessage)
def main():
@ -32,7 +40,7 @@ def main():
response = listfromAPI(response)
if response == None: return
if len(response) == 1:
sendUpdate(response[0])
sendUpdate(fixformatting(response[0]))
requests.get("{}/clear?api={}".format(LoveBOXAPIurl,LoveBOXAPIapi), verify=True).content.decode()