REUTURS: Three random lines from the bee movie script
If a [replaceword] has been passed it will spit three random lines containing the word bee, but it replaced with [replaceword]
'''
lines=[]# The final list containing the lines
output=''#The final output that the bot reuturns to the chat_id
args=msg['text'].replace(msg['text'].split(' ')[0],'')[1:]#What is after /beemovie or /beemovie@Jannie_Bot
ifargs.isspace()orargs=='':#Is the command being queried like this /beemovie
lineno=randrange(0,(len(beescript)-2))#what line number to use from beescript.txt
[lines.append(beescript[lineno+i])foriinrange(0,3)]#find a line and 2 after
output="\n".join(lines)
else:#Is the command being queryied like this /beemovie [phrase]
whileTrue:#repeat until bee is found in the lines
lines=[]
lineno=randrange(0,(len(beescript)-2))#what line number to use from beescript.txt
[lines.append(beescript[lineno+i])foriinrange(0,3)]#find a line and 2 after
ifany('bee'insforsinlines):#if there is bee in the lines
break#kill the loop
output="\n".join(lines).replace('bee',args).replace('Bee',args).replace('TOMTOMTOMTOM','been')#replace words with the arg passed. TOMTOMTOMTOM is there because it kept replacing stuff in been
elif(("/ask"inmsg['text'])and(len(msg['text'])>4))and("/ask@Jannie_Bot"!=msg['text'][:len("/ask@Jannie_Bot")]):#Is there actually a question or is it just /ask@Jannie_Bot