Created
May 1, 2017 16:59
-
-
Save XVicarious/dbc91c8cc2c8e1ed9083842c4d0381db to your computer and use it in GitHub Desktop.
IrmageBoard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__module_name__ = "IrmageBoard" | |
__module_version__ = "0.5.5" | |
__module_description__ = "Liek a real imageboard guies (without the images!!!1)" | |
tinyVersion = 55 | |
import xchat, string, re, random, yaml | |
from urllib2 import urlopen | |
ymlFilter = urlopen("http://xvicario.us/irmageboard/filters.yml") | |
myFilter = yaml.load(ymlFilter) | |
ymlFilter.close() | |
print "\0034>>>>>",__module_name__, __module_version__, "has been loaded <<<<<\003" | |
def greenText(word, word_eol, userdata): | |
if word_eol[0].find('>'): | |
return xchat.EAT_NONE | |
else: | |
xchat.command(" ".join(["msg", xchat.get_info("channel"), ''.join(["3",word_eol[0]])])) | |
return xchat.EAT_ALL | |
def filters(word, word_eol, userdata): | |
newString = word_eol[0] | |
for k, v in myFilter.iteritems(): | |
tempColor = random.randrange(0,16,1) | |
tempBack = random.randrange(0,16,1) | |
while (tempColor == tempBack): | |
tempColor = random.randrange(0,16,1) | |
tempBack = random.randrange(0,16,1) | |
tempReplace = re.compile(k, re.IGNORECASE) | |
newString = tempReplace.sub("".join(["\003", str(tempColor), ",", str(tempBack), v, "\003"]), newString) | |
xchat.command(" ".join(["msg", xchat.get_info("channel"), newString])) | |
return xchat.EAT_ALL | |
def irmageCommand(word, word_eol, userdata): | |
try: | |
if word[1] == "filters": | |
if word[2] == "on": | |
filterHook = xchat.hook_command("", filters) | |
print "\0034Filters are now on! GO AT IT!\003" | |
if word[2] == "off": | |
xchat.unhook(filterHook) | |
print "\0034You turned filters off :(\003" | |
if word[1] == "log": | |
log = urlopen("http://xvicario.us/irmageboard/log.txt") | |
print log.read() | |
log.close() | |
if word[1] == "about": | |
print __module_name__," v",__module_version__,"\nWritten by Brian J Maurer (XVicario.us, contact at bmaurer42@xvicario.us)\nThis plugin adds features to XChat like an imageboard's \"\0033>greentext\003\" and filters (like when you type \"jew\" it turns into \"\0035,3Steve Jobs\003\". Many more features are to come :D" | |
if word[1] == "update": | |
if word[2] == "filter": | |
print "\0034Updating Filters...\003" | |
global ymlFilter | |
ymlFilter = urlopen("http://xvicario.us/irmageboard/filters.yml") | |
global myFilter | |
myFilter = yaml.load(ymlFilter) | |
ymlFilter.close() | |
print "\0034Filters are Updated!\003" | |
""" | |
if word[2] == "script": | |
myversion = urlopen("http://xvicario.us/irmageboard/version") | |
myversion = int(myversion.read()) | |
if (myversion == tinyVersion): | |
print "\0034NO UPDATE FOUND!\003" | |
elif (myversion > tinyVersion): | |
print "\0034UPDATE FOUND!\003" | |
print "\0034Downloading Update...\003" | |
update = urlopen("http://xvicario.us/irmageboard/update") | |
update = update.read() | |
irmageBoard = open("IrmageBoard.py","w") | |
irmageBoard.write(update) | |
irmageBoard.close() | |
print "\0034Update Successful!\003" | |
else: | |
print "\0034ARE YOU FROM THE FUTURE!?\003" | |
""" | |
except IndexError: | |
print "\0034Welcome to the IrmageBoard Plugin! For a brief help type '/help irmage'.\003" | |
return xchat.EAT_ALL | |
def facepalm(word, word_eol, userdata): | |
xchat.command("ME facepalms at " + word_eol[1]) | |
xchat.EAT_ALL | |
# Hook the commands :D | |
xchat.hook_command("IRMAGE", irmageCommand, help="Usage:\n/irmage filters <on/off> -- Turn the filters on or off\n/irmage log -- Display the changelog of the plugin (downloaded from XVicario.us)\n/irmage about -- Display an about text\n/irmage update filter -- update the list of word filters, when you load the script you will automatically have this, but if something changes when the script is loaded, just run this and you have the new filtes ;D") | |
xchat.hook_command("", filters) | |
xchat.hook_command("", greenText) | |
xchat.hook_command("facepalm",facepalm) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment