mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Create bot.py
This commit is contained in:
parent
a9c19970a9
commit
7e7fe92b9d
33
Artificial-intelligence_bot/bot.py
Normal file
33
Artificial-intelligence_bot/bot.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
import sys
|
||||
try:
|
||||
import aiml
|
||||
except ImportError:
|
||||
print('[!] Failed to import the module')
|
||||
try:
|
||||
select = raw_input('[*] Attempt to auto-install aiml? [Y/n')
|
||||
except KeyboardInterrupt:
|
||||
print('\n[!] User Cancel')
|
||||
sys.exit(5)
|
||||
if select.strip().lower()[0] == 'y':
|
||||
print('[*] Trying to Install aiml... ')
|
||||
sys.stdout.flush()
|
||||
try:
|
||||
import pip
|
||||
pip.main(['install', '-q', 'aiml'])
|
||||
import aiml
|
||||
print('Finished')
|
||||
except Exception:
|
||||
print('Something happens PLease check your internet connection')
|
||||
sys.exit(5)
|
||||
|
||||
elif select.strip().lower()[0] == 'n':
|
||||
print('[*] User cancel Auto-install')
|
||||
sys.exit(5)
|
||||
|
||||
|
||||
kern = aiml.Kernel()
|
||||
kern.learn('load.xml')
|
||||
kern.respond('load aiml b')
|
||||
|
||||
while True:
|
||||
print(kern.respond(raw_input('Type your Message >>')))
|
Loading…
Reference in New Issue
Block a user