Dedupe message decoding to string
This commit is contained in:
parent
378b668f7a
commit
c3524a6536
1 changed files with 5 additions and 3 deletions
8
chat.py
8
chat.py
|
@ -85,14 +85,16 @@ def messages_post():
|
|||
if not message:
|
||||
return "No message found"
|
||||
|
||||
if "spam" in str(message, "UTF-8").lower():
|
||||
message_str = message.decode()
|
||||
|
||||
if "spam" in message_str.lower():
|
||||
messages.append(Message(time, "1.3.3.7", "ip", "Nee"))
|
||||
return "OK"
|
||||
|
||||
if sender != "somebody":
|
||||
message = "<" + sender + "> " + message.decode()
|
||||
message_str = "<{}> {}".format(sender, message_str)
|
||||
|
||||
messages.append(Message(time, sender, sendertype, message))
|
||||
messages.append(Message(time, sender, sendertype, message_str))
|
||||
url = 'http://10.0.5.42:8000/' # Set destination URL here
|
||||
post_fields = {'X-Messages': base64.b64encode(message)}
|
||||
|
||||
|
|
Loading…
Reference in a new issue