<commit_before># -*- coding: utf8 -*- 
from ircBase import *
from random import randint
import sys

def main(irc):
	message = irc.lastMessage()

	#Quit when told to
	if message.botCommand == 'quit':
		ircMessage().newRoomMessage(irc, 'Later fags').send()
		ircMessage().newServerMessage(irc, 'QUIT').send()
		sys.exit()
	#Quit with update message
	elif message.botCommand == 'update':
		ircMessage().newRoomMessage(irc, 'Brb, updating').send()
		ircMessage().newServerMessage(irc, 'QUIT').send()
		sys.exit()
	#Print the last 10 room messages
	elif message.botCommand == 'history':
		messageParts = message.body.split()
		historyDepth = 10 if len(irc.messageLog) > 11 else len(irc.messageLog) - 1
		if len(messageParts) >= 3:
			try:
				historyDepth = int(messageParts[2]) if int(messageParts[2]) < len(irc.messageLog) else len(irc.messageLog) - 1
			except:
				return
		for i in range(0, historyDepth):
			aMessage = irc.messageLog[len(irc.messageLog) - 1 - historyDepth + i]
			if aMessage.body != None:
				sendingMessageBody = '{0}: {1}'.format(aMessage.sendingNick, aMessage.body)
				ircMessage().newRoomMessage(irc, sendingMessageBody, offRecord = True).send()
	#Print Rafi's GitHub if someone mentions it
	elif message.containsKeywords(['git', irc.nick]):
		ircMessage().newRoomMessage(irc, 'My source is at https://github.com/Mov1s/RafiBot.git').send()
	#Print random Rafi quotes whenever rafi is mentioned
	elif message.containsKeyword(irc.nick) and not message.isBotCommand:
		rafiQuotes = []
		rafiQuotes.append("I'm literally gonna sodomize you. I'm gonna have non consensual sex with your face and butt and then I'm going for your wife and children... Just kidding.")
		rafiQuotes.append("JUKEBOX! I'm gonna put $7 worth of Hoobastank in it!")
		rafiQuotes.append("*DICKPUNCH* Let's get the same girl pregnant tonight!")
		rafiQuotes.append("I don't know where you're gonna go! You might be finger blastin' somebody!")
		rafiQuotes.append("I think your face is gross, I think your boobs are different sizes, and I think *points to crotch* this is way too big!")
		rafiQuotes.append("I mean, you're such a good kisser, you got my dick hard, and I'm your brother.")
		rafiQuotes.append("Crotch-beer? Don't mind if I do!")
		rafiQuotes.append("We're also gonna sell your dick for gasoline.")
		rafiQuotes.append("Remember, his weak spot is his dick!")
		rafiQuotes.append("I roofied like 40% of the drinks here. It's a numbers game.")
		rafiQuotes.append("Spoiler Alert! Guess what the landlord is gonna find when he unclogs the toilet?? Haha... His fucking cat!")<commit_msg>Changing the way history works 	Only showing messages with body text 	Sending history in a PM 	Changing the syntax to 'hist ma'<commit_after># -*- coding: utf8 -*- 
from ircBase import *
from random import randint
import sys

#Check if a message is requesting room history
def getHistoryQuery(aMessage):
	expression = re.compile('(history|hist) (me|ma)(.*)', re.IGNORECASE)
	match = expression.match(aMessage.body)
	return match

def main(irc):
	message = irc.lastMessage()
	historyRequest = getHistoryQuery(message) if message.body != None else None

	#Quit when told to
	if message.botCommand == 'quit':
		ircMessage().newRoomMessage(irc, 'Later fags').send()
		ircMessage().newServerMessage(irc, 'QUIT').send()
		sys.exit()
	#Quit with update message
	elif message.botCommand == 'update':
		ircMessage().newRoomMessage(irc, 'Brb, updating').send()
		ircMessage().newServerMessage(irc, 'QUIT').send()
		sys.exit()
	#Print the last 10 room messages
	elif historyRequest:
		#Determine how many messages to show
		historyDepth = 10 if len(irc.messageLog) > 11 else len(irc.messageLog) - 1
		if historyRequest.group(3):
			try:
				historyDepth = int(historyRequest.group(3)) if int(historyRequest.group(3)) < len(irc.messageLog) else len(irc.messageLog) - 1
			except:
				return

		#Determine which messages the user wants to see
		historyCount = 0
		historyMessages = []
		for logMessage in reversed(irc.messageLog[:-1]):
			if logMessage.body != None:
				historyMessages.append(logMessage)
				historyCount += 1
			if historyCount >= historyDepth:
				break

		#PM the requested message history
		for historyMessage in reversed(historyMessages):
			sendingMessageBody = '{0}: {1}'.format(historyMessage.sendingNick, historyMessage.body)
			ircMessage().newPrivateMessage(irc, sendingMessageBody, message.sendingNick, offRecord = True).send()
	#Print Rafi's GitHub if someone mentions it
	elif message.containsKeywords(['git', irc.nick]):
		ircMessage().newRoomMessage(irc, 'My source is at https://github.com/Mov1s/RafiBot.git').send()
	#Print random Rafi quotes whenever rafi is mentioned
	elif message.containsKeyword(irc.nick) and not message.isBotCommand:
		rafiQuotes = []
		rafiQuotes.append("I'm literally gonna sodomize you. I'm gonna have non consensual sex with your face and butt and then I'm going for your wife and children... Just kidding.")
		rafiQuotes.append("JUKEBOX! I'm gonna put $7 worth of Hoobastank in it!")
		rafiQuotes.append("*DICKPUNCH* Let's get the same girl pregnant tonight!")
		rafiQuotes.append("I don't know where you're gonna go! You might be finger blastin' somebody!")
		rafiQuotes.append("I think your face is gross, I think your boobs are different sizes, and I think *points to crotch* this is way too big!")
		rafiQuotes.append("I mean, you're such a good kisser, you got my dick hard, and I'm your brother.")
		rafiQuotes.append("Crotch-beer? Don't mind if I do!")
		rafiQuotes.append("We're also gonna sell your dick for gasoline.")
		rafiQuotes.append("Remember, his weak spot is his dick!")
		rafiQuotes.append("I roofied like 40% of the drinks here. It's a numbers game.")
		rafiQuotes.append("Spoiler Alert! Guess what the landlord is gonna find when he unclogs the toilet?? Haha... His fucking cat!")
{'fraction_non_alphanumeric': 0.115733607259031, 'fraction_numerical': 0.00701934600239685, 'mean_word_length': 4.688412852969815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 6, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6775839', 'n_tokens_mistral': 2028, 'n_tokens_neox': 1807, 'n_words': 631}