Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with python3.7 #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions development.conf

This file was deleted.

Empty file modified run.sh
100644 → 100755
Empty file.
Empty file modified status.sh
100644 → 100755
Empty file.
12 changes: 9 additions & 3 deletions wat_bridge/wa.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ def on_message(self, message):
# body = "NULL"
if message.getType() == "text":
logger.debug("is text message")
body = message.getBody().decode()
if(isinstance(message, TextMessageProtocolEntity)):
body = message.conversation
else:
body = message.text

if body == '/getID' or body == '/link':
self.send_msg(phone=sender, message="/link " + sender)
Expand Down Expand Up @@ -163,10 +166,12 @@ def on_message(self, message):
SIGNAL_TG.send('wabot', phone=sender, message=TheRealMessageToSend, media=False)

if message.getType() == "media":
pass
"""
if not os.path.exists("./DOWNLOADS"):
os.makedirs("./DOWNLOADS")
# set unique filename
uniqueFilename = "./DOWNLOADS/%s-%s%s" % (hashlib.md5(str(message.getFrom(False)).encode('utf-8')).hexdigest(), uuid.uuid4().hex, message.getExtension())
uniqueFilename = "./DOWNLOADS/%s-%s%s" % (hashlib.md5(str(message.getFrom(False)).encode('utf-8')).hexdigest(), uuid.uuid4().hex, ".jpg")
if message.getMediaType() == "image":
logger.info("Echoing image %s to %s" % (message.url, message.getFrom(False)))
data = message.getMediaContent()
Expand Down Expand Up @@ -205,6 +210,7 @@ def on_message(self, message):
# Relay to Telegram
logger.info('relaying message to Telegram')
SIGNAL_TG.send('wabot', phone=sender, message=TheRealMessageToSend, media=True)
"""

@ProtocolEntityCallback('receipt')
def on_receipt(self, entity):
Expand Down Expand Up @@ -260,7 +266,7 @@ def send_msg(self, **kwargs):

WA_STACK = (
YowStackBuilder()
.pushDefaultLayers(True)
.pushDefaultLayers()
# .pushDefaultLayers(False)
.push(wabot)
.build()
Expand Down