Ejemplo n.º 1
0
    def post(self, user_name, project_name):
        try :
            # config = configparser.ConfigParser()
            # config.read('../grafluent.ini')

            bucket_name = os.getenv('DEFAULT_BUCKET')
            
            parser = reqparse.RequestParser()
            parser.add_argument('query', required=True, help='Please provide a valid search query.', trim=True),
            args = parser.parse_args()

            page = wiki(args['query'])
            df = page.createDF()
            df_list = df.values.tolist()
            fname = page.getTitle().replace(" ", "_").lower()
            
            csv = bucket_name.strip() + '/%s/%s/source_documents/wiki_%s.csv' % (user_name.strip(), project_name.strip(), fname.strip())

            with s3.open(csv, 'w') as file:
                df.to_csv(file)
            return {
                'status' : 'Posted new data',
                'file_name' : str(fname) + '.csv',
                'data'   : df_list
            }, 201

        except IndexError as exception:
            return {
                'status' : 'Please enter valid query'
            },  400 
Ejemplo n.º 2
0
def callmodule(message,peer):
	message=message.lower()
	modules=["wiki","bot","google"]  #Add module name here so that the for loop below works
	for module in modules:
		if (message.find(module)==0):
			message=message[len(module)+1:]
			if module=="wiki":
				reply=wiki(message)
				if ("Cannot acces link!" in reply):
					reply="No wikipedia article on that, googling instead\n"+google(message)
				return reply
			if module=="google":
				return google(message)
			if module=="bot":
				message=message.lstrip()
				reply=wolfram(message)
				if (reply=="noidea"):
					reply="tough. I'll google that\n"+google(message)
				return reply
	global chattybot
	if chattybot:
		global botsessions
		global bot1
		if peer not in botsessions:
			botsessions[peer]=bot1.create_session()
		reply = botsessions[peer].think(message)
		VALID_TAGS = ['br']
		soup = BeautifulSoup(reply)
		for tag in soup.findAll(True):
			if tag.name not in VALID_TAGS:
				tag.hidden = True
		reply=soup.renderContents()
		reply=reply.replace('<br />','\n')
		return reply
Ejemplo n.º 3
0
def wiki_answer():
    word = request.form['word']
    if word == '':
        result = '入力がないため、該当する結果がありませんでした。'
    else:
        result = wiki(word)

    return render_template('wiki_result.html', result=result)
Ejemplo n.º 4
0
def wiki_answer():
    word = request.form['word']
    if word == '':
        result = '検索情報を入力して下さい。'
    else:
        result = wiki(word)

    return render_template('wiki_result.html', result=result)
Ejemplo n.º 5
0
def action(text):
    if text.find("YouTube") != -1:
        search_term = text[text.index("play") + 4:text.index("on YouTube")]
        got, dur = get_youtube(search_term)
        list = [got, dur]
        speak("playing" + search_term + "on youtube")
        push("youtube", list)

    elif text.find("turn on the lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1On")
        speak("turning on lights")

    elif text.find("turn off the lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1Off")
        speak("turning off lights")

    elif text.find("tell me something about") != -1:
        search_wiki = text[text.index("tell me something about ") +
                           len("tell me something about"):]
        got_wiki = wiki(search_wiki)
        img = find_image(search_wiki)

        to_send = [got_wiki, img]
        push("wiki", to_send)
        speak(got_wiki)

    elif text.find("show me a picture of") != -1:
        search_image = text[text.index("show me a picture of") +
                            len("show me a picture of"):].replace(" ", "")
        print(search_image)
        push("images", find_image(search_image))
        speak("ok! heres how" + search_image + "looks ")

    elif text.find("click a picture ") != -1:
        #click_picture()
        pass

    elif text.find("play") != -1:
        global search_music
        search_music = text[text.index("play") + len("play"):]
        speak("playing" + search_music)
        push("music", search_music)
        music_play(search_music)
        got, dur = get_youtube(search_music)
        time.sleep(dur)

    elif text.find("stop") != -1:
        mixer.music.pause()
        push("stop", "")

    elif text.find("continue") != -1:
        mixer.music.unpause()

    else:
        got = hound(text)
        push("text", got)
        speak(got)
Ejemplo n.º 6
0
 def __get_attrs(self, r):
     l = r.attrib
     ll = {}
     for i in l:
         if i[0] == '_':
             try:
                 if l[i] == "_NAME_FROM_FACE":
                     ll[i] = "John"  #get face image from camera and find in DB
                 elif l[i] == "_TEXT_FROM_OBJECT":
                     ll[i] = object_recognition().detect_image()
                 elif l[i] == "_FIND_LOCATION":
                     ll[i] = str(location().find_location_for(
                         self.current_question))
                 elif l[i] == "_WIKI_SEARCH":
                     ll[i] = wiki().wiki_search(self.current_question)
                 elif l[i] == "_WIKI_SUMMARY_SEARCH":
                     ll[i] = wiki().wiki_summary_search(
                         self.current_question)
                 elif l[i] == "_WIKI_FULL_SEARCH":
                     ll[i] = wiki().wiki_full_search(self.current_question)
                 elif l[i] == "_TEXT_FROM_IMAGE":
                     ll[i] = object_recognition().text_from_image()
                 elif l[i] == "_ENABLE_CAMERA":
                     t = threading.Thread(target=self._ENABLE_CAMERA)
                     t.start()
                 elif l[i] == "_DISABLE_CAMERA":
                     self._DISABLE_CAMERA()
                 else:
                     ll[i] = ""
             except:
                 print(
                     "Exception when try to process XML instruction as a python function call."
                 )
                 ll[i] = ""
     if len(ll) != 0:
         self.is_learning_mode = False
     return ll
Ejemplo n.º 7
0
def return_wiki(message):
    """Middle function for calling wiki package.

    Parameters
    ----------
    message : dict
        The message object.

    Returns
    -------
    msg : str
        Video url.

    """
    return wiki.wiki(message.get('message').lower().split(' '))
Ejemplo n.º 8
0
def action(text):
    if text.find("YouTube") != -1:
        search_term = text[text.index("play") + 4:text.index("on YouTube")]
        got, dur = get_youtube(search_term)
        list = [got, dur]
        speak("playing" + search_term + "on youtube")
        push("youtube", list)

    elif text.find("turn on lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1On")
        speak("turning on lights")

    elif text.find("turn off lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1Off")
        speak("turning off lights")

    elif text.find("tell me something about") != -1:
        search_wiki = text[text.index("tell me something about") +
                           len("tell me something about"):]
        got_wiki = wiki(search_wiki)
        push("wiki", got_wiki)
        speak(got_wiki)

    elif text.find("show me a picture of") != -1:
        search_image = text[text.index("show me a picture of") +
                            len("show me a picture of"):].replace(" ", "")
        print(search_image)
        push("images", find_image(search_image))
        speak("ok! heres how" + search_image + "looks ")

    elif text.find("click a picture ") != -1:
        click_picture()

    elif text.find("play") != -1:
        global search_music
        search_music = text[text.index("play") + len("play"):]
        speak("playing" + search_music)
        push("music", search_music)
        worker().start()

    else:
        speak("sorry I don't know that one")
Ejemplo n.º 9
0
def callmodule(message, peer):
    message = message.lower()
    modules = ["wiki", "bot", "google"
               ]  #Add module name here so that the for loop below works
    for module in modules:
        if (message.find(module) == 0):
            message = message[len(module) + 1:]
            if module == "wiki":
                reply = wiki(message)
                if ("Cannot acces link!" in reply):
                    reply = "No wikipedia article on that, googling instead\n" + google(
                        message)
                return reply
            if module == "google":
                return google(message)
            if module == "bot":
                message = message.lstrip()
                reply = wolfram(message)
                if (reply == "noidea"):
                    reply = "tough. I'll google that\n" + google(message)
                return reply
    global chattybot
    if chattybot:
        global botsessions
        global bot1
        if peer not in botsessions:
            botsessions[peer] = bot1.create_session()
        reply = botsessions[peer].think(message)
        VALID_TAGS = ['br']
        soup = BeautifulSoup(reply)
        for tag in soup.findAll(True):
            if tag.name not in VALID_TAGS:
                tag.hidden = True
        reply = soup.renderContents()
        reply = reply.replace('<br />', '\n')
        return reply
Ejemplo n.º 10
0
async def command(text,group=0):
    try:
        result = await findcommand(text,group)
        c = result
        try:
            d = result.split(' ')
            d = d[0]
        except:
            d = c
        if d == 'echo':
            echo = re.sub(r'^echo ','',c)
            return(echo)
        if c == 'help':
            return(await help())
        elif d == 'paa':
            return('爬')
        elif d == 'mcv':
            return(await mcv())
        elif d == 'mcbv':
            return(await mcbv())
        elif d == 'mcdv':
            return(await mcdv())
        elif d.find('新人')!= -1 or d.find('new')!=-1:
            return (await new())
        elif d.find("wiki") != -1 or d.find("Wiki") != -1:
            return(await(wiki(c,group)))
        elif c.find("bug") != -1 or c.find("MC-") != -1 or c.find("BDS-") != -1 or c.find("MCPE-") != -1 or c.find("MCAPI-") != -1 or c.find("MCCE-") != -1 or c.find("MCD-") != -1 or c.find("MCL-") != -1 or c.find("REALMS-") != -1 or c.find("MCE-") != -1 or c.find("WEB-") != -1:
            return(await bugtracker(c))
        elif d == 'server' or d == 'Server':
            return(await ser(c))
        elif d.find("user") != -1 or d.find("User") != -1:
            if c.find("-p") != -1:
                f = re.sub(' -p', '', c)
                print(f)
                try:
                    z = re.sub(r'^User','user',f)
                    try:
                        g = re.match(r'^user ~(.*) (.*)',z)
                        h = g.group(1)
                        h2 = g.group(2)
                        h2 = re.sub('_',' ',h2)
                    except Exception:
                        try:
                            g = re.match(r'^user-(.*?) (.*)',z)
                            h = 'minecraft-'+g.group(1)
                            h2 = g.group(2)
                            h2 = re.sub('_', ' ', h2)
                        except Exception:
                            try:
                                g = re.match(r'^user (.*?):(.*)', z)
                                h = 'minecraft-' + g.group(1)
                                h2 = g.group(2)
                                h2 = re.sub('_', ' ', h2)
                            except Exception:
                                try:
                                    g = re.match(r'user (.*)',z)
                                    h = 'minecraft'
                                    h2 = g.group(1)
                                    h2 = re.sub('_', ' ', h2)
                                except Exception as e:
                                    print(str(e))
                    if checkuser(h,h2):
                        return(await Userp(h,h2)+"[[usn:"+h2+"]]")
                    else:
                        return ('没有找到此用户。')
                except Exception as e:
                    print(str(e))

            else:
                return(await Username(c))
        elif d == 'rc':
            return(await rc())
        elif d == 'ab':
            return(await ab())
        elif d == 'ping':
            return(await ping())
        else:
            pass
    except:
        pass
Ejemplo n.º 11
0
import moz
import builder
import classification
#import lsa
import wiki
import time

# Build the training set:

#builder.create_wiki_database() #if not created
wiki = wiki.wiki()
wiki.get_categories()
wiki.get_articles('ru', True)
wiki.get_articles('en', True)
#builder.build_ru_matrix()
#builder.build_en_matrix()
#lsa.tfidf('ru_matrix')
#lsa.tfidf('en_matrix')
#builder.give_ID()
#SVD('ru', 100)
#SVD('en', 100)

# Analyze backlinks:
# ! You need an account on moz.com for using this !

#builder.create_webpages_database() #if not created
##t1 = time.clock()
##site = 'http://www.apmath.spbu.ru/'
##member = 'mozscape-123456789'
##key = 'b7ead4f08c83ef8738d9150845899a24'
##scope = 'page_to_subdomain'
Ejemplo n.º 12
0
    def get_message(self, user, msg):
        if msg.startswith(".ende"):
            log("%s:%s" % (user,msg))
            query = msg.split(".ende")[1].strip()
            if len(query) > 0:
                msg = "%s: %s" % (user, ende(query))
                return msg
            return None

        elif msg.startswith(".en"):
            log("%s:%s" % (user,msg))
            query = msg.split(".en")[1].strip()
            if len(query) > 0:
                msg = "%s: %s" % (user, deen(query))
                return msg
            return None

        elif msg.startswith(".deen"):
            log("%s:%s" % (user,msg))
            query = msg.split(".deen")[1].strip()
            if len(query) > 0:
                msg = "%s: %s" % (user, deen(query))
                return msg
            return None

        elif msg.startswith(".de"):
            log("%s:%s" % (user,msg))
            query = msg.split(".de")[1].strip()
            if len(query) > 0:
                msg = "%s: %s" % (user, ende(query))
                return msg
            return None

        elif msg.startswith(".w en"):
            log("%s:%s" % (user,msg))
            query = msg.split(".w en")[1].strip()
            if len(query) > 0:
                msg = "%s: %s" % (user, wiki(query, english=True))
                return msg
            return None

        elif msg.startswith(".w"):
            log("%s:%s" % (user,msg))
            query = msg.split(".w")[1].strip()
            if len(query) > 0:
                msg = "%s: %s" % (user, wiki(query))
                return msg
            return None

        elif msg.startswith(".help"):
            log("%s:%s" % (user,msg))
            msg = "%s: Commands = [.ende / .de], [.deen / .en], [.w (de wikipedia)], [.w en (en wikipedia)], Repo = https://github.com/lorenmh/EndeBot" % user
            return msg

        elif msg.startswith(self.nickname + ':'):
            log("%s:%s" % (user,msg))
            msg = "%s: ich bin EndeBot.  Message '.help' for command-list" % user
            return msg
        
        re_yt = re.compile("(^|\s+|\/|=)(?P<id>[A-Za-z0-9\_\-]{11})($|\s+|\/\?\&)")
        yt_search = re_yt.search(msg)
        if yt_search:
             info = yt(yt_search.group('id'))
             if info:
                  log("%s:%s" % (user, msg))
                  return info
        
        return None
from mail import mail
from wea import weather
from bot import bot
from wiki import wiki

# Infinite Loop
count = 0
while 1:
    tts(mail())
    tts(weather('jabalpur'))
    tts(news())
    while 1:
        string = str(input("Ask -> "))
        if "weather report" in string:
            location = str(input("Enter LOC -> "))
            tts(weather(location))
        elif "news" in string:
            tts(news())
        elif "mail" in string:
            tts(mail())
        elif "song" in string:
            tts("Which song you wanna listen")
            song = str(input("Song -> "))
            music(song)
        elif "neola" in string:
            string = string.replace("neola search ", "")
            tts(bot(string))
        elif "wiki" in string:
            string = string.replace("wiki ", "")
            tts(wiki(string))
Ejemplo n.º 14
0
def callmodule(message,peer,search):
	global flag
	global cursor
	global cnxn
	message=message.lower()
	modules=["wiki","bot","google","math","trans","weather","cricket","youtube","nearby"]  #Add module name here so that the for loop below works
	for module in modules:
		if (message.find(module)==0):
			message=message[len(module)+1:]
			if module=="wiki":
				reply=wiki(message,peer,search,cursor,cnxn)
				print reply
				try:
				  if ("Cannot acces link!" in reply):
					reply="No wikipedia article on that, googling instead\n"+google(message)
					return reply
				except:
				  print"except"
				  
				return None
				  
			if module=="google":
				return google(message)
			if module=="bot":
				message=message.lstrip()
				reply=wolfram(message)
				if (reply=="noidea"):
					reply="tough. I'll google that\n"+google(message)
				return reply
			
			if module=="math":
			      a=eval(compile(message, '<string>', 'eval', __future__.division.compiler_flag))
			      #print a
			      return str(a)
			    
						    
			if module=="trans":
			      result=translate(message)
			      return result
			
			if module=="nearby":
			      print "nearby"
			      m=message.split(",")
			      m1=m[0]
			      print m1
			      try:
				m2=m[1]
				
			      except:
				m2=10000
				print m2
			      places(m1,peer,search,cursor,cnxn,m2)
			      return None
			
			if module=="weather":
			      result=setUrl(message)
			      return result
			    
			if module=="youtube":
			     
			      
			      #print "done"
			      try:
				a=querry(message,peer,search,cursor,cnxn)
				return None
			      except:
				print"else main"
				return None
				  
				     
				 # return module
			     # else:
				  #return result
			    
			if module=="cricket":
			      cric = CricbuzzParser()
			      match = cric.getXml()
                              details = cric.handleMatches(match) #Returns Match details as a Dictionary. Parse it according to requirements.
                              b=''
                              for i in details :
                                     b=b+str(i)
                              #print b 
			      return b
			  
			  
		
	global chattybot
	if chattybot:
		global botsessions
		global bot1
		if peer not in botsessions:
			botsessions[peer]=bot1.create_session()
		reply = botsessions[peer].think(message)
		VALID_TAGS = ['br']
		soup = BeautifulSoup(reply)
		for tag in soup.findAll(True):
			if tag.name not in VALID_TAGS:
				tag.hidden = True
		reply=soup.renderContents()
		reply=reply.replace('<br />','\n')
		return reply
Ejemplo n.º 15
0
    def privmsg(self, user, channel, msg): # What happens when bot gets a message
        self.count = self.count + 1
        swag = user.split('!')
        user = user.split('!', 1)[0] # Turn user!ident@host into nickname
        print("%s:<%s> %s" % (channel, user, msg)) # Show the message in console
        capsIntact = msg
        if channel == self.nickname: # Check if it's a private message
            pm = 1 
        else:
            pm = 0
#            append(channel, user, msg)
            
        msg = msg.lower()
        if swag[1].lower() in self.opersh or channel.lower() == "#dino": # if the user is in the oper list
            admin = 1 
        else: 
            admin = 0
        
        if channel == "#thegrammarnaziboners":
            tstchan = 1
        else:
            tstchan = 0
            
        insult_ = True
        fibo_ = True
        choose_ = True
        dict_ = True
        wiki_ = True
        tz_ = True
        wz_ = True
        rule_ = True
        convert_ = True
        flist = {'insult': insult_, 'fibo': fibo_, 'choose': choose_, 'dict': dict_, 'wiki': wiki_, 'wz': wz_,  'tz': tz_, 'rule': rule_, 'convert': convert_}

        
        if msg.startswith("~die"): 
            try:
                if admin == 1:                    
                    if user.lower() in self.azi:
                        print "Killed by %s" % user
                        reactor.stop()
                    else:
                        self.notice(user, "Not amused")
                        print("%s attempted to kill me!")
            except:
                self.notice(user, "You are not authorized to perform this command.")
                print("%s attempted to kill me!" % user)
        elif msg.startswith("~set ") and swag.lower() == "*****@*****.**":
#            self.sendLine("MODE %s +B %s" % (self.nickname, self.nickname))
            self.mode(self.nickname, True, 'B', limit=None, user=self.nickname, mask=None)
        elif msg.startswith("~stop") and admin == 1:
            self.quit()
        elif msg.startswith("~id") and (admin == 1 or user.lower == "Kojiro"):
            self.msg("Nickserv", "identify hamsterbot %s" % self.password)
        elif msg.startswith("~ghost ") and admin == 1:
            msg = msg.split()
            self.msg("Nickserv", "ghost %s swagonball" % msg[1])
        elif msg.startswith("~donut") and admin == 1:
            msg = msg.split(' ') 
            try:
                if msg[1].isdigit(): #hopefully if i use a number it'll join that chan
                    i = int(msg[1]) 
                    chan = self.chanlist[i]
                    self.join(chan) #why doesnt this work nvm it does
                elif msg[1] == "joinall" or msg[1] == "all":
                    for item in self.chanlist:
                         self.join(item)
                else:
                    self.join(msg[1])
            except:
                if admin != 1:
                    self.notice(user, "You are not authorized to perform this command.")
                else:
                    self.say(channel, "-_-")
        elif msg.startswith("~bye"): 
            try:
                if admin == 1:
                    self.part(channel)
            except:
                self.notice(user, "You are not authorized to perform 	this command.")
                print("%s attempted to use command ~bye." % user)
        elif msg.startswith("~nick"): 
            try:
                if admin == 1:
                    msg = msg.split(' ')
                    self.setNick(msg[1])
            except:
                self.notice(user, "You are not authorized to perform this command.")
                print("%s tried to change my nick" % user)
        elif msg.startswith("~toggle ") and admin == 1:
            msg = msg.split()
            if len(msg) == 3:
                if flist.has_key(msg[1]):
                    funct = msg[1].strip()
                    if msg[2].strip() == "on" or msg[2] == '1':
                        flist[funct] = True
                    elif msg[2].strip() == 'off' or msg[2] == '0':
                        flist[funct] = False             
                    elif msg[2] == 'not':
                        flist[funct] = not flist[funct]
                    else:
                        self.notice(user, "Values accepted: on/off or 1/0")
                else:
                    self.notice(user, "No function found with that name or function may not be switched on/off")
            elif len(msg) == 2:
                if msg[1] == 'help':
                    self.notice(user, "The following functions may be switched on/off: insult, choose, convert, dict, fibo, rule, tz, wz, wiki")
                elif msg[1] == 'is_on':
                    is_on = []
                    for key, value in flist.iteritems():                    
                        if value == True:
                            is_on.append(key)
                    self.notice(user, "The following functions are on: %r" % is_on)
            else:
                self.notice(user, "Toggle takes 2 arguments. Do ~toggle help for functions that may be toggled on/off")
                
        elif msg.startswith("~say ") and admin == 1:
            msg = msg[5:]
            self.say(channel, msg)
        elif msg.startswith("~note ") and (swag[1].lower()=="*****@*****.**"):
            msg = msg[6:]
#           bs.notes(str(msg))
            self.notice(user, notes(str(msg)))
        elif msg.startswith(":prefixes "):
            msg = msg[10:]
            self.say(channel, whattodo(msg, user))
            
        elif msg.startswith(".insult ") and insult_ == True:
            msg = msg.split(' ')
            #nick = msg[1]                
            try:
                if msg[1].lower() in self.azi:
                    self.say(channel, random.choice(azi_insults))
                elif msg[1].lower() == "?roulette":
                    self.say(channel, "%s, %s" % (user, random.choice(insults)))
                else:
                    insult = "%s, %s" % (msg[1], random.choice(insults))
                    self.say(channel, insult)
            except IndexError:
                self.say(channel, random.choice(insults))
        elif msg.startswith(".inslut") and flist['insult'] == True:
            msg = msg.split(' ')
            insult = "%s, %s" % (user, random.choice(insults))
            self.say(channel, insult)
        elif msg.startswith(".halp") or msg.startswith(".help"):
            try:
                if admin == 1:
                    self.notice(user, "Commands: .help, .insult <user>, .fibo, .convert <conversion> <numbers>, .gay, .rule <1-47>, .choose <option1, option2,...>, .dict <query>")
                    self.notice(user, "Restricted commands: ~die, ~bye, ~donut <channel>, ~nick <newnick>")
            except:
                    self.notice(user, "Commands: .help, .about, .insult <user>, .fibo, .convert <conversion> <numbers>")
#       elif msg.startswith("~~"):
#           msg = msg.strip("~~")
#           exec(msg)
        elif msg.startswith(".choose ") and flist['choose'] == True:
            msg = msg[8:]
#           re.sub("or*", '', msg)
            
            msg = msg.split(",")
            msg = random.choice(msg)
            words = msg.split(' ')
            if words[0] == 'or' and len(words) > 1:
                msg = msg.replace('or ','')
            self.msg(channel, "%s: %s" % (user, msg.strip()))
#        elif msg.startswith(".last"):
#            msg = msg[5:]
#            list = last(channel, msg)
#            for item in list:
#                self.msg(user, item)
        elif msg.startswith(".wiki ") and flist['wiki'] == True: #broken wikipedia feature
            msg = msg[6:]
            msg = msg.replace(' ', '_')
            self.msg(channel, str(wiki(str(msg))))
        elif msg.startswith(".dict ") and flist['dict'] == True: #dictionary feature
 #           msg = capsIntact
            msg = msg[6:]
            self.msg(channel, dict(msg))
        elif msg.startswith(".tz ") and flist['tz'] == True: #timezone feature
            msg = msg[4:]
            self.msg(channel, tz(msg))
        elif msg.startswith(".wz ") and flist['wz'] == True: #weatherbot feature
            msg = msg[4:]
            self.msg(channel, wz(msg))
        elif msg.startswith(".gay"):
            self.msg(channel, "%s: http://blog.okcupid.com/index.php/gay-sex-vs-straight-sex" % user)
        elif msg.startswith(".rule ") and flist['rule'] == True:
            msg = msg.split()
            self.msg(channel, rules((msg[1].strip())))
        elif msg.startswith(".fibo") and flist['fibo'] == True: 
            msg = msg.split(' ')
            num = msg[1]
            i = fib2(int(num))
            self.msg(channel, str(i))
        elif msg.startswith(".convert") and flist['convert'] == True: 
            msg = msg.split(' ')
            if convert(msg).startswith('S') or convert(msg).startswith('N'):
                if '::' in convert(msg):
                    resp = convert(msg).split('::')
                    self.notice(user, resp[0])
                    self.notice(user, resp[1])
                else:
                    self.notice(user, convert(msg))
            elif pm == 1:
                self.notice(user, convert(msg))
            else:
                self.msg(channel, convert(msg))
Ejemplo n.º 16
0
def wikiSearch():
    txt = area.get('1.0', END)
    clear()
    area.insert('1.0', wk.wiki(txt))