-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
35 lines (32 loc) · 1.75 KB
/
bot.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
from app import socketio
from testart import mario, softkitty, yoshi, kenny
about = 'This is a chat app that was build in CSUMBs software engineering class in two weeks'
help = 'The options are about, help, say: !! say <words to say>, mario, softkitty, yoshi, and kenny'
dont_recon = 'Sorry, I dont uderstand that command'
def bot(data):
the_text = str(data['text'])
if(the_text[0:2] == '!!'):
if( the_text[3:len(the_text)] == "about"):
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', about, broadcast=True, include_self=True)
elif( the_text[3:len(the_text)] == "help"):
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', help, broadcast=True, include_self=True)
elif( the_text[3:6] == "say"):
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', the_text[7:len(the_text)], broadcast=True, include_self=True)
elif( the_text[3:len(the_text)] == "mario"):
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', mario, broadcast=True, include_self=True)
elif( the_text[3:len(the_text)] == "softkitty"):
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', softkitty, broadcast=True, include_self=True)
elif( the_text[3:len(the_text)] == "yoshi"):
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', yoshi, broadcast=True, include_self=True)
elif( the_text[3:len(the_text)] == "kenny"):
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', kenny, broadcast=True, include_self=True)
else:
socketio.sleep(seconds=0.1)
socketio.emit('bot:message', dont_recon, broadcast=True, include_self=True)