Spag-o-tron

From Cramulus

<HTML>
<HEAD>
<LINK rel="stylesheet" href="hys.css" type="text/css">
<TITLE>Moronic HYS Babble Generator</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
</HEAD>

<SCRIPT language="Javascript">

var opening1 = new Array(
	"This is just typical",
	"Oh here we go again",
	"this post will probably be deleted. ",
	"I think we all know whats going on here. ",
	"I read about this in the Daily Mail",
	"Typical Neocon arrogance",
	"Oh god not this again.",
	"Mark my words.",
	"I can't believe where this country is headed.",
	"Gordon brown still it at i see",
	"No!!..",
	"Stupid question",
	"Is this what Fox's budget gets spent on??",
	"Unbelievable, media left-leaning bias again.",
	"This just shows us Fox's real agenda.",
	"Whites being descriminated against again.",
	"Oh look",
	"I am very angry about this.",
	"publish this if you dare",
	"Lies damn lies and stistics!",
	"FYI",
	"First things first",
	"This tired old question again",
	"Typical FOX..",
	"I don't believe the responses on here..",
	"Aw",
	"It makes me sick",
	"Sad but true",
	"Its simple",
	"Another example of conservitard pack mentality!",
	"Question",
	"Let's see now",
	"Hear me out",
	"Typical",
	"It's sad but true",
	"global warming, climate change, no such thing, its just another TAX on the way.",
	"I hate to say it"
);

var opening2 = new Array(
	"I heard this week that",
	"I read that",
	"studies show that",
	"did you know that",
	"I couldn't care less but ",
	"its the ethnic minorities, gays and lesbians complaining again.",
	"when will people realise that",
	"IMO",
	"in my opinion",
	"does anyone realise that",
	"Open your eyes people!",
	"I'm not being racist but",
	"here come the pc brigade and the nanny state! ",
	"it's obvious that",
	"everyone knows",
	"the media won't admit that",
	"all right-thinking people know that",
	"it's not politically correct to say so but",
	"can't you see that",
	"the new york times pretends it's not true but",
	"I have been realising over the past few years that",
	"I read in the Times that"
);

var hated_object = new Array(
	"im sick of the bleeding heart lefty whiners who are",
	"This country is overflowing with illegal immigrants, even the local precinct is run by poles. They are",
	"pedophiles are",
	"paedos are",
	"Bush is",
	"Obama is",
	"Clinton is",
	"McCain is",
	"immigrants are",
	"neocons are",
	"black people are",
	"liberals are",
	"tree hugging hippies are",
	"tourists are",
	"Ron Paul is",
	"Hillary Clinton is",
	"the American sheeple are",
	"modern america is",
	"the PC Nazis are",
	"the nanny state is",
	"the establishment is",
	"enviro-marxist do-gooders are",
	"do gooders are",
	"dirty rotten spags are",
	"the catholic church is",
	"Iran is",
	"Iraq is",
	"the UN is",
	"scientists are",
	"zionists are",
	"communist facists are",
	"the USA is",
	"New York Intellectuals are",
	"Venture Capitalists are",
	"pathetic liberal tree huggers are",
	"liberals are",
	"the human rights brigade are",
	"the dittoheads are",
	"the permissive society is",
	"eco nazis are",
	"mexicans are",
	"the Lib Dems are",
	"liberal hand-wringers are",
	"The USA will soon be",
	"EnviroMENTALists are",
	"the Loony Left is",
	"kids these days are",
	"non-christians are",
	"Muslims are",
	"pc liberalists are",
	"Arabs are",
	"the Mexicans are",
	"the tax-man is",
	"criminals are",
	"namby pamby environmentalists are",
	"the disrespectful youth of today is",
	"prison inmates are",
	"drug scum are",
	"sandal-wearing liberals are",
	"the bastions of political correctness are",
	"Dick Cheney is",
	"those morons in the government are",
	"every single prisoner in the United States is",
	"so-called celebrities are",
	"the French are",
	"all parties except the GOP are",
	"Homosexuals are",
	"las vegas gangs are",
	"women are",
	"single mothers are",
	"kids today are",
	"the Mid East is",
	"The Gaza Strip is",
	"Times readers are",
	"Daily Mail readers are",
	"non-taxpayers are",
	"pathetic liberal institutions are",
	"criminal gangs are",
	"terrorists are",
	"we are being brainwashed into",
	"congressional scum are",
	"islamofacists are",
	"soft-touch America is",
	"welfare mothers are"
);

var terrible_thing = new Array(
	"bending over backwards for the ethnic minorities in a white country",
	"taking over the government",
	"miseducating our kids",
	"moaning about \"human rights\" again",
	"killing our kids",
	"going to put us all in Death Camps",
	"putting flouride in our drinking water",
  "lecturing us about our \"rights\"",
	"destroying our once great country",
	"getting tax-payers money",
	"dumbing us down",
	"being run by communists",
	"promoting drug culture",
	"trying to 'save the world' again",
	"sponging off the taxpayer",
	"allowing us to be swamped",
	"telling us what to do",
	"sexualizing our children",
	"selling us short",
	"raising gas prices",
	"denying our freedoms",
	"introducing more stealth taxes",
	"opening our borders",
	"overrunning the real americans",
	"ruining A",
	"helping their scottish comrades",
	"playing the race card",
	"peddling their lies",
	"getting rich off the hard working population",
	"selling America to the Chinese",
	"meddling in our lives",
	"trying to tax us again",
	"hugging hoodies",
	"always complaining",
	"getting away with murder",
	"running scared",
	"too pussy",
	"terrorising our streets",
	"trying to control our lives",
	"encouraging terrorists",
	"helping al-qaeda",
	"preaching hate",
	"building mosks on every corner",
	"banning religion",
	"making it illegal to be patriotic",
	"recruiting criminals into the police force",
	"creating muslim no-go areas",
	"islamifying america",
	"using kid-gloves",
	"interfering in our lives again",
	"betraying our freedoms",
	"giving preference to asylum seekers",
	"using history to criticise the pope",
	"inviting in paedophiles and AIDs",
	"pandering to ethnics and gays",
	"getting away with murder",
	"getting away scott free",
	"giving way to multiculturalism",
	"preaching hate",
	"promoting bad values",
	"promoting liberal elitism",
	"welcoming criminals with open arms",
	"promoting teenage pregnancy",
	"making our streets unsafe",
	"turning america into americastan",
	"turning prison into a holidaycamp",
	"pandering to minorities",
	"selling us down the river",
	"just helping their cronies",
	"lining their pockets",
	"ignoring the silent majority",
	"giving priority to immigrants",
	"too 'softly softly'",
	"taxing us",
	"giving away are rights to health tourists",
	"making England a Muslim State",
	"getting freebies",
	"stealing my cartax",
	"islamifying the countryside",
	"using my wheelie bin",
	"giving money to their cronies",
	"trying to kill us all",
	"selling us out",
	"trying to bring in legislation to allow gays to get married",
	"destroying our heritage",
	"turning our kids gay",
	"taking our country away from us"
);

var because = new Array (
	"they hate the American people",
	"it's politically correct",
	"the country is full.",
	"they are foreign and it's what they do",
	"they have been incompetent since day 1",
	"of terrorists",
	"they are barely human",
	"of neocon incompetence",
	"of their so-called 'human rights'",
	"they've allowed terrorism to go unchecked.",
	"they want to turn america into an islamic state.",
	"they want to destroy us from within!",
	"our culture has been emasculated",
	"our country is full already",
	"they are pandering to foreign interests",
	"they are trying to destroy us",
	"the EU now controls this country",
	"they are building an EU superstate",
	"they have given away our sovriegnty",
	"they are trying to cover up their mistakes",
	"this country is no longer ours",
	"america is no longer great",
	"they government is lying to us",
	"they are socialists",
	"they are anti-american",
	"they are communists in disguise",
	"they hate our freedoms",
	"Gordon is too busy lining his pockets",
	"of Gordon Brown",
	"they're ruining america",
	"I am now ashamed of america",
	"the newspeak mafia is running the country",
	"muslims are running the show",
	"america is now under sharia law",
	"they want to breed a hybrid fetus",
	"they want to destroy the world",
	"they are clinically insane",
	"nobody has the guts to stand up to them",
	"people are too scared to stop them",
	"they are sick",
	"they are traitors"
);

var imperative = new Array(
	"We must",
	"Every American working man must",
	"It is vital that we",
	"Read my lips: ",
	"Come on",
	"True patriots must",
	"All Christians should",
	"Time to act: ",
	"The silent majority must ",
	"End this madness now, ",
	"Soon we will",
	"Somebody should",
	"The only solution is to",
	"Isn't it obvious?",
	"A wise man once said",
	"Mark my words",
	"It's time we",
	"when will Bush",
	"when will this government",
	"Wake up people!",
	"Simple answer: ",
	"All true americans should",
	"[number] words:"
);

var moronic_solution = new Array(
	"chop their hand's off, see how they like it",
	"bring back flogging and the death penalty i say",
	"clip their greencard, thatll teach em",
	"Send them all back were they came from",
	"get out of the USA and let us have our country back!!",
	"build more prisons, lock em up and throw away the key",
	"bring back the death penalty",
	"send them packing",
	"bring back McCarthy",
	"bring back the War on Drugs
	"send them to Iraq",
	"bring back Hitler",
	"bring back JFK",
	"bring back Bubba Clinton",
	"bring back gas tax",
	"string them all up",
	"abolish tax",
	"burn them alive",
	"get rid of them",
	"put them in solitary for the next 100 years",
	"run them out of the country",
	"sterolise them all",
	"get tough",
	"send them back where they came from",
	"riot in the streets",
	"rise up against them",
	"smash the system",
	"BAN immoral TV",
	"vote mccain",
	"go round their houses with a pair of pliers and a can of petrol",
	"let Newt sort it out",
	"call in the army now",
	"shoot on sight",
	"lock our kids away to save them",
	"shut up and obey orders, says the government",
	"round them all up and lock them away",
	"close the borders now",
	"elect Kilroy now",
	"make sure there are consequences",
	"have two strikes and you're out",
	"introduce zero tolerance",
	"promote marriage",
	"make sure everyone knows",
	"say enough is enough",
	"stand up and be counted",
	"ban them all",
	"have another war",
	"elect Ron Paul as vice president",
	"speak English",
	"impreach bush",
	"stop taking it lying down",
	"use napalm",
	"put them in loony bin",
	"leave the country.",
	"carpet bomb them flat",
	"put them in a rocket and fire them in to the sun",
	"nuke them"
);

var signoff = new Array(
	"Next we'll have pedophiles teaching our kids to swim",
	"No doubt this is legal under the human rights act",
	"No doubt this is illegal under the eu human rights act",
	"Soon this country will be majority muslim with a mosk in every village!!!",
	"This is a Christian country we must all have christian values",
	"If you like it so much why dont you go live there",
	"Time to get neocons OUT!!!!",
	"Im voting Ron Paul in the next election, its the sensible choice",
	"It could only get worse if the mexicans start teaching our kids!!!",
	"never did me any harm",
	"Pathetic",
	"Simple",
	"Its disgusting",
	"Disgraceful",
	"It's all Cheney's fault",
	"LOL",
	"Sad but true",
	"GOP for America",
	"We need another war",
	"PS If you are offended by this then leave the country",
	"You couldn’t make it up",
	"IT IS HELL ON EARTH, PEOPLE!",
	"WHAT A SHAME!",
	"Its like a nightmare but real",
	"This sounds totally crazy, but it is sadly, probably true",
	"What ever happened to putting UK first?",
	"America is going to the dogs",
	"Reagan was murdered",
	"This is why I'm emigrating soon",
	"Best thing for them",
	"I’d leave if I had my own country to go back to",
	"It's that simple",
	"It's not rocket science",
	"America for Americans",
	"The last to leave, please turn out the light",
	"Shame on you media",
	"Cry ‘In God We Trust’",
	"AMERICA FIRST",
	"Need I say more",
	"If you disagree SHUT UP",
	"Is it a tune too familiar from our media?",
	"We need less emotion and more backbone in this country",
	"Next question.",
	"What about OUR rights?",
	"What a mess",
	"These are worrying times",
	"This is very disturbing to me",
	"Wake up, people",
	"Lies! Lies! Lies!",
	"This is probably the best solution all around",
	"Common sense AT LAST!",
	"Nothing will ever change",
	"This is communism folks!",
	"Honestly this country !",
	"Sick to the back teeth",
	"We are all being had here",
	"That would certainly cause a bit more care to be taken",
	"This morning at breakfast my son leaned over to me and in a hushed voice said \"Dad, we are still in America, aren’t we?\" No son, I said. Not any more",
	"I am furious about this",
	"This is a perfect idea",
	"It's political correctness gone mad",
	"Oh wait, but what about their 'human rights'",
	"What about my right not to be murdered?",
	"What about my right not to be killed every day?",
	"Oh wait, that would be too sensible",
	"Oh wait, that wouldn't be 'PC' enough",
	"This is never mentioned by the media",
	"what's it going to be - only you can choose",
	"Simple as",
	"Put that in your pipe and smoke it",
	"This worries me",
	"Next",
	"Next stop HELL ON EARTH",
	"Are you listening? Off course not",
	"Hell in a handbaskett",
	"What a load of rot",
	"Next stop CHAOS",
	"Next stop WAR",
	"You heard it here first",
	"What would Lennon say?",
	"It's time to revolt people",
	"WHos fault is that?",
	"Lets do what the french do and all strike",
	"Mrs Thatcher must be spinning in her grave",
	"What next? Encourage single-parenting? Oops. They do it already",
	"What next? Shitting on the Constitution? Oops. They do it already",
	"What next? Imprisoning innocents? Oops. They do it already",
	"What next? Banning Religion? Oops. They do it already",
	"What next? A Muslim in the White house?",
	"What next? Giving benefits out to criminals? Oops. They do it already",
	"What happened to America?",
	"No joke",
	"FACT!",
	"What a tragedy",
	"This is Communism folks...",
	"This is america... Lets show it...",
	"Publish this one if you dare",
	"What do you think?",
	"I am now repudiating liberalism as I see it as deeply harmful to society",
	"This is just the first of many FACTS that the woolly-left have been ignoring for many years now",
	"It is only a matter of time before race riots spill blood on our streets",
	"Why did nobody listen to McCarthy all those years ago?",
	":)",
	"Will sex with animals be legal next?",
	"Will sex with children be legal next?"
);

var end_punctuation = new Array(
	".",
	"!",
	"!!",
	"!!!",
	"!!!",
	"!!!!!",
	"!?!",
	"!??"
)

var author = new Array(
	"Neocon MUST GO",
	"Liberal_lefty_bias",
	"Common sence",
	"going_to_the_dogs",
	"[Its_an_Outrage]",
	"My country is being betrayed",
	"Whydo Webother",
	"Totally Disgruntled",
	"UK stinks",
	"DISGUSTED",
	"Captain Sensible",	
	"British Bulldog",	
	"cyclops",	
	"What_happened_to_my_country",
	"BNP for UK",
	"Smart_Guy",
	"Voice of Reason",
	"[Storm_Saxon]",
	"Mad as hell at PC Goons",
	"Sick of Labour",
	"[Saint George]",
	"[True Patriot]",
	"Lord Nelson",
	"ShutupFrance",
	"EU_bunglers_are_ruining_UK",
	"Immigrants Out Of England",
	"Mr angry",
	"Libby Lefty Nutcase",
	"Decent Chap",
	"Appalled_UK",
	"Zionist Elite Run UKKK",
	"English and Proud",
	"Tired Of PC loonies",
	"Sensible Bloke",
	"ex-Squaddie",
	"Shameful_UK",
	"Beer Drinker",	
	"BNP_RULES",
	"English_forever",
	"Winston Churchill",
	"SonOfChurchill",
	"Working Class Tax Payer",
	"Tony Bliar",
	"[UnionJackForever]",
	"Gordon Clown Out Now",
	"Persecuted_in_his_own_country",
	"[Handsome Bloke]",
	"Fighting for My Rights",
	"[Lionheart111]",
	"True_Brit"
);

var authorloc = new Array(
	"Memphis",
	"Blighty",
	"America",
	"AMERICAN AND PROUD",
	"timbuktu",
	"WASHINGTON",
	"America for Americans",
	"The Real World",
	"Big Brother Government",
	"In the Know",
);


var a = Math.floor(Math.random()*opening1.length);
var b = Math.floor(Math.random()*opening2.length);
var c = Math.floor(Math.random()*hated_object.length);
var d = Math.floor(Math.random()*terrible_thing.length);
var e = Math.floor(Math.random()*because.length);
var f = Math.floor(Math.random()*imperative.length);
var g = Math.floor(Math.random()*moronic_solution.length);
var h = Math.floor(Math.random()*signoff.length);
var i = Math.floor(Math.random()*end_punctuation.length);
var author_random = Math.floor(Math.random()*author.length);
var authorloc_random = Math.floor(Math.random()*authorloc.length);

var punc = get_punctuation();

function randomiseit() {
	a = Math.floor(Math.random()*opening1.length);
	b = Math.floor(Math.random()*opening2.length);
	c = Math.floor(Math.random()*hated_object.length);
	d = Math.floor(Math.random()*terrible_thing.length);
	e = Math.floor(Math.random()*because.length);
	f = Math.floor(Math.random()*imperative.length);
	g = Math.floor(Math.random()*moronic_solution.length);
	h = Math.floor(Math.random()*signoff.length);
	i = Math.floor(Math.random()*end_punctuation.length);
	author_random = Math.floor(Math.random()*author.length);
	authorloc_random = Math.floor(Math.random()*authorloc.length);

	punc = get_punctuation();
}

function randtext() {

	var mystring = opening2[b] + " " + hated_object[c] + " " + terrible_thing[d];

	if (Math.random()>.5) {
		mystring +=	" because " + because[e];
	}
	mystring +=	 punc + imperative[f] + " " +  moronic_solution[g] + punc;

	mystring=mystring.replace(/\[number\]/, count_words(moronic_solution[g]));
		
	if (Math.random()>.2) {
		mystring += signoff[h] + end_punctuation[i];
	}
	
	if (Math.random()>.3) {
		mystring = opening1[a] + punc + mystring;
	}
	else {
		mystring = mystring.substring(0,1).toUpperCase() + mystring.substring(1,mystring.length);
	}
	
	//Moronicise - The following code messes up the spelling and punctuation

	if (Math.random()>.4) {
		//Remove all commas and apostrophes
		mystring=mystring.replace(/\,/, "");
		mystring=mystring.replace(/\'/, "");
	}
	
	if (Math.random()>.6) {
	//All periods become exclamation marks
	mystring=mystring.replace(/\./, "!");
	}
	
	if (Math.random()>.85) {
		//Lowercase everything
		mystring=mystring.toLowerCase();
	}
	
	if (Math.random()>.85) {
		//Remove all punctuation
		mystring=mystring.replace(/\,/g, " ");
		mystring=mystring.replace(/\'/g, " ");
		mystring=mystring.replace(/\./g, " ");
		mystring=mystring.replace(/\!/g, " ");
		mystring=mystring.replace(/\?/g, " ");
		//And lowercase everything
		mystring=mystring.toLowerCase();
	}
	
	if (Math.random()>.8) {
		//Capitalise everything
		mystring=mystring.toUpperCase();
	}

	//Delete random letters
	var letters_to_lose=Math.random();
	letters_to_lose=Math.pow(letters_to_lose,2.6);
	letters_to_lose=Math.round(letters_to_lose*4-.5);
	var j;
	for (j=0;j<letters_to_lose;j++) {
		var random_letter = Math.round(Math.random()*mystring.length-.5);
		mystring=mystring.substring(0,random_letter)+mystring.substring(random_letter+1)
	}
	
	//Transpose random letters
	var letters_to_lose=Math.random();
	letters_to_lose=Math.pow(letters_to_lose,2.57);
	letters_to_lose=Math.round(letters_to_lose*4-.5);
	var j;
	for (j=0;j<letters_to_lose;j++) {
		var random_letter = " ";
		while (random_letter == " ") {
			random_letter = Math.round(Math.random()*(mystring.length-3)-.5+2);
		}
		mystring=mystring.substring(0,random_letter-1)+mystring.substring(random_letter,random_letter+1)+
		mystring.substring(random_letter-1,random_letter)+mystring.substring(random_letter+1);
	}
	
	return (mystring);
}


function rand_author() {
	return author[author_random];
}

function rand_loc() {
	return authorloc[authorloc_random];
}

//Gets the current date
function current_date() {
	var currentTime = new Date();
	var month = currentTime.getMonth();
	var day_of_week = currentTime.getDay();
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	var hour = currentTime.getHours();
	var minute = currentTime.getMinutes();
	var day_list = new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")
	var month_list = new Array("January","February","March","April","May","June","July","August","September","October","November","December") 
	document.write("Added: " + day_list[day_of_week-1] + ", " + day + " " + month_list[month] + ", " + year + ", " + hour + ":" + minute + " GMT");
}

//Function to count the words for when the HYS uses [number] words as in "Three words: string them up". It always counts the number of words wrongly.
function count_words(n) {
	var x = n.split(" ").length
	x += Math.pow(-1,Math.round(Math.random()*2-.5))
	if (x<2) {x+=2}
	var number_list = new Array("zero","one","two","three","four","five","six",
		"seven","eight","nine","ten","eleven","twelve","thirteen","fourteen")
	if (x>=number_list.length) {
		return x
	}
	else {
		return number_list[x].substring(0,1).toUpperCase() + number_list[x].substring(1,number_list[x].length)
	}
}


function get_punctuation() {
		var r = Math.random()*20;

		if(r < 15)
			return ". ";

		if(r < 17)
			return ", ";

		if(r < 19)
			return "... ";
			
		return ",,, ";
}

function new_turd() {
	randomiseit();
	document.getElementById('commentbody').innerHTML = randtext();
	document.getElementById('commentauthor').innerHTML = rand_author();
	document.getElementById('commentrecommend').innerHTML = Math.floor(Math.random()*300);
	document.getElementById('commentloc').innerHTML = rand_loc();
	
}

//</SCRIPT>

<body style="background-color: transparent">

<table width="420">
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td valign="top">
<img src="bubble.gif" alt="bubble" />
</td>
<td>

<div class="grey">

<SCRIPT>
current_date();
</SCRIPT>

</div>
<br />

<div class="text" id="commentbody">

<SCRIPT>document.write(randtext());</SCRIPT>
<NOSCRIPT>You must have Javascript enabled</NOSCRIPT>

</div>
<br />

<span class="author" id="commentauthor"><SCRIPT>document.write(rand_author());</SCRIPT></span>
<span class="text" id="commentloc"><SCRIPT>document.write(rand_loc());</SCRIPT></span>

<div>
<table width="100%" border="0">
<tr>
<td colspan="2" class="grey">
 
</td>
</tr>
<td colspan="2" class="grey">
Recommended by <span class="recommend" id="commentrecommend"><SCRIPT>document.write(Math.floor(Math.random()*300));</SCRIPT></span> people
</td>
</tr>
<tr>
<td class="grey">
 
</td>
</tr>
<tr>
<td class="grey">
Sign in to recommend comments
</td>
<td class="grey" align="right">
Alert a Moderator
</td>
</tr>
</table>
</div>

</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
</table>
<input type="button" name="New" value="New" onClick="new_turd();">

<!-- Copyright 2008 Chris + Ed - c.o ifyoulikeitsomuchwhydontyougolivethere.com -->
</BODY>
</HTML>




Zipplebot

#! /usr/bin/env python
 
import sys
import socket
from time import time, strftime
from random import shuffle, randint, choice
from heapq import heappush, heappop, heapify
 
print '              ZIPPLEBOT'
print '              ---------------'
 
HOST = 'irc.maddshark.com' # 'irc.krey.net'
PORT = 6667
NICK = 'Zipplebot'
IDENT = 'Zip'
REALNAME = 'Zipplebot Dutchcode'
CHANNEL = '#discord'
 
DEBUG = len(sys.argv) > 1 and sys.argv[1] == 'DEBUG'
 
def timestamp():
    return strftime('[%d/%m,%H:%M]')
 
talk_queue = []
def say(text, delay=0, recipient=False):
    heappush(talk_queue, (time() + delay, recipient or CHANNEL, text))
 
s = socket.socket()
s.settimeout(1.0)
s.connect((HOST, PORT))
 
readbuffer = ''
running = True
logged_on = False
in_channel = False
 
print '%s ---- connecting to %s as %s' % (timestamp(), HOST, NICK)
s.send('NICK %s\r\n' % NICK)
s.send('USER %s %s Blah :%s\r\n' % (IDENT, HOST, REALNAME))
 
while running:
    try:
        readbuffer += s.recv(1024)
    except socket.timeout:
        readbuffer = ''
        
    temp = readbuffer.split('\n')
    readbuffer = temp.pop()
 
    for line in temp:
        line = line.rstrip()
        line = line.split()
        
        if line[0].startswith(':'):
            prefix = line.pop(0)
            
        command = line.pop(0)
        params = line        
        
        if DEBUG:
            print '%s {%s} %s %s' % (timestamp(), prefix, command, params)
 
        if command == 'PING':
            if DEBUG:
                print '%s ---> PONG' % timestamp()
            s.send('PONG %s\r\n' % params[0])
            
        elif command == '001': # i suppose this is the welcome message
            print '%s -- connected.' % timestamp()
            logged_on = True
            print '%s -- joining channel %s.' % (timestamp(), CHANNEL)
            s.send('JOIN %s\r\n' % CHANNEL)
            
        elif command == '353' and params[2] == CHANNEL: #RPL_NAMREPLY
            print '%s -- joined channel %s.' % (timestamp(), CHANNEL)
            in_channel = True
 
            say('Hello I am %s. I will not kill you.' % NICK.title());
            say('Cold in here, isn\'t it?', delay=20)
            
        elif command == 'PRIVMSG' and params[0] == CHANNEL:
            # react to chatter here
            text = ' '.join(params[1:])[1:]
            print '%s %s' % (timestamp(), text)
 
            if text.lower().startswith(NICK.lower()):
                # trying to get my attention
                text = text[len(NICK):].lstrip(':, .>?!-')
                if text.lower().startswith('define'):
                    # i'm asked to define something
                    say(choice(['Fuck off.', 'Google is your friend. I\'M NOT.', 'STFU', 'Do I look like a fucking encyclopedia to you?', \
                                'LALALALALALA I CAN\'T HEAR YOU!!!!! ... (fucker)', 'Do it yourself, moron.', 'NO, I WILL NOT. Now fuck off.']))
                elif ' or ' in text and text.endswith('?'):
                    # "this or that or this" question is asked
                    options = text.rstrip('?').split(' or ')
                    shuffle(options)
                    if options:
                        say(options.pop().title() + '.')
                    if options and randint(1, 8) == 1:
                        say('No wait I changed my mind, it\'s %s.' % options.pop().lower(), randint(5, 20))
                    if options and randint(1, 15) == 1:
                        say('... wait wait wait I really meant to say %s, srsly.' % options.pop().lower(), randint(20, 60))
                    
    if talk_queue and in_channel and logged_on:
        # manage talking queue
        (when, who, what) = talk_queue[0]
        if time() >= when:
            heappop(talk_queue)
            s.send('PRIVMSG %s :%s\r\n' % (who, what))
Personal tools
Toolbox
LANGUAGES