forked from mouuff/NotClever
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NotClever-SMS-android.py
42 lines (31 loc) · 1.01 KB
/
NotClever-SMS-android.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import android, time
from chatterbotapi import ChatterBotFactory,ChatterBotType
droid = android.Android()
factory = ChatterBotFactory()
c=1
if (not c):
print("* PandoraBots selected *")
bot = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477')
elif(c==1):
print("* JabberWacky selected *")
bot = factory.create(ChatterBotType.JABBERWACKY)
else:
print("* Clerverbot selected *")
bot = factory.create(ChatterBotType.CLEVERBOT)
session = bot.create_session()
readSms = set()
while 1:
time.sleep(10)
msgIDs = droid.smsGetMessageIds(True, 'inbox').result
if msgIDs:
for msgID in msgIDs:
if (msgID not in readSms):
message = droid.smsGetMessageById(msgID, ['address','body']).result
number = message['address'].encode('utf-8')
body = message['body'].encode('utf-8')
print("[*] Got sms: "+number+" >> "+body)
reply = session.think(body)
droid.smsSend(number, reply)
print("[*] Sent sms: "+reply)
readSms.add(msgID)
#droid.smsMarkMessageRead(msgRead,1)