def do(speech): factory = ChatterBotFactory() bot1 = factory.create(ChatterBotType.CLEVERBOT) bot1session = bot1.create_session() bot2 = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477') bot2session = bot2.create_session() while(speech!="bye bye"): if speech.find("search twitter for")!=-1: speech=speech.replace("search twitter for",'') search.main(speech) elif speech.find("show twitter trend")!=-1: trending.main() elif speech.find("tell the weather")!=-1: weather.main() elif speech.find('show my e-mail')!=-1: mailtest.main() elif speech.find('send email')!=-1: mailtest2.main() elif speech.find('search bing for')!=-1: speech=speech.replace('search bing for','') bingsearch.main(speech) else: s = bot2session.think(speech); print 'yam> ' + s talks.main(s) speech=listen() speech=speech.lower()
def _setup(self): factory = ChatterBotFactory() self.bot = factory.create(ChatterBotType.CLEVERBOT) self.template = spade.Behaviour.ACLTemplate() self.template.setLanguage('english') self.t = spade.Behaviour.MessageTemplate(self.template) self.addBehaviour(self.MessageManager(), self.t) if self.sendFirst: self.addBehaviour(self.InitChatBot())
def call_bot(message): """ Calls bot given message Returns response of the bot as a string """ factory = ChatterBotFactory() bot = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477') botSession = bot.create_session() return botSession.think(message)
def __init__(self, botid): """ Initialize global class variables Create aiml object with file """ try: self._factory = ChatterBotFactory() self._bot = self._factory.create(ChatterBotType.PANDORABOTS, __raspiaibotid__) self._botsession = self._bot.create_session() except NameError, x: print 'Exception: ', x
def __init__(self, interface): super self.interface = interface mail_usr = '******' mail_pw = 'lollerskates' self.gmail_reader = gmail.GmailReader(mail_usr, mail_pw) self.cleverbot_sessions = {} self.cleverbot_factory = ChatterBotFactory() self.mail_time = 5 self.flirt_time = 1200
def __init__(self, name, bottype, lang="en", pandoraid=""): self.bottypestr=bottype if bottype=="cleverbot": self.bottype=ChatterBotType.CLEVERBOT elif bottype=="jabberwacky": self.bottype=ChatterBotType.JABBERWACKY elif bottype=="pandorabots": self.bottype=ChatterBotType.PANDORABOTS factory = ChatterBotFactory() self.pandoraid=pandoraid self.name=name self.session=factory.create(self.bottype,self.pandoraid).create_session() self.lang=lang
async def on_message(message): await bot.process_commands(message) if bot.user.mentioned_in(message): try: if str(message.author) == "Yakitrak#2464": factory = ChatterBotFactory() bot1 = factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477") bot1session = bot1.create_session() # msg = message.content.split() # for word in msg: # if word == # Didn't know what you wanted up there, so I commented it out. await message.channel.send(bot1session.think(message.content)) except: await message.channel.send("The Pandorabot api is down " "so you're seeing this message!")
def chat(text): from chatterbotapi import ChatterBotFactory, ChatterBotType factory = ChatterBotFactory() bot1 = factory.create(ChatterBotType.CLEVERBOT) bot1session = bot1.create_session() bot2 = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477') bot2session = bot2.create_session() return bot2session.think(text) while (1): print 'bot1> ' + s s = bot2session.think(s) print 'bot2> ' + s s = bot1session.think(s)
# -*- coding: utf-8 -*- from chatterbotapi import ChatterBotFactory, ChatterBotType import sys """ chatterbotapi Copyright (C) 2011 [email protected] """ factory = ChatterBotFactory() bot1 = factory.create(ChatterBotType.CLEVERBOT) bot1session = bot1.create_session() bot2 = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477') bot2session = bot2.create_session() s = sys.argv[1] s = bot2session.think(s); print s
)).replace("\n", " ") + " Read more: " + strip_tags(HTMLParser().unescape( requests. get('https://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=1&userip=24.53.222.246&q=ftc%20team%20' + '%20'.join(x), proxies=proxies).json()["responseData"]['results'][0][ 'url'].encode('ascii', 'ignore'))).replace("\n", " ") + (" The Yellow Alliance: http://theyellowalliance.net/teams/view/" + x[0], "")[not is_number(x[0])], "GLRobot": lambda x: strip_tags(bot2session.think(' '.join(x))) } # Some basic variables used to configure the bot server = "irc.freenode.net" # Server channel = "#GreasedLightning" # Channel botnick = "GLRobot" # Your bots nick factory = ChatterBotFactory() #Setup chatterbot bot2 = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477') bot2session = bot2.create_session() def is_number(s): try: float(s) return True except ValueError: return False def youtubeDownload(url): sendmsg(channel, "Downloading...") try:
def getAIresponse2(s): factory = ChatterBotFactory() bot2 = factory.create(ChatterBotType.CLEVERBOT) bot2session = bot2.create_session() response = bot2session.think(s) return response
def __init__(self): self.factory = ChatterBotFactory() self.jabberwacky = self.factory.create(ChatterBotType.JABBERWACKY) self.conversations = {}