-
Notifications
You must be signed in to change notification settings - Fork 0
/
kaleen_bhayia.py
131 lines (130 loc) · 4.69 KB
/
kaleen_bhayia.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
from typing import Any, Dict
from calculate import Calculator
from coding_contest import Coding
from Dictionary import Dictionary
from joke import Joke
from dean import Dean
from cricknews import Cricket
from proxy import Proxy
from music import Music
from send_message import Send_message
from Meeting import Meeting
from pnr import Pnr
from wit_handle import WitHandler
import sys
import threading
import os
from jobs import JOBS
import signal
from subprocess import check_output
from friend_location import FriendLocation
#from song_mood import Mood
from sympton import Sympton
import webbrowser
#from song_mood import Mood
from sympton import Sympton
from translate import Translate
from help import Help
from nearby import Nearby
class Kaleen_bhayia(object):
def usage(self) -> str:
return
t2="";
def handle_message(self, message: Dict[str, Any], bot_handler: Any) -> None:
string =message['content'].split()
content="something went wrong"
check=string[0].lower()
if check=="calculate":
content=Calculator.calculate(string)
elif check=="coding_contest":
content=Coding().getList();
elif check.lower()=='define':
dictword=string[1]
content=Dictionary.words(dictword)
elif check.lower()=='telljoke':
content=Joke.tellJoke()
elif check == "cricknews":
content = Cricket().news()
elif check=="proxy":
if len(string) > 1:
if string[1].lower()=="working":
content=Proxy.getWorkingProxy();
content="Working Proxies in Your Area \n\n"+content
elif string[1].lower()=="help":
content=Proxy.getHelpList();
else:
content=WitHandler.getInfo(message['content'])
else:
content=Proxy.getProxyStatus();
content="Proxies Status--->\n\n"+content;
elif check.lower()=="play":
try:
pid=check_output(["pidof"],"mpg321");
os.kill(int(pid),signal.SIGKILL)
os.remove("hello.mp3");
content=Music.main(string[1:])
except:
content=Music.main(string[1:])
bot_handler.send_reply(message,"playing song ")
elif check=="stop":
pid=check_output(["pidof","mpg321"])
#print(int(pid))
os.kill(int(pid),signal.SIGKILL)
content="Bye........:)"
bot_handler.send_reply(message,content)
elif check=="college_notice":
content=Dean.getNotice();
elif check=="add" and string[1]=="meeting":
content="Enter <Date> as <dd/mm/yyyy> <Time> as <hrs:min> and am/pm and purpose(one word)"
elif len(string[0].split('/'))==3:
res=Meeting.AddMeeting(string)
if res.lower()=="ok":
content="New Meeting successfully Added "
else:
content=res
elif check=="show" and string[1].lower()=="meetings":
content=Meeting.ShowMeeting()
elif check=="pnr" and string[1].lower()=="status":
content=Pnr.getpnr(string[2])
elif check=="message" or check=="find" or check=="where":
content=Send_message.sendMessage(string);
# elif check=="mood":
# Mood.capture();
elif check=="symptom":
string_1=" ";
gender=string[1];
dob=string[2];
st=string[3:];
string_1=string_1.join(st);
content=Sympton.getExactSympton(string_1)
try:
content="Please Tell me clearly\n"+content;
except:
p=int(content)
content=Sympton.getIssueId(str(p),gender,dob)
elif check=="search":
st=" ";
strlist=string[1:];
st=st.join(strlist);
st=FriendLocation.plot(st);
if "https" in st:
webbrowser.open(st);
content="check out below link \n"+st;
else:
content="Please type exact name :)\n"+st;
elif check=="getjobs":
content=JOBS.getjobs()
elif check=="translate":
stri=" ";
stri=stri.join(list(string[1:]))
content=Translate.translate(stri)
elif check=="help":
Help.Message();
content="Message sent";
elif check=="nearby":
content=Nearby.Place(string[1]);
else:
#print(message['content'])
content=WitHandler.getInfo(message['content'])
bot_handler.send_reply(message, content)
handler_class = Kaleen_bhayia