Esempio n. 1
0
def command( message, user, channel ):
	try:
		res = requests.get( "http://whatthefuckshouldimakefordinner.com/" )
		meal = __main__.fixHTMLChars( __main__.strbetween( res.text, "\" target=\"_blank\">", "</a></dt>" ) )
		url = __main__.fixHTMLChars( __main__.strbetween( res.text, "<dt><a href=\"", "\" target=\"_blank\">" ) )
		if meal != "":
			__main__.sendMessage( meal + " - " + url, channel )
		else:
			__main__.sendMessage( "You will starve!", channel )
		return True
	except:
		return False
Esempio n. 2
0
def command( message, user, channel ):
	try:
		res = requests.get( "https://live.xbox.com/en-US/Profile?gamertag=" + message )
		gamerscore = __main__.fixHTMLChars( __main__.strbetween( res.text, "<div class=\"gamerscore\">", "</div>" ) )
		lastseen = __main__.fixHTMLChars( __main__.strbetween( res.text, "<div class=\"presence\">", "</div>" ) )
		gamertag = __main__.fixHTMLChars( __main__.strbetween( res.text, "<title>", "&#39;s Profile" ) ) #get proper case of gamertag
		if gamerscore != "":
			__main__.sendMessage( gamertag + " :: Status: " + lastseen + " :: Gamerscore: " + gamerscore, channel )
		else:
			__main__.sendMessage( message + " was not found.", channel )
		return True
	except:
		return False
Esempio n. 3
0
File: fml.py Progetto: EliteTK/PyBot
def command( message, user, channel ):
	try:
		res = requests.get( "http://m.fmylife.com/random" )
		__main__.sendMessage( __main__.fixHTMLChars( __main__.strbetween( res.text, "<p class=\"text\">", "</p>" ) ), channel )
		return True
	except:
		return False
Esempio n. 4
0
def command( message, user, channel ):
	try:
		res = requests.get( "http://www.thathigh.com/random" )
		__main__.sendMessage( __main__.fixHTMLChars( __main__.strbetween( res.text, "<p>", "</p>" ) ), channel ) 
		return True
	except:
		return False
Esempio n. 5
0
File: pun.py Progetto: EliteTK/PyBot
def command(message, user, channel):
    try:
        res = requests.get("http://www.punoftheday.com/cgi-bin/randompun.pl")
        pun = __main__.fixHTMLChars(__main__.strbetween(res.text, "<p>", "</p>"))
        if pun != "":
            __main__.sendMessage(pun, channel)
        else:
            __main__.sendMessage("No pun for you!", channel)
        return True
    except:
        return False
Esempio n. 6
0
def command( message, user, channel ):
	try:
		res = requests.get( "http://randomfunfacts.com/" )
		fact = __main__.fixHTMLChars( __main__.strbetween( res.text, "<font face=\"Verdana\" size=\"4\"><strong><i>", "</i></strong>" ) )
		if fact != "":
			__main__.sendMessage( fact, channel )
		else:
			__main__.sendMessage( "No fact for you!", channel )
		return True
	except:
		return False
Esempio n. 7
0
def command(message, user, channel):
    try:
        res = requests.get("http://dictionary.reference.com/browse/" + message)
        wordCased = __main__.fixHTMLChars(
            __main__.strbetween(res.text, '<meta name="description" content="', " definition, ")
        )
        if wordCased != "":
            definition = __main__.fixHTMLChars(
                __main__.strbetween(
                    res.text, '<meta name="description" content="' + wordCased + " definition, ", ' See more."/>'
                )
            )
            if definition != "":
                __main__.sendMessage(message + ": " + definition, channel)
            else:
                __main__.sendMessage(message + " was not found.", channel)
        else:
            __main__.sendMessage(message + " was not found.", channel)
        return True
    except:
        return False
Esempio n. 8
0
def command( message, user, channel ):
	try:
		res = requests.get( "http://isup.me/" + message )
		status = __main__.fixHTMLChars( __main__.strbetween( res.text, "<div id=\"container\">", "<p>" ) ).strip()
		#status = __main__.fixHTMLChars( __main__.strbetween( res.text, "target=\"_blank\">", "</div>" ) ).replace( "</a>", "" )
		href = __main__.strbetween( status, "<a href=\"", "class=\"domain\">" )
		status = status.replace( "<a href=\"" + href + "class=\"domain\">", "" )
		status = status.replace( "</a>", "" ).replace( "</span>", "" ).replace( "  ", " " )
		if status != "":
			__main__.sendMessage( status, channel )
		else:
			__main__.sendMessage( "Something went wrong.", channel )
		return True
	except:
		return False
Esempio n. 9
0
def command( message, user, channel ):
	try:
		message = message.strip()
		if message != "":
			res = requests.get( "http://tangorin.com/general/" + message )
			definition = __main__.fixHTMLChars( __main__.strbetween( res.text, "<span class=\"kana\"><ruby><rb>", "</rb>" ) )
			if definition != "":
				__main__.sendMessage( message + ": " + definition, channel )
			else:
				__main__.sendMessage( message + " was not found.", channel )
		else:
			__main__.sendMessage( "Usage: jdic [words]", channel )
		return True
	except:
		return False
Esempio n. 10
0
def command( message, user, channel ):
	try:
		message = message.split( " " )
		amount = message[0]
		codeFrom = message[1]
		codeTo = message[2]
		res = requests.get( "http://www.mobilecurrencyconverter.com/index.php?cur_n=" + amount + "&cur_f=" + codeFrom + "&cur_t=" + codeTo + "&cur_s=major&a=Y" )
		rate = __main__.fixHTMLChars( __main__.strbetween( res.text, "</font><br/><font class=\"cr_cv1\">(", ")</font>" ) )
		if "  " in rate:
			while "  " in rate:
				rate = rate.replace( "  ", " " )
		rate = rate.strip()
		if rate != "" and rate != "1 = 0.00":
			__main__.sendMessage( rate, channel )
		else:
			__main__.sendMessage( "No conversion found, make sure you write the proper currency code.", channel )
		return True
	except:
		return False
Esempio n. 11
0
def command( message, user, channel ):
	try:
		res = requests.get( "http://ws.audioscrobbler.com/2.0/user/" + message + "/recenttracks.xml?limit=1" )
		txt = __main__.fixHTMLChars( res.text )
		artist = __main__.strbetween( txt, "<artist>", "</artist>" )
		song = __main__.strbetween( txt, "<name>", "</name>" )
		album = __main__.strbetween( txt, "<album>", "</album>" )
		
		if album != "":
			albumtext = " from the album " + album
		else:
			albumtext = ""
		
		if "<track nowplaying=\"true\">" in txt:
			nowplaying = " is listening "
		else:
			nowplaying = " last listened "
		if song != "":
			__main__.sendMessage( message + nowplaying + "to " + song + " by " + artist + albumtext, channel )
		else:
			__main__.sendMessage( message + " was not found.", channel )
		return True
	except:
		return False