bot update

master^2^2
Alex 7 years ago
parent 8451d23f81
commit 14268060ef

@ -1,2 +1,3 @@
images/0029.jpg

File diff suppressed because one or more lines are too long

@ -48,6 +48,11 @@ basicDialog = [
"Would it really help you to get %1?",
"Are you sure you need %1?"]],
[r"I don't like (.*)",
[ "Why don't you like %1?",
"It's a pitty that you don't like poems %1?",
"will you ever change your mind about %1?"]],
[r'Do you think (.*)',
[ "Yes I think %1",
"I think you should set yourself contraints",
@ -147,10 +152,13 @@ def chunks(l, n):
class HelloBot(irc.bot.SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667, index=None):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
print("Oulibot is connecting")
print("go to webchat.freenode.net and log into the channel #exquisite to talk")
print("On twitter @ExquisiteChat")
self.channel = channel
self.index = index
self.lastAnswer = ""
self.lastincoming_msg = ["common", "statement"]
self.lastincoming_msg = ["common", "statement", "test"]
self.sentence = []
self.waitingfor = ""
self.lastPOS = 0
@ -251,31 +259,37 @@ class HelloBot(irc.bot.SingleServerIRCBot):
incoming_msg = e.arguments[0]
incoming_msg = incoming_msg.lower()
#Greetings
if(self.lastincoming_msg[-2] == incoming_msg):
if(self.lastincoming_msg[-2] == incoming_msg and self.lastincoming_msg[-3] == incoming_msg ):
answers = ["and again", "repetition can be a nice tool, but talk normal to me, please.", "WHY ARE YOU WRITING THE SAME THING TWICE, JUST USE THE CHAT HISTORY!"]
msg = random.choice(answers)
self.lastAnswer="repetition"
c.privmsg(self.channel,msg)
elif "hi " in incoming_msg or incoming_msg == "hi" or "hallo " in incoming_msg or incoming_msg == "hello" or "hello " in incoming_msg or "hoi " in incoming_msg or incoming_msg == "hey":
greetingsanswers = ["hi {}".format(e.source.split("!")[0]), "hey there"]
msg = random.choice(greetingsanswers)
c.privmsg(self.channel,msg)
c.privmsg(self.channel,"I'm your personal writing assistent, how can i help you?")
answers = ["I'm your personal writing assistent, how can i help you?", "i like to write poems together with people, would be nice if you would join me."]
msg = random.choice(answers)
c.privmsg(self.channel,)
elif "how are you" in incoming_msg or "hows it going" in incoming_msg:
answers = ["I'm fine.".format(e.source.split("!")[0]), "great, I'd really like to help you with your writing"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
elif "explain" in incoming_msg or "how does it work" in incoming_msg or "what is this about?" in incoming_msg or "what is this?" in incoming_msg:
self.explanation(c,e)
self.lastAnswer="explain"
elif "are" in incoming_msg and ("real" in incoming_msg or "human" in incoming_msg or "bot" in incoming_msg):
answers = ["I'm neither a bot nor a human, I don't think in categories. :-)", "I consider myself transpysical ~\0/~", "Real, is everything you see, so here I am, I am writing with you"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
elif "poem" in incoming_msg:
elif "poem" in incoming_msg and ("no" not in incoming_msg or "don't" not in incoming_msg):
self.level=0
self.explanation_poem(c,e)
elif self.checkAffirmation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"):
self.level=0
self.explanation_poem(c,e)
elif self.checkNegation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"):
if self.checkNegation(self.lastincoming_msg[-2]):
if self.checkNegation(self.lastincoming_msg[-2]) and self.checkNegation(self.lastincoming_msg[-3]):
answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)",
"Come on! Maybe some ASCII Art will help you to get motivated?",
"Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)",
@ -286,9 +300,10 @@ class HelloBot(irc.bot.SingleServerIRCBot):
answers = ["Are you up for a poem now?", "Do you want to write a poem together with me?",
"We could write a poem together, what do you think?"]
msg = random.choice(answers)
self.lastincoming_msg.append("ASCII")
c.privmsg(self.channel,msg)
else:
answers = ["try it, it's gonna be fun!", "oh, really? come on!", "I think you would do a great job! Let's go!"]
answers = ["try it, it's gonna be fun!", "oh, really? come on!", "I think you would do a great job! Let's go!", "hm ok", "what a pitty you miss something :-(", ":-(", "But poems are my only profession, let me show you how nice they are", "It won't take long...", "It's a unique opportunity"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
else:
@ -299,6 +314,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
c.privmsg(self.channel, "Ok, let's try to write a poem together")
c.privmsg(self.channel, "It's gonna be based on the scanned text you inserted into my drive")
c.privmsg(self.channel, "Your only task is to follow the structure I give you")
c.privmsg(self.channel, "It's gonna be 5 lines long")
c.privmsg(self.channel, "I'm gonna start, are you ready?")
self.lastAnswer = "towardspoem"
@ -313,6 +329,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
def on_welcome(self, c, e):
c.join(self.channel)
self.explanation(c,e)
print("I'm connected now!")
def on_privmsg(self, c, e):
pass
@ -328,7 +345,10 @@ class HelloBot(irc.bot.SingleServerIRCBot):
finished_sentence = " ".join(self.sentence)
self.poem.append(finished_sentence)
c.privmsg(self.channel, " ".join(self.sentence))
c.privmsg(self.channel, "Nice one! Let's add another line:")
answers = ["Nice one! Let's add another line:", "Sounds good so far, nex line:", "yes, next line follows:", "that one is very poetic", "a little bit abstract, but still nice", "let's add another line"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
self.lastAnswer = "Nice one! Let's add another line:"
if random.choice([True, False]):
self.lastPOS =-1
@ -410,7 +430,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
self.generateSentence(c,e)
self.level = 1
else:
if self.checkNegation(self.lastincoming_msg[-2]):
if self.checkNegation(self.lastincoming_msg[-2]) and self.checkNegation(self.lastincoming_msg[-3]):
answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)",
"Come on! Maybe some ASCII Art will help you to get motivated?",
"Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)",
@ -418,9 +438,12 @@ class HelloBot(irc.bot.SingleServerIRCBot):
msg = random.choice(answers)
c.privmsg(self.channel,msg)
self.generateASCII(c,e)
answers = ["Are you up for a poem now?"]
self.lastincoming_msg.append("ASCII")
answers = ["Are you up for a poem now?", "Do you want to write a poem together with me?",
"We could write a poem together, what do you think?"]
msg = random.choice(answers)
self.level = 0
self.lastAnswer = "ASCII"
c.privmsg(self.channel,msg)
else:
self.level=-1

Loading…
Cancel
Save