Support Forums
Xchat Python CurseKick - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32)
+---- Thread: Xchat Python CurseKick (/showthread.php?tid=3032)



Xchat Python CurseKick - Nyx- - 11-19-2009

I just made me first xchat script today, so go easy on me, and thanks to Fallen for helping me get this crap hehe

Usage:
/ck a swear - adds swear
/ck r swear -removes swear
/ck c - clears swear list
/ck p - prints swear list

And if you have OP (if not it will break, dont have that exception added since im always OP lol)it will set the channel +i(invite only), kick the user who swore, and 4 seconds later it will take the invite only off the channel.

Code:
import xchat

__module_name__ = "CurseKick"
__module_version__ = '1.0'
__module_description__ = "Kicks on curse"

curses = ["Yoda"]
def text(word, word_eol, userdata):
    global curses
    for curse in curses:
        if not word_eol[1].upper().find(curse) == -1:
            xchat.command("mode +i")
            xchat.command("kick " + word[0] + " None of that!")
            xchat.hook_timer(4000, i)
            return xchat.EAT_NONE
def i(userdata):
    global curses
    xchat.command("mode -i")
    return xchat.EAT_ALL
def swear(word, word_eol, userdata):
    global curses
    if word[1] == "a":
        curses.append(word[2].upper())
    elif word[1] == "r":
        try:
            curses.remove(word[2])
        except:
            xchat.command("echo Swear word not in curse list")
    elif word[1] == "c":
        curses = curses[:]
    elif word[1] == "p":
        for curse in curses:
            xchat.command("echo " + curse)
    else:
        xchat.command("echo You did not enter an option")
xchat.hook_print("Channel Message", text)
xchat.hook_command("ck", swear)



RE: Xchat Python CurseKick - Gaijin - 11-19-2009

LOL first nicley done, I needed to restart my PC to test it but I had fun with it!

I love it, almost kissed the screen :roflamo:
You don't mind if I use this script from time to time?


RE: Xchat Python CurseKick - nevets04 - 11-19-2009

(11-19-2009, 06:42 PM)Nyx- Wrote: I just made me first xchat script today, so go easy on me, and thanks to Fallen for helping me get this crap hehe

Usage:
/ck a swear - adds swear
/ck r swear -removes swear
/ck c - clears swear list
/ck p - prints swear list

And if you have OP (if not it will break, dont have that exception added since im always OP lol)it will set the channel +i(invite only), kick the user who swore, and 4 seconds later it will take the invite only off the channel.

Code:
import xchat

__module_name__ = "CurseKick"
__module_version__ = '1.0'
__module_description__ = "Kicks on curse"

curses = ["Yoda"]
def text(word, word_eol, userdata):
    global curses
    for curse in curses:
        if not word_eol[1].upper().find(curse) == -1:
            xchat.command("mode +i")
            xchat.command("kick " + word[0] + " None of that!")
            xchat.hook_timer(4000, i)
            return xchat.EAT_NONE
def i(userdata):
    global curses
    xchat.command("mode -i")
    return xchat.EAT_ALL
def swear(word, word_eol, userdata):
    global curses
    if word[1] == "a":
        curses.append(word[2].upper())
    elif word[1] == "r":
        try:
            curses.remove(word[2])
        except:
            xchat.command("echo Swear word not in curse list")
    elif word[1] == "c":
        curses = curses[:]
    elif word[1] == "p":
        for curse in curses:
            xchat.command("echo " + curse)
    else:
        xchat.command("echo You did not enter an option")
xchat.hook_print("Channel Message", text)
xchat.hook_command("ck", swear)

Good script
By the way, you sound like a pirate : "I just made me first xchat script today" Big Grin


RE: Xchat Python CurseKick - Nyx- - 11-20-2009

(11-19-2009, 10:27 PM)nevets04 Wrote: Good script
By the way, you sound like a pirate : "I just made me first xchat script today" Big Grin

yea i just copy pasted from HF and had that typo there too lol, synny said i sound like a leprechaun
(11-19-2009, 09:51 PM)Master of The Universe Wrote: LOL first nicley done, I needed to restart my PC to test it but I had fun with it!

I love it, almost kissed the screen :roflamo:
You don't mind if I use this script from time to time?

yea no problem, and if you use Xchat, I can help you with Python xchat plugins that you think might be useful, and nevets04 is also learning with me ^__^


RE: Xchat Python CurseKick - Socrates - 11-21-2009

Nice dude!!!!!


RE: Xchat Python CurseKick - Fallen - 11-22-2009

Awesome script Smile You got to love Xchat's plugin interfaces


RE: Xchat Python CurseKick - Gaijin - 11-26-2009

(11-20-2009, 12:04 PM)Nyx- Wrote: yea no problem, and if you use Xchat, I can help you with Python xchat plugins that you think might be useful, and nevets04 is also learning with me ^__^

Well I will remember that.... ;D

What do you have else.... I could need some.