def main():
    # Create two Cleverbot connections
    alice = Cleverbot('cleverbot-py-example')
    bob = Cleverbot('cleverbot-py-example')

    print('>> Alice: Hi.')
    answer = bob.ask('Hi.')

    while True:
        print('>> Bob: {}'.format(answer))
        answer = alice.ask(answer)
        print('>> Alice: {}'.format(answer))
        answer = bob.ask(answer)
Exemple #2
0
 def getResponse(self, memberid, message):
     try:
         if self.bot[memberid] is None:
             self.bot[memberid] = Cleverbot()
             self.bot[memberid].ask("")
         else:
             self.bot[memberid].ask("")
     except KeyError:
         self.bot[memberid] = Cleverbot()
         self.bot[memberid].ask("")
     else:
         self.bot[memberid].ask("")
         return self.bot[memberid].ask(message)
Exemple #3
0
def askClever(intent, session):
    if 'query' in intent['slots']:
        querySlot = intent['slots']['query']['value']
    else:
        speech_output = "I'm sorry, I didn't understand, you can say something like 'Hi, how are you?'"
        card_title = None
        should_end_session = True
        reprompt_text = ""
        return build_response({},
                              build_speechlet_response(card_title,
                                                       speech_output,
                                                       reprompt_text,
                                                       should_end_session))

    cb = Cleverbot()
    #Gets the response
    queryRun = cb.ask(querySlot)
    speech_output = queryRun
    card_title = None
    should_end_session = False
    reprompt_text = ""

    return build_response({},
                          build_speechlet_response(card_title, speech_output,
                                                   reprompt_text,
                                                   should_end_session,
                                                   queryRun))
	def __init__(self, client, source, name=None):
		self.session = {
			"bot": Cleverbot(),
			"name": name,
			"channel": source.channel,
			"last_message": time()
		}
Exemple #5
0
async def chat(ctx):
    def check_consistent_user_and_channel(message):
        return message.author == ctx.message.author and message.channel == ctx.message.channel
    STOP_SIGNAL = "_stop"

    async with cleverbot_active_chat_sessions_lock:
        create_file_if_does_not_exist(filepaths.CLEVERBOT_ACTIVE_CHAT_SESSIONS, set())
        with open(filepaths.CLEVERBOT_ACTIVE_CHAT_SESSIONS, 'rb') as input:
            author_ids_with_active_cleverbot_chat_sessions = pickle.load(input)

        # Check if user is already engaged in an active chat session
        if ctx.author.id in author_ids_with_active_cleverbot_chat_sessions:
            await ctx.send("You already have an active chat session. End it before starting a new one.")
            return

        # Init connection
        await ctx.send("Initialising chat session...")
        cleverbot = Cleverbot()
        await cleverbot.init_connection()
        await ctx.send(f"{ctx.message.author.mention} Ready to chat... Type ``{STOP_SIGNAL}`` to stop the active chat session.")

        # Update active chat sessions file
        author_ids_with_active_cleverbot_chat_sessions.add(ctx.author.id)
        with open(filepaths.CLEVERBOT_ACTIVE_CHAT_SESSIONS, 'wb') as output:
            pickle.dump(author_ids_with_active_cleverbot_chat_sessions, output)

    ### Active session ###
    is_chat_active = True
    while is_chat_active:
        try:
            # Wait for next chat message from user
            message = await client.wait_for("message", check=check_consistent_user_and_channel, timeout=60.0)
        except asyncio.TimeoutError:
            await ctx.send(f"{ctx.message.author.mention} Took too long to receive a reply. Ending chat session...")
            is_chat_active = False
        else:
            # Check for stop signal and intermediate commands, otherwise proceed with conversation
            if message.content == STOP_SIGNAL:
                await ctx.send(f"{ctx.message.author.mention} Until next time. Ending chat session...")
                is_chat_active = False
            elif message.content.startswith("!"):
                pass
            else:
                await ctx.trigger_typing()
                response = await cleverbot.get_response(message.content)
                if response.strip() == "":
                    # If could not fetch a cleverbot response then end the chat session
                    await ctx.send("I'm done talking. Ending chat session...")
                    is_chat_active = False
                else:
                    await ctx.send(response)

    # Terminate connection and update active chat sessions file
    await cleverbot.close()
    async with cleverbot_active_chat_sessions_lock:
        with open(filepaths.CLEVERBOT_ACTIVE_CHAT_SESSIONS, 'rb') as input:
            author_ids_with_active_cleverbot_chat_sessions = pickle.load(input)
        author_ids_with_active_cleverbot_chat_sessions.remove(ctx.author.id)
        with open(filepaths.CLEVERBOT_ACTIVE_CHAT_SESSIONS, 'wb') as output:
            pickle.dump(author_ids_with_active_cleverbot_chat_sessions, output)
Exemple #6
0
def main():
    # instantiate a Cleverbot object
    client = Cleverbot('cleverbot-py-example')

    while True:
        question = input('>> You: ')
        answer = client.ask(question)
        print('>> Cleverbot: {}'.format(answer))
Exemple #7
0
    def get_cb_response(self, msg):
        for _ in range(10):
            try:
                res = self.cb.ask(msg)

                if PREVIOUS_LINES.count(res) > 3:
                    self.log.info('Resetting due to repeats: `%s`', res)
                    self.cb = Cleverbot()
                    msg = random.choice(RESET_LINES)
                    continue

                PREVIOUS_LINES.append(res)
                return res
            except:
                self.log.exception('Error: ')
                self.cb = Cleverbot()
                gevent.sleep(2)
Exemple #8
0
 def __init__(self, token):
     self.token = token
     self.slack = SlackClient(token=self.token)
     self.cleverbot = Cleverbot()
     self.botname = settings.BOT_NAME
     self.facebook = Facebook()
     self.twitter = Twitter()
     self.network = SocialNetwork()
Exemple #9
0
 def __init__(self):
     logger.debug('Instantiating SocialBot')
     self.token = settings.SECRET_KEY
     self.slack = Slacker(self.token)
     self.facebook = Facebook()
     self.twitter = Twitter()
     self.cleverbot = Cleverbot()
     self.history = {}
Exemple #10
0
 def __init__(self, bot):
     self.reddit = praw.Reddit(
         client_id=config["praw"]["client_id"],
         client_secret=config["praw"]["client_secret"],
         user_agent=config["praw"]["user_agent"],
         username=config["praw"]["user"],
         password=config["praw"]["pass"])
     self.bot = bot
     self.cb = Cleverbot()
Exemple #11
0
def generate_text_from_cleverbot(text_raw):
    cb = Cleverbot()
    try:

        cleverbot_reply = cb.ask(text_raw)
        return cleverbot_reply

    except:
        print "Cleverbot failed to reply"
        pass
Exemple #12
0
def begin_chat(session, nick, channel):
    active_chats = session.get({})
    request = (channel.lower(), nick.lower())

    if request in active_chats:
        return False
    else:
        active_chats[request] = Cleverbot()
        session.set(active_chats)
        return True
Exemple #13
0
 def __init__(self, bot):
     self.bot = bot
     self.cb = Cleverbot()
     self.commentList = []
     print(len(self.commentList))
     self.previousTime = time.time()
     self.cd = 0.0
     self.initialized = False
     self.beenSaid = []
     self.king = None
Exemple #14
0
def run(msg):
    input = msg['text'].replace(bot['first_name'] + ' ', '')

    cb = Cleverbot()
    unescape = HTMLParser().unescape

    try:
        message = unescape(cb.ask(input))
    except:
        message = u'🙃'

    send_message(msg['chat']['id'], message, reply_to_message_id = msg['message_id'])
Exemple #15
0
class CleverBot(Plugin):
    commands = ["cb", "cleverbot"]
    cb = Cleverbot(os.environ.get("CLEVERBOT_API_TOKEN"), timeout=60)

    def message_recieved(self, command, message=""):  # pylint:disable=unused-argument
        data = {}
        try:
            data["text"] = self.cb.say(" ".join(message)) or "No response"
        except CleverbotError as error:
            data["text"] = "Error connecting to cleverbot: {}".format(error)
        finally:
            return data

    def __str__(self):
        return "Cleverbot plugin"
Exemple #16
0
def handle_message(instance, command, predicate, message_entity, who,
                   conversation):
    # N***a who send the message (first name)
    who_name = message_entity.getNotify().split(" ")[0]

    if command == "hi" or command == "hola":
        answer = "Hola *" + who_name + "*"
        mac.send_message(instance, answer, conversation)

    elif command == "help":
        answer = "Hola *" + who_name + "*\nNo puedo ayudarte por ahora"
        mac.send_message(instance, answer, conversation)

    elif command == "siono":
        yesno = YesNo(instance, conversation)
        yesno.send_yesno()

    elif command == "yt":
        WAYoutube(instance, who, conversation)

    elif command == "poll":
        # args = <title>, <identifier (optional)>
        args = [x.strip() for x in predicate.split(',')]
        if len(args) <= 0:
            mac.send_message(instance, "_Argumentos invalidos_", conversation)
            return
        if len(args) >= 1:
            if args[0] == "finish":
                poll.finish_my_poll(instance, who, conversation)
                return
            if len(args) == 1:
                title = args[0]
                basic_boll = poll.WAPoll(instance, conversation, who, title)
                basic_boll.send_poll()
            elif len(args) >= 2:
                title = args[0]
                identifier = args[1]
                basic_boll = poll.WAPoll(instance, conversation, who, title,
                                         identifier)
                basic_boll.send_poll()
    else:
        # No command for this so use IA
        cb = Cleverbot()
        answer = cb.ask(command + " " + predicate)
        mac.send_message(instance, answer, conversation)
Exemple #17
0
 async def talk(self, ctx):
     cleverbot_client = Cleverbot(str(self.bot.user.name))
     await self.bot.say(":fire: type exit to quit")
     while True:
         question = await self.bot.wait_for_message(
             author=ctx.message.author,
             channel=ctx.message.channel,
             timeout=60)
         try:
             if question.content == "exit":
                 await self.bot.say(":+1:")
                 break
             await self.bot.send_typing(ctx.message.channel)
             answer = cleverbot_client.ask(question.content)
             await asyncio.sleep(2)
             await self.bot.say(answer)
         except AttributeError:
             await self.bot.say("Ok then, well talk later")
             break
Exemple #18
0
def respond():
    cb = Cleverbot()
    resp = twilio.twiml.Response()
    
    body = request.values.get('Body', None)
    print request.values
    print body
    
    demos_mentioned = []
    
    for demo in known_demos:
        if demo in body.lower():
            demos_mentioned.append(demo)
    
    get_feedback = False
    if demos_mentioned:
        response = get_response_for_demos(demos_mentioned)
        #want to find out if what we gave was effective
        get_feedback = True
    else:
        #no demos were detected so no feedback should be gathered
        get_feedback = False
        
        #they might be giving us feedback from the previous convo
        feedback = handle_feedback(body, resp)
        
        if feedback:
            response = feedback
        else:
            #nope they're not, let's just use cleverbot to reply
            response = cb.ask(body)
    
    if get_feedback:
        store_cookies(demos_mentioned)
        response += "*****\nWas this information helpful? (Y/N)"
        
    resp.sms(response)

    #TODO: store user info (maybe?)
        
    return str(resp)
Exemple #19
0
def main(data):
    if data['config']['settings']['botNick'] in data['recv']\
            or data['config']['settings']['botNick'].lower() in data['recv']:
        from cleverbot import Cleverbot
        global cleverbot
        if not 'cleverbot' in globals():  # check for instance
            cleverbot = Cleverbot()
            # print "making new bot"
        args = argv('', data['recv'])
        query = args['message']
        query = query.replace('\n','')
        query = query.replace('\r','')
        query = query.replace(data['config']['settings']['botNick'] + ':','')
        query = query.replace(data['config']['settings']['botNick'],'CleverBot')
        answer = html_decode(cleverbot.ask(query))
        answer = answer.replace('CleverBot',data['config']['settings']['botNick'])
        answer = answer.replace('Cleverbot',data['config']['settings']['botNick'])
        answer = answer.replace('God','Taiiwo')
        answer = answer.replace('god','Taiiwo')
        debug = 'Query: ' + query + ' -- Answer: "' + answer + '"'
        print debug

        data['api'].say(args['channel'], args['nick'] + ': ' + answer)
Exemple #20
0
from mcstatus import MinecraftServer


Link_to_legends = "http://imgur.com/a/MHNM2"
Legends =["Articuno", "Celebi", "Entei", "Groudon", "Ho-oh", "Kyogre", "Lugia", "Mew", "Mewtwo", "Moltres", "Raikou", "Rayquaza", "Suicune", "Zapdos"]
Colors = {"Orange":"xl", "Green":"Apache", }

VERSION = "0.14.2.6"
description = '''A Bot for the Pulse/Limitless MC Server Discord! Version {}
(Created by Lightning)'''.format(VERSION)
bot = commands.Bot(command_prefix='.', description=description)

LOG = open("./Logs./" + "log" + str(time.time()) + ".txt",'w')

CLEVERBOT = Cleverbot()

voice = None
player = None

startTime = time.time()
afks = {}
inTrivia = False

def isStaff(ctx):
    for role in ctx.message.author.roles:
        if role.name == "Staff":
            return True
    return False

messageNum = 0
Exemple #21
0
def process_chat(*args):
    img = "anna" + str(random.randint(6, 8)) + ".png"
    try:
        ident = args[0]["identifier"]
        global users
        global lastpost
        global cb
        if ident in users:
            interval = (datetime.now() - users[ident]).total_seconds()
            #if interval < 7:
            #    return
        message = args[0]["body"]
        name = args[0]["name"]
        count = str(args[0]["count"])
        convo = args[0]["convo"]
        country_name = args[0]["country_name"]
        country = args[0]["country"]
        if "trip" in args[0]:
            trip = args[0]["trip"]
        else:
            trip = ""
        if trip == "!!n60sL82Wd2" and name == "anna":
            annaposts.append(count)
            return
        # default message
        out_message = ""

        if not message.strip().startswith('.'):
            with sqlite3.connect('lb.sqlite') as conn:
                conn.execute(
                    'INSERT INTO posts(id,ident,name,trip,convo,text,country,country_name,date) VALUES(?,?,?,?,?,?,?,?,?);',
                    (count, ident, name, trip, convo, message, country,
                     country_name, datetime.now()))

        for k, v in replies.items():
            if message.lower() == '.%s' % k:
                out_message = v

        #if (('to die' in message.lower() or 'death' in message.lower() or 'suicide' in message.lower()) and 'want' in message.lower()) or "kill me" in message.lower():
        #    out_message = random.choice(["Kill urself already.", "Just do it. Kill yourself.", "Suicide is the answer.", "Die"])

        # helpful

        if 'dat boi' in message.lower() or 'datboi' in message.lower():
            out_message = "O shit waddup"
        elif 'pian' in message.lower() or 'scriabin' in message.lower():
            out_message = "f**k off"
        elif (('zack' in message.lower() or 'zach' in message.lower()
               or 'cali' in message.lower()) and 'f*g' in message.lower()):
            post_chat('shutting down due to insufficient BTC funds',
                      channel,
                      name="anna",
                      trip=config.annaTrip,
                      convo='',
                      file=img)
            os.kill(os.getpid(), 9)
        elif 'k' in message.lower() and 'pop' in message.lower():
            out_message = "pop pop pop"
            img = "pop.jpg"

#        t = re.compile('[wW]hat (is|are) (.+)\?').match(message)
#        if (t):
#            try:
#                res = wolfram.query(t.group(2))
#                #out_message = next(res.results).text
#                out_message = '\n'.join(z.text for z in res.pods[1:] if z)
#                #out_message = wikipedia.summary(t.group(1), sentences=1)
#            except Exception as e:
#                print res.__dict__
#                print out_message
#                out_message = ""
#                print "wolfram error",e

# kc
        t = re.compile('\.kc( (.+))?').match(message)
        if (t):
            res = kc_quote(t.group(1))
            if res:
                out_message = res

        # reddit
        t = re.compile('\.reddit( (.+))?').match(message)
        if (t):
            if t.group(1) and t.group(1).strip().replace(
                    '_',
                    '').isalpha() and not re.match('.*(4chan)', t.group(1)):
                res = reddit(t.group(1).strip())
            else:
                res = reddit()
            if res:
                out_message, img = res
        # urban
        t = re.compile('\.urban (.+)').match(message)
        if (t):
            res = ''
            for l in urbandict.define(t.group(1)):
                res += "def: %s\nexample: %s\n" % (l['def'].strip(),
                                                   l['example'].strip())
            if res:
                out_message = res
        # play
        t = re.compile('\.play( (.+))?').match(message)
        if (t):
            out_message, img = game.play(t.group(1), ident, name, country)
            convo = "hangman"

        # wolfram
#        t = re.compile('\.wa (.+)').match(message)
#        if (t):
#            try:
#                res = wolfram.query(t.group(1))
#                out_message = next(res.results).text
#            except Exception as e:
#                out_message = refuse_message
#                #img = "anna" + str(random.randint(1,5)) + ".png"
#                img = "shit.jpg"
#                print e

# wiki
        t = re.compile('\.wiki(pedia)? (.+)').match(message)
        if (t):
            try:
                out_message = wikipedia.summary(t.group(2), sentences=3)
            except wikipedia.DisambiguationError as e:
                out_message = str(e)
            except Exception as e:
                out_message = refuse_message
                #img = "anna" + str(random.randint(1,5)) + ".png"
                img = "shit.jpg"
                print e

        # google
#        t = re.compile('\.google( (.+))?').match(message)
#        if (t):
#            try:
#                r = duckduckgo.query(t.group(2))
#                for i in xrange(len(r.related) if len(r.related) < 4 else 3):
#                    result = r.related[i]
#                    out_message += '\n'+ result.text + '\n'
#                    out_message += '[i]' + result.url + ' [/i]\n'
#            except Exception as e:
#                out_message = refuse_message
#                #img = "anna" + str(random.randint(1,5)) + ".png"
#                img = "shit.jpg"
#                print e

# random
        t = re.compile('\.random( (.+))?').match(message)
        if (t):
            try:
                if t.group(1) and t.group(2).isdigit():
                    out_message += str(random.randint(0, int(t.group(2))))
                else:
                    out_message += str(random.randint(0, 100))
                    if int(out_message) % 10 == int(out_message) / 10:
                        out_message += " (you got doubles :3)"
            except Exception as e:
                out_message = "That was ambiguous, Onii-chan"
                #img = "anna" + str(random.randint(1,5)) + ".png"
                img = "shit.jpg"
                print e
        # fortune
        t = re.compile('\.fortune( (.+))?').match(message)
        if (t):
            out_message = os.popen('fortune fortunes').read().strip()
            #out_message = os.popen('fortune').read().strip()

        # fortune-pl
        t = re.compile('\.fortunepl( (.+))?').match(message)
        if (t):
            out_message = os.popen('fortune pl').read().strip()

        # fortune-ru
        t = re.compile('\.fortuneru( (.+))?').match(message)
        if (t):
            out_message = os.popen('fortune ru').read().strip()

        # fortune-fr
        t = re.compile('\.fortunefr( (.+))?').match(message)
        if (t):
            out_message = os.popen('fortune fr').read().strip()

        # riddle
        t = re.compile('\.riddle( (.+))?').match(message)
        if (t):
            out_message = os.popen('fortune riddles').read().strip()
        # stats
        t = re.compile('\.stats( (.+))?').match(message)
        if (t):
            out_message = stats()
        # scores
        t = re.compile('\.scores( (.+))?').match(message)
        if (t):
            out_message = game.stats()
        # online
        t = re.compile('\.online( (.+))?').match(message)
        if (t):
            out_message = online()
        # countries
        t = re.compile('\.countries( (.+))?').match(message)
        if (t):
            out_message = countries()
        # regions
        t = re.compile('\.regions( (.+))?').match(message)
        if (t):
            out_message = regions()
        # joke
        t = re.compile('\.joke( (.+))?').match(message)
        if (t):
            out_message = norris(
            )  #random.choice(open('jokes.txt').read().split('\n-')).strip()
        # meme
        t = re.compile('\.meme( (.+))?').match(message)
        if (t):
            out_message = " "
            img = 'memes/' + random.choice(os.listdir('memes'))
        # hi
        t = re.compile('\.hi( (.+))?').match(message)
        if (t):
            out_message = "%s, %s!" % (random.choice(
                ['Hi', 'Hello', 'Privet', 'Hola', 'Bonjour', 'Hallo']), name)
        # help
        t = re.compile('\.help( (.+))?').match(message)
        if (t):
            out_message = "commands are .hi .p**n .kc .random .joke .fortune .fortuneru .fortunefr .fortunepl .google .urban .wa .wiki .riddle .meme .play .reddit .stats .countries .regions .online .scores"
            out_message += '\nor "Anna ...?" or "What is/are ...?"'
        # p**n
        t = re.compile('\.p**n( (.+))?').match(message)
        if (t):
            out_message = random.choice([
                'You are wankaholic',
                'You are addicted to masturbating',
                'You are addicted to pornography',
                'Hi wanka',
            ])
            img = 'wanka.jpg'
            img = 'p**n/' + random.choice(os.listdir('p**n'))
            convo = 'General'

        ## add
        #t = re.compile('\.add (\w+) (.+)').match(message)
        #if (t):
        #    #print t.groups(1)[0], t.groups(1)[1]
        #    replies[t.groups(1)[0]] = t.groups(1)[1]

        if (message.splitlines() and message.splitlines()[0].lstrip('>')
                in annaposts) or (message.lower().startswith('anna')
                                  and message.endswith('?')):
            try:
                if message.lower().startswith('anna'):
                    message = message[4:].strip()
                out_message = cb.ask(u'\n'.join(
                    line for line in message.splitlines()
                    if not line.startswith('>')))
            except Exception as e:
                out_message = refuse_message
                #img = "anna" + str(random.randint(1,5)) + ".png"
                img = "shit.jpg"
                print e
                cb = Cleverbot()

        #if count[-1]==count[-2] and random.randint(1,5)==2:
        #    out_message = "CHECKED"
        #    img = "dubs" + str(random.randint(1,5)) + ".jpg"

###this checks trips, quads, quints and septs
###>you need not dubs folder but files dubs1.jpg - dubs5.jpg right in anna folder
#if count[-1]==count[-2]==count[-3] or count[-1]==count[-2]==count[-3]==count[-4] or count[-1]==count[-2]==count[-3]==count[-4]==count[-5] or count[-1]==count[-2]==count[-3]==count[-4]==count[-5]==count[-6]:
# out_message = "CHECKED"
# img = "dubs" + str(random.randint(1,5)) + ".jpg"

#if 'anna' in message.lower():
#    out_message = "you said my name, Onii-chan?"
#if 'kcmod' in message.lower():
#    out_message = "mods are cucks"

        if not out_message and random.randint(
                0,
                45) == 5 and (datetime.now() - lastpost).total_seconds() > 30:
            print(datetime.now() - lastpost).total_seconds()
            out_message = kc_quote()
            count = 0

        if out_message != "":
            users[ident] = datetime.now()
            lastpost = datetime.now()
            if (count):
                out_message = ">>" + count + "\n" + out_message  #.encode('ascii', 'ignore')
            post_chat(out_message,
                      channel,
                      name="anna",
                      trip=config.annaTrip,
                      convo=convo,
                      file=img)
    except Exception as e:
        #print type(e), e
        #raise
        print e
Exemple #22
0
import sys
import json
import requests
import random
#import wolframalpha
import urbandict
from cleverbot import Cleverbot
import random
from datetime import datetime, timedelta
import config

import sqlite3
import shutil
import pickle
from game import Game
cb = Cleverbot()
game = Game()


def kc_quote(needle=None):
    conn = sqlite3.connect('KC.db')
    if needle:
        cur = conn.execute(
            'SELECT text FROM kcposts WHERE text LIKE ("%" || ? || "%") ORDER BY RANDOM() LIMIT 1',
            (needle, ))
        text = cur.fetchone()
        if text:
            return '\n'.join(line for line in text[0].splitlines()
                             if not line.startswith('>>'))
        else:
            return
Exemple #23
0
import discord
import random
import Tictactoe
from cleverbot import Cleverbot

cleverbot_client = Cleverbot()
client = discord.Client()


@client.async_event
def on_message(message):
	if message.author == client.user:
		return

	if message.content.startswith('#test'):
		yield from client.send_message(message.channel, "This is a f*****g test")

	if message.content.startswith('#frank'):
		yield from client.send_message(message.channel, "Hey I'm Frank. Would you like to know my opinion?")
		opinions = ["Hey, I agree with your opinion.", "I'm f*****g triggered!", "Hey, your opinion's stupid"]
		msg = yield from client.wait_for_message(timeout = 10, author = message.author)
		if msg is None:
			yield from client.send_message(message.channel, "Wow... I really wanted to share my opinion")
			return
		if msg.content == "yes":
			num = random.randint(0,2)
			yield from client.send_message(message.channel, opinions[num])
		elif msg.content == "no":
			yield from client.send_message(message.channel, "Um. Wu")
		elif msg.content == "wu":
			while True:
Exemple #24
0
    'gauss cuenta atras': 'cuenta_atras',
    '/kill': 'kill'
}

frases = {
    '!edu': 'set_sentence_edu',
    '!monumento stackoverflow': 'stackoverflow_link',
    '!monumento OW': 'monumento_chris',
    '!españa'
    '!luis': 'set_sentence_luis',
    '!music': 'send_music'
}

audio = {'la grange': 'send_music'}
telegram = tg.Telegram()
cleverbot = Cleverbot('Gauss')

update_old = -1
in_message = ''
in_message_copy = ''


def run(user_id):
    in_message_copy = ''
    if isinstance(in_message, str):
        in_message_copy = in_message
    if (in_message not in commands) and (in_message not in frases) and (
            in_message_copy[:7] !=
            '/rng vs') and (in_message_copy[:6] !=
                            '!music') and (in_message_copy[:5] != '/kill'):
        if 'reply_to_message' in updates['result'][-1]['message']:
Exemple #25
0
def cleverbot_answer(message):
    cb = Cleverbot()
    answer = cb.ask(message)
    return answer
Exemple #26
0
    def load(self):
        self.chat_bot = Cleverbot()

        self.dm_bots = defaultdict(Cleverbot)
Exemple #27
0
 def __init__(self, command='ask'):
     super(self.__class__, self).__init__(command=command)
     Observer.__init__(self)
     self.cb = Cleverbot('cleverbot-tautbot')
Exemple #28
0
def get_bot_for_user(bots_map, user):
    """Gets the bot created for the user"""
    if not bots_map.has_key(user.id):
        print "Creating new CB session for", user.id, user.name, user.jobs
        bots_map[user.id] = Cleverbot("tinder-cb")
    return bots_map[user.id]
Exemple #29
0
def reply(session: str, text: str) -> str:
    global sessions
    if session not in sessions:
        sessions[session] = Cleverbot()
    return sessions[session].send(text)
Exemple #30
0
def create_bot_with_id(bot_id):
    bot = Cleverbot()
    id_to_bot[bot_id] = bot
    return bot