コード例 #1
0
ファイル: commands.py プロジェクト: AzGoalie/skype-bot
def doCommand(Message, Status):
	stats.stats(Message)
	if (Message.FromDisplayName != "Skype Bot" and (Status == 'SENT' or Status == 'RECEIVED')):
		if Message.Body == '!ping':
			ping(Message)
		elif Message.Body == '!stats':
			stats.printStats(Message)
		elif Message.Body == '!help':
			help(Message)
		elif Message.Body =='!catfact':
			catfact(Message)
		elif Message.Body.startswith('!roll'):
			roll(Message)
		elif 'youtube.com/watch?v=' in Message.Body:
			urlTitle(Message)
		elif 'imgur.com/' in Message.Body and 'i.im' not in Message.Body:
			urlTitle(Message)
		elif Message.Body == '!botstart' and not config.trivia:
			botstart(Message)
		elif Message.Body == '!botend':
			botend(Message)
		elif (Message.Body.startswith('!') and config.chatbotOn and not config.trivia):
			bot(Message)
		elif Message.Body == '!trivia' and not config.chatbot:
			trivia.triviaStart(Message)
		elif Message.Body == '!leaderboard':
			trivia.printLeaderboard(Message)
		elif config.trivia and not config.chatbotOn:
			if Message.Body.startswith('!'):	#There are hidden commands in the trivia loop...
				trivia.triviaLoop(Message)
			else:
				pass
	
		else:
			pass
コード例 #2
0
ファイル: fantasyteam.py プロジェクト: rzalog/Fantasy-Helper
	def _addPlayer(self, player):
		self._players.append(player)
		self._totalStats += player.stats()
		self._stats = self._stats.append(player.stats().stats())

	def _getPlayerStats(self, name):
		first, last = name.split()
		return self._players[(first,last)].stats()

if __name__=='__main__':
	name = raw_input('Enter your team name: ')
	team = FantasyTeam(name)
	playerName = 'name'
	playerName = raw_input('Enter a player name (q to stop): ')
	while playerName != 'q':
		try:
			team.addPlayerByName(playerName)
		except (LookupError, ValueError):
			print 'Player name "' + playerName + '" could not be found.'
			playerName = raw_input('Enter new name: ')
			continue
		playerName = raw_input('Enter new name: ')
	print
	print 'Here is your final team:'
	print 'Team:', team.name()
	print 'Team stats:'
	print team.allStats()
	print
	printStats(team.totalStats())

コード例 #3
0
ファイル: hollowbot.py プロジェクト: jlblatt/Hollowbot
        log.write("Processing text and responding...", "message")
        
        #Process selftext
        cur.execute("select id, content, author from t3 where content is not null")
        for c in cur.fetchall():
            respond.processSelftext(c[0], c[1], c[2])
        
        #Process comments
        cur.execute("select id, body, author from t1")
        for c in cur.fetchall():
            respond.processComment(c[0], c[1], c[2])

    else:
        log.write("Error: could not log in, responses skipped", "error")

stats.printStats()

if len(argv) == 1:
    print "No arguments found, try 'python hollowbot.py runall' or check the README"

# Remove all data from database and logfile
if 'wipe' in argv:
    log.wipe()
    cur.execute("drop table if exists session")
    cur.execute("drop table if exists crawl_locations")
    cur.execute("drop table if exists t3")
    cur.execute("drop table if exists t1")
    cur.execute("drop table if exists responses")
    db.commit()
    print "Data Wiped!!"
コード例 #4
0
    for i in range( 1, len( nodes ) ):
        contig += nodes[ i ][ -1 ]
    return contig

def has_outgoing( node ):
    if len( g[ node ] ) > 0:
        return True
    else:
        return False

for key, item in counts.iteritems():
    if item[ 0 ] == 1 and item[ 1 ] == 1:
        non_branching.add( key )

start = g.keys()[ 0 ]

while edge_count > 0:
    for i in g.keys():
        if i in non_branching or len( g[ i ] ) == 0:
            continue
        start = i
        break
    c = build_graph( start, g )
    contigs.append( c )

result = [merge_nodes(contig) for contig in contigs]
for r in result:
    print r

printStats(result)
コード例 #5
0
ファイル: player.py プロジェクト: rzalog/Fantasy-Helper
####################


def getPlayerInfo(player):
    info = "Name: " + player.name() + '\n'
    info += "Player ID: " + str(player.playerID()) + '\n'
    info += "Team: " + player.team()
    return info


if __name__ == '__main__':
    if playersDidLoadCorrectly:
        fullname = 'name'
        while fullname != 'q':
            fullname = raw_input('Name: ')
            try:
                first, last = fullname.split()
            except ValueError:
                print 'Enter a name in the following format: FIRST LAST'
                continue

            try:
                player = Player((first, last))
            except LookupError:
                print 'Player could not be found. Try again.'
                continue

            print 'Name:', player.name()
            print 'Season:', player.season()
            printStats(player.stats())
コード例 #6
0
ファイル: player.py プロジェクト: rzalog/Fantasy-Helper
####################
# extra functions
####################

def getPlayerInfo(player):
	info = "Name: " + player.name() + '\n'
	info += "Player ID: " + str(player.playerID()) + '\n'
	info += "Team: " + player.team()
	return info

if __name__=='__main__':
	if playersDidLoadCorrectly:
		fullname = 'name'
		while fullname != 'q':
			fullname = raw_input('Name: ')
			try:
				first, last = fullname.split()
			except ValueError:
				print 'Enter a name in the following format: FIRST LAST'
				continue

			try:
				player = Player( (first, last) )
			except LookupError:
				print 'Player could not be found. Try again.'
				continue

			print 'Name:', player.name()
			print 'Season:', player.season()
			printStats(player.stats())