Paste number 41117: Windoze

Paste number 41117: Windoze
Pasted by: Sephiroth
When:2 years, 1 month ago
Share:Tweet this! | http://paste.lisp.org/+VQ5
Channel:None
Paste contents:
Raw Source | XML | Display As
# Windoze by Sephiroth <http://www.sephiroth.ws>
# Windoze Script by TheMasterSwordsman <http://www.triforcetour.com>
# Windoze Script debugged and fixed by Sephiroth.

__module_name__ = "Windoze"
__module_version__ = "1.0"
__module_description__ = "Kick someone out the window!"

import xchat, re, os, pickle, random

messages = ['You have been kicked out the window and you landed on a buisinessman! Is that your dad?', 'You have been kicked out the window and you landed on a sword!', 'You have been kicked out the window and you landed on TMSModBot!', 'You have been kicked out the window and you landed on my foot! Here comes another kick out the window!', 'You have been kicked out the window and you landed on Animus01! Uh oh, this could get ugly.', 'You have been kicked out the window and you landed on a potato! Let me get WildBill.', 'You have been kicked out the window and you landed in a toilet!', 'You have been kicked out the window and you landed on a piece of bacon!', 'You have been kicked out the window and you landed on this script!', 'You have been kicked out the window and you landed on a PS3!', 'You have been kicked out the window and you landed on an XBox 360!', 'You have been kicked out the window and you landed on the TV!', 'You have been kicked out the window and you landed on Spongebob! SOAP, SOAP, WHAT IS SOAP!?', 'You have been kicked out the window and you landed on a Mii!', 'You have been kicked out the window and you landed on a keyboard!', 'You have been kicked out the window and you landed on an asdf!', 'You have been kicked out the window and you landed in the ocean! Do I hear Jaws music?', 'You have been kicked out the window and you landed on a power line! Zap!', 'You have been kicked out the window and you landed in Super Mario 64!', 'You have been kicked out the window and you landed on Kefka! :O', 'You have been kicked out the window and you landed on Sephiroth! Oh noes...', 'You have been kicked out the window and you landed on yourself? O_o', 'You have been kicked out the window and you landed in TriforceTour! While you are there, check out the forums.','You have been kicked out the window and you landed on me! o.o', 'You have been kicked out the window and you landed on the highway!']

class windozecfg:
	config = 'windoze.cfg'
	kickcount = 1
windozecfg = windozecfg()

def windozeconfig(a):
	global windozecfg
	cfgfile = os.path.join(xchat.get_info("xchatdir"), windozecfg.config)
	if a == 0 and os.path.exists(cfgfile):
		f = open(cfgfile, "r")
		cfg = pickle.load(f)
		f.close()
		windozecfg.kickcount = cfg[0]
	elif a == 1:
		cfg = [windozecfg.kickcount]
		f = open(cfgfile, "w+")
		pickle.dump(cfg, f, 1)
		f.close()
windozeconfig(0)


def windoze(word, word_eol, userdata):
	global messages, windozecfg
	message = random.choice(messages)

	chan = xchat.get_info("channel")

	if chan is not None:
		if len(word) >= 3:
			xchat.command("me kicks "+word[1]+" out the window.")
			xchat.command("kick "+word[1]+" "+message+" ("+word_eol[2]+") (" + str(windozecfg.kickcount) + ")")
		elif len(word) == 2:
			xchat.command("me kicks "+word[1]+" out the window.")
			xchat.command("kick "+word[1]+" "+message+" (" + str(windozecfg.kickcount) + ")")
		else:
			xchat.prnt("You need to define who you are going to kick out the window!");
		windozecfg.kickcount += 1
		windozeconfig(1)
	else:
		xchat.prnt("You must be in a channel to kick someone out the window!");

	return xchat.EAT_XCHAT
 
xchat.hook_command("windoze", windoze, help="Usage: WINDOZE <user>")

#xchat.prnt("Windoze v1.0 loaded.");

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.