Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import random, string
- #####
- #bot.py
- #author ~ Donny
- #version ~ 2.1.0
- #Editing and publishing of script is permitted
- class ai:
- def __init__(self):
- self.ctgs = 'dn'
- try:
- self.bot(raw_input("-> "))
- except EOFError:
- pass
- def botp(self, x):
- #Prints the reply
- self.x = x
- print "# %s" % (string.capitalize(self.x))
- def as(self):
- #Artificial stupidity
- self.randmsg = ['hello.', 'do you love cheese?', 'LOL', 'IKR', '<3',
- 'do you have a gf? :o', 'what\'s your name',
- 'maths sucks', 'do you have a life', 'yolo', 'swag']
- self.botp(random.choice(self.randmsg))
- self.__init__()
- def bot(self, msg):
- random.seed()
- self.msg = msg.lower()
- #Answers for some questions C:
- self.ans = {'are you a bot':'NO!', 'are you a human':'YES',
- 'what\'s your name':'my name is SAM',
- 'who made you':'DONNY <3'}
- self.s = self.msg.split(' ')
- self.l = len(self.s)
- self.arr = []
- self.i = 0
- while self.i < self.l:
- self.arr.append(self.s[self.i])
- self.i += 1
- #The main part
- self.c = ['shit', 'nigga', 'fuck', 'bitch']
- self.g = ['hi', 'hey', 'hello', 'hola']
- self.ctgs = 'n'
- for i in self.g:
- if i in self.arr:self.ctgs='g'
- for i in self.c:
- if i in self.arr:self.ctgs='c'
- if self.ctgs == 'g':self.botp("Hi!");self.__init__()
- elif self.ctgs == 'c':self.botp("Don't use bad words..:X");self.__init__()
- else:
- try:
- if self.ans[self.msg]:self.botp(self.ans[self.msg])
- self.__init__()
- except:
- self.as()
- ObjB = ai()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement