Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xchat
- import re
- import random
- import unicodedata
- import httplib
- __module_name__ = "Jacob1's plugin"
- __module_version__ = "1.0"
- __module_description__ = "All my commands"
- #do not directly copy everything in this script, but you can use any part of it if you really want .....
- # Timer
- def command_timer(userdata):
- mynick = xchat.get_info("nick")
- byte_limit = 469-len(mynick) #463
- myhost = get_user(mynick, xchat.get_info("server"), "#powder")
- if not myhost: #this is written badly I know ... I know a better way to fix it but it doesn't really matter ...
- myhost = get_user(mynick, xchat.get_info("server"), "##powder-bots")
- if not myhost:
- myhost = get_user(mynick, xchat.get_info("server"), "##jacob1")
- if myhost and myhost.host:
- byte_limit = 499-len(mynick) - len(myhost.host)
- if type(userdata) is str:
- send = userdata[0:byte_limit]
- if re.match(".*moo+ $", color_strip(send)):
- send = send + "." #moo
- xchat.command(send)
- else:
- send = userdata[0][0:byte_limit]
- if re.match(".*moo+$", color_strip(send)):
- send = send + "."
- if (len(userdata) > 2):
- thechannel = xchat.find_context(server=userdata[1],channel=userdata[2])
- if thechannel:
- thechannel.command(send)
- else:
- thechannel = xchat.find_context(channel=userdata[1])
- if thechannel:
- thechannel.command(send)
- #this is the only way I can make this work
- wait_timer = [ ]
- wait_timer.append(100)
- def timer_reset(userdata):
- wait_timer[0] -= 2000
- if wait_timer[0] < 100:
- wait_timer[0] = 100
- def send(msg):
- timer = wait_timer[0]
- wait_timer[0] += 2000
- xchat.hook_timer(2000, timer_reset)
- if wait_timer[0] > 16000:
- return
- if timer < 5000:
- timer = 100
- xchat.hook_timer(timer, command_timer, msg)
- def isowner(user):
- if user and (user.host == "~jacob1@Powder/Developer/jacob1" or user.host == "[email protected]"):#or user.host == "[email protected]"):
- #print("owner")
- return True
- #print("not owner")
- return False
- trusted_hostmasks = ["~jacob1@Powder/Developer/jacob1", "~meow@Powder/Developer/cracker64", "jacksonmj@2a01:7e00::f03c:91ff:fedf:890f", "~Triclops2@Powder/Developer/Triclops200", "~Ximon@Powder/Developer/Simon", "antb@Powder/Staff/Xenocide"]
- def istrusted(user):
- if not user:
- return False
- for i in trusted_hostmasks:
- if user.host == i:
- return True
- return False
- # All the command functions
- command_list = [ ]
- def command_add(command):
- command_list.append(command)
- badwords_list = [ ]
- #badwords_list = [ "^\.$", "Stop saying that" ]
- #badwords_list = [ "yolo", "#YOLO", "nigger", "Don't be racist", "nigga", "Don't be racist", "dong", "you know why."]
- badwords_timers = []
- def command_badwordsearch(text, user, server, channel):
- if istrusted(user):
- return
- for i in text:
- word = color_strip(i.lower())
- for j in range(len(badwords_list)):
- if not j%2 and len(badwords_list[j]) > 2:
- if badwords_list[j] in word or re.match(badwords_list[j], word):
- #send([ "action kicks " + user.nick, server, channel ])
- timer = 20
- for k in badwords_timers:
- if user.host == k:
- timer += 20
- elif user.nick == k:
- timer += 20
- toban = user.nick
- if user.host:
- badwords_timers.append(user.host)
- toban = user.host
- else:
- badwords_timers.append(user.nick)
- user_kick(user.nick, server, channel, "Badwords auto ban: " + badwords_list[j+1])
- if do_ban("+b", 0, toban, server, channel) == 1:
- do_ban("-b", timer*1000, toban, server, channel)
- return
- def command_badwords(text, user, server, channel):
- if not istrusted(user):
- send("notice " + user.nick + " Error: you cannot use this command")
- return
- if channel == "##powder-bots" and text[0] == "$badwords":
- return
- if len(text) < 2:
- text.append("badwords")
- command_help(text, user, server, channel)
- return
- if text[1] == "list":
- for i in range(len(badwords_list)):
- if not i%2:
- message = badwords_list[i]
- length = len(badwords_list[i])
- if length < 20:
- for j in range(20-length):
- message = message + " "
- send(["notice " + user.nick + " " + message + " Reason: " + badwords_list[i+1], server, channel])
- elif text[1] == "remove" and len(text) > 2:
- for i in range(len(badwords_list)):
- if not i%2:
- if badwords_list[i] == text[2]:
- badwords_list.pop(i+1)
- badwords_list.pop(i)
- send(["notice " + user.nick + " " + text[2] + " was removed from the list", server, channel])
- return
- elif text[1] == "add" and len(text) > 2:
- for i in range(len(badwords_list)):
- if not i%2:
- if badwords_list[i] == text[2]:
- send(["notice " + user.nick + " " + text[2] + " is already in the list", server, channel])
- return
- badwords_list.append(text[2])
- if len(text) > 3:
- reason = ""
- for i in text[3:]:
- reason = reason + i + " "
- badwords_list.append(reason)
- else:
- badwords_list.append("Don't say " + text[2])
- send(["notice " + user.nick + " " + text[2] + " was added to the list", server, channel])
- elif text[1] == "clear":
- while badwords_list:
- badwords_list.pop()
- else:
- text[1] = "badwords"
- command_help(text, user, server, channel)
- echo_banned = ["prequels" , "yolo" , "hugelistofotherbadwordsi'mnotposting"]
- echo_regex_banned = [ "^f+a+g", "ni+g+[a|e+r]", "p[0|o]rn", "pr[0|o]n", "p[e|ae|3]+n+[i|1]+s", "^ass$", "^asshole$", "^homo$", ".*\+\+$", ".*\-\-$"]
- echo_botlist = [ "stewiegriffin", "stewiegriffinsub", "t156", "crsbot", "oytaku", "pytaku", "nucbot", "mitch|hater", "thebotmaker"]
- def command_echo(text, user, server, channel):
- echotext = ""
- stripped = False
- for i in text[1:]:
- if not stripped:# and not isowner(user):
- nocolor = color_strip(color_strip(i))
- nobot = nocolor.lstrip(";+!$@^#%'&./~?\\")
- if i != nocolor and nobot != nocolor:
- i = " " + i
- else:
- i = i.lstrip(";+!$@^#%'&./~?\\\x01") #remove bot prefixes and color codes
- for j in echo_botlist: #remove bot names, so !echo can't do commands this way either
- if j in i.lower():
- i = ""
- txt = color_strip(i.lower())
- if txt == "alot":
- i = "a lot"
- banned = False
- for j in echo_banned:
- if j in txt:
- banned = True
- if not banned:
- for j in echo_regex_banned:
- if re.match(j, txt):
- banned = True
- #if isowner(user):
- # banned = False
- if not banned and len(i) > 0:
- echotext = echotext + i + " "
- stripped = True
- #if re.match(".*mo+ $", echotext):
- # echotext = echotext.rstrip() + "."
- if len(echotext) > 0 and not "is no longer away" in echotext and not "is away:" in echotext and not "!py" in echotext and not " " in echotext and not "⃧" in echotext:
- send(["msg " + channel + " " + echotext.rstrip(), server, channel])
- def command_mod(text, user, server, channel):
- send(["msg " + channel + " " + user.nick + ": http://tpt.io/:11117", server, channel])
- def command_ban(text, user, server, channel):
- if istrusted(user):
- try:
- timer = int(text[2])
- except:
- timer = 0
- do_ban("+b", 0, text[1], server, channel)
- if timer > 0:
- send(["notice " + user.nick + " " + text[1] + " has been banned for " + str(timer) + " seconds", server, channel])
- do_ban("-b", 400+timer*1000, text[1], server, channel)
- def command_unban(text, user, server, channel):
- if istrusted(user):
- do_ban("-b", 0, text[1], server, channel)
- def command_stab(text, user, server, channel):
- if istrusted(user):
- timer = 0
- try:
- timer = int(text[2])
- except:
- timer = random.randint(60, 600)
- do_ban("+q", 0, text[1], server, channel)
- if timer > 0:
- send(["notice " + user.nick + " " + text[1] + " has been quieted for " + str(timer) + " seconds", server, channel])
- do_ban("-q", 400+timer*1000, text[1], server, channel)
- def command_unstab(text, user, server, channel):
- if istrusted(user):
- do_ban("-q", 0, text[1], server, channel)
- def command_potato(text, user, server, channel):
- if user.nick == "DrNublet":
- send(["action slaps DrNublet with a sack of potatoes", server, channel])
- else:
- send(["action is a potato", server, channel])
- def command_list2(text, user, server, channel):
- listtext = ""
- for i in command_list:
- if i[3] == "*":
- Enabled = True
- for j in i[4:]:
- if j == channel:
- Enabled = False
- if Enabled:
- if len(listtext):
- listtext += ", "
- listtext += i[0]
- else:
- for j in i[3:]:
- if j == channel:
- if len(listtext):
- listtext += ", "
- listtext += i[0]
- send(["msg " + channel + " " + user.nick + ": " + listtext, server, channel])
- def command_help(text, user, server, channel):
- if len(text) < 2:
- text.append("help")
- for i in command_list:
- if text[1] == i[0].lstrip("!"):
- send(["msg " + channel + " " + user.nick + ": " + i[2], server, channel])
- if (text[1].lower() == "me"):
- send(["msg " + channel + " " + user.nick + ": Help is on the way. It will arrive in approximately 2-3 hours", server, channel])
- return
- def command_enable(text, user, server, channel):
- if len(text) < 2:
- return
- command = text[1]
- if len(text) > 2:
- channel = text[2]
- for i in command_list:
- if command == i[0].lstrip("!") and len(i) > 3:
- if i[3] == "*":
- for j in i[4:]:
- if j == channel:
- i.remove(channel)
- else:
- for j in i[3:]:
- if j == channel:
- return
- i.append(channel)
- return
- def command_disable(text, user, server, channel):
- if len(text) < 2:
- return
- command = text[1]
- if len(text) > 2:
- channel = text[2]
- for i in command_list:
- if command == i[0].lstrip("!") and len(i) > 3:
- if i[3] == "*":
- for j in i[4:]:
- if j == channel:
- return
- i.append(channel)
- else:
- for j in i[3:]:
- if j == channel:
- i.remove(channel)
- ignore_list = [ "OphalBot", "StewieGriffin", "StewieGriffinSub", "t156", "CrsBot",
- "MitchBot", "Tribot200", "Bott", "Crackbot", "/bot/",
- "SexiestBrownie", "Mitch|hater", "TheBotMaker", "boxnode", "guffaw", "ErEnUa",
- "MitchSupy", "HaliteBot", "KELVINBOT", "boxmini", "iamscript", "boxnode"]
- def command_ignore(text, user, server, channel):
- if len(text) < 2 or "jacob1" in text[1]:
- return
- if "unignore" in text[0]:
- for i in ignore_list:
- if i == text[1]:
- ignore_list.remove(text[1])
- return
- else:
- for i in ignore_list:
- if i == text[1]:
- return
- ignore_list.append(text[1])
- def command_ping(text, user, server, channel):
- send(["msg " + channel + " PONG", server, channel])
- def command_test(text, user, server, channel):
- try:
- con = httplib.HTTPConnection( "mniip.com",80)
- con.request("GET", "/bot.lua?msg=" + text[1])
- con.close()
- except Exception as e:
- xchat.command("say Error while connecting to xsBot.")
- print e
- def command_vote(text, user, server, channel):
- if len(text) < 2:
- text.append("vote")
- command_help(text, user, server, channel)
- return
- if text[1] == "init":
- if istrusted(user):
- global votes
- votes = []
- if text[1] == "start":
- try:
- if not istrusted(user):
- send(["notice " + user.nick + " You cannot start votes", server, channel])
- return
- elif len(votes):
- send(["notice " + user.nick + " There is already a vote going on", server, channel])
- return
- elif len(text) < 3:
- command_help(text, user, channel)
- return
- except:
- send(["notice " + user.nick + " Error: the script is broken, do !vote init", server, channel])
- return
- votereason = ""
- for i in text[2:]:
- votereason = votereason + i + " "
- votes = []
- votes.append(votereason)
- votes.append(0)
- votes.append(0)
- send(["msg " + channel + " Current vote: " + votes[0], server, channel])
- elif text[1] == "end":
- if len(votes):
- if istrusted(user):
- send(["msg " + channel + " Vote ended. Votes yes: " + str(votes[1]) + " Votes no: " + str(votes[2]), server, channel])
- votes = []
- else:
- send(["notice " + user.nick + " You cannot end votes", server, channel])
- else:
- send(["msg " + channel + " There is no vote going on right now", server, channel])
- elif text[1] == "yes":
- if len(votes):
- for i in votes[3:]:
- if i == user.nick or i == user.host:
- send(["notice " + user.nick + " You have already voted", server, channel])
- return
- votes[1] = votes[1] + 1
- votes.append(user.nick)
- votes.append(user.host)
- send(["notice " + user.nick + " You voted yes", server, channel])
- else:
- send(["msg " + channel + " There is no vote going on right now", server, channel])
- elif text[1] == "no":
- if len(votes):
- for i in votes[3:]:
- if i == user.nick or i == user.host:
- send(["notice " + user.nick + " You have already voted", server, channel])
- return
- votes[2] = votes[2] + 1
- votes.append(user.nick)
- votes.append(user.host)
- send(["notice " + user.nick + " You voted no", server, channel])
- else:
- send(["msg " + channel + " There is no vote going on right now", server, channel])
- elif text[1] == "moo":
- if len(votes):
- send(["msg " + channel + " mooooo", server, channel])
- elif text[1] == "info":
- if len(votes):
- send(["msg " + channel + " Current vote: " + votes[0], server, channel])
- else:
- send(["msg " + channel + " There is no vote going on right now", server, channel])
- else:
- text[1] = "vote"
- command_help(text, user, server, channel)
- return
- sgs_info = [False, 0, "jacob1", "hobana.freenode.net", "##jacob1", "Error: this shouldn't be printed here"]
- def command_sgs(text, user, server, channel):
- if len(text) < 2:
- text.append("sgs")
- command_help(text, user, server, channel)
- return
- if sgs_info[0] == True:
- send(["notice " + user.nick + " Error: only one !sgs can be done at a time", server, channel])
- return
- whitelist = ["apropos", "at", "balls", "banmask", "base", "binary","browse",
- "calc", "coin", "comic", "convert", "ctime", "ctof", "define",
- "dice", "dict", "eightball", "elapsed", "fight", "ftoc",
- "geoip", "git", "google", "help", "hostmask", "insult", "isup",
- "justme", "karma", "kicked", "lucky", "monologue", "network",
- "ping", "pirate", "profile", "rand", "random", "randomsave",
- "rpn", "save", "seconds", "server", "time", "until", "wolf",
- "yarn" ]
- whitelistspam = ["aol", "bold", "capitalize", "cmd", "color", "colorize",
- "commands", "concat", "cpu", "cut", "field", "flip",
- "format", "gnu", "hebrew", "hexlify", "jeffk", "last",
- "leet", "list", "lithp", "lower", "ls", "moo", "moomoo",
- "more", "morse", "net", "rainbow", "repr",
- "reverse", "rot13", "scramble", "seen", "shrink", "source",
- "spellit", "squish", "stats", "status", "stripcolor",
- "suppa1337", "threads", "title", "underline", "undup",
- "unhexlify", "units", "unuid", "unmorse", "upper", "uptime",
- "version" ]
- command = ""
- text[1] = text[1].lstrip("$")
- if text[1] == "balls":
- text[1] = "karma"
- elif text[1] == "ctof":
- text[1] = "calc"
- text.append("* 1.8 + 32")
- elif text[1] == "flip":
- text[1] = "unuid"
- elif text[1] == "ftoc":
- text[1] = "rpn"
- text.append("32 - 1.8 /")
- elif text[1] == "isup":
- text[1] = "justme"
- elif text[1] == "ls":
- text[1] = "list"
- elif text[1] == "moo":
- text = ["!sgs", "rainbow moomoomoomoomoomoomoo"]
- elif text[1] == "moomoo":
- text = ["!sgs", "reverse oom oom"]
- elif text[1] == "pirateinsult":
- text[1] = "pirate {insult "
- text.append("}")
- elif text[1] == "randominsult":
- text = ["!sgs", "stripcolor you are nothing but a {random 2} little {random}, go {random} in a {random}"]
- elif text[1] == "save":
- text[1] = "browse"
- elif text[1] == "geoip" and len(text) > 2:
- tempuser = get_user(text[2], server, channel)
- if tempuser:
- text[2] = tempuser.host
- elif text[1] == "commands" or text[1] == "more":
- if channel != "#powder":
- sortedlist = sorted(whitelist + whitelistspam)
- output = ""
- if text[1] == "commands":
- for i in range(len(sortedlist)/2):
- output = output + sortedlist[i] + ", "
- output = output.rstrip(", ") + " (1 more message)"
- else:
- for i in range(len(sortedlist)):
- if i >= len(sortedlist)/2:
- output = output + sortedlist[i] + ", "
- output = output.rstrip(", ")
- send(["msg " + channel + " " + user.nick + ": " + output, server, channel])
- return
- else:
- allowed = False
- for i in whitelist:
- if text[1] == i:
- allowed = True
- break
- if not allowed and channel != "#powder":
- for i in whitelistspam:
- if text[1] == i:
- allowed = True
- break
- if not allowed and not isowner(user):
- send(["msg " + channel + " Error: This command is not in the whitelist", server, channel])
- return
- for i in text[1:]:
- if ("{" in i or "}" in i) and not isowner(user):
- send(["msg " + channel + " Error: You cannot use '{' or '}' yet", server, channel])
- return
- command = command + i + " "
- sgs_info[0] = True
- sgs_info[1] = sgs_info[1] + 1
- sgs_info[2] = user.nick
- sgs_info[3] = server
- sgs_info[4] = channel
- sgs_info[5] = "Error: no response"
- for channel in xchat.get_list('channels'):
- if "freenode" in channel.server and channel.channel == "##powder-bots" and get_user("StewieGriffinSub", channel.server, channel.channel):
- send(["msg StewieGriffinSub " + command, channel.server, channel.channel])
- break
- xchat.hook_timer(10000, sgs_timeout, sgs_info[1])
- def notice_hook(word, word_eol, userdata):
- if sgs_info[0] == True and word[0] == "StewieGriffinSub":
- sgs_info[0] = False
- text = word[1].split()
- if len(text) < 1:
- return
- output = ""
- output2 = ""
- output3 = ""
- for i in text:
- banned = False
- for j in echo_banned:
- if j in i.lower():
- banned = True
- if not banned:
- for j in echo_regex_banned[:-2]:
- if re.match(j, i.lower()):
- banned = True
- if sgs_info[4] == "###xsbot":
- if "http" in i:
- i = i[1:len(i)-2]
- if not banned:
- if sgs_info[4] != "###xsbot" or len(output) + len(i) < 92:
- output = output + i + " "
- elif sgs_info[4] != "###xsbot" or len(output2) + len(i) < 100:
- output2 = output2 + i + " "
- else:
- output3 = output3 + i + " "
- if sgs_info[4] == "###xsbot":
- output = "result: " + output
- elif sgs_info[2] != "jacob1":
- output = sgs_info[2] + ": " + output
- if len(output):
- send(["msg " + sgs_info[4] + " " + output.rstrip(), sgs_info[3], sgs_info[4]])
- if len(output2):
- send(["msg " + sgs_info[4] + " ... " + output2.rstrip(), sgs_info[3], sgs_info[4]])
- if len(output3):
- send(["msg " + sgs_info[4] + " ... " + output3.rstrip(), sgs_info[3], sgs_info[4]])
- return xchat.EAT_XCHAT
- def sgs_timeout(userdata):
- if sgs_info[0] == True and userdata == sgs_info[1]:
- sgs_info[0] = False
- send(["msg " + sgs_info[4] + " " + sgs_info[2] + ": Error: no response", sgs_info[3], sgs_info[4]])
- def command_hostmask(text, user, server, channel):
- if len(text) < 2:
- send(["msg " + channel+ " " + user.nick + ": " + user.host, server, channel])
- else:
- tempuser = get_user(text[1], server, channel)
- if tempuser:
- send(["msg " + channel+ " " + user.nick + ": " + tempuser.host, server, channel])
- else:
- send(["msg " + channel+ " " + user.nick + ": user not found", server, channel])
- # Random useful functions
- def get_bot(server, channel):
- #xchat.find_context(server, channel)
- bot = get_user("StewieGriffin", server, channel)
- if bot == None or bot.prefix == None or bot.prefix == "+":
- bot = get_user("StewieGriffinSub", server, channel)
- if bot == None or bot.prefix == None or bot.prefix == "+":
- bot = get_user("Otaku", server, channel)
- if bot == None or bot.prefix == None or bot.prefix == "+":
- return None
- return bot
- def do_ban(mode, timer, user, server, channel):
- banuser = get_user(user, server, channel)
- jacob1 = get_user("jacob1", server, channel)
- bot = get_bot(server, channel)
- if banuser:
- if "+" in mode and (istrusted(banuser) or banuser.host is "~Stewie@Powder/Bot/StewieGriffin"):
- print("Error: will not ban " + user)
- return 0
- toban = banuser.nick
- if banuser.host:
- toban = banuser.host
- else:
- toban = user
- if "+" in mode and "jacob1" in toban:
- print("Error: will not ban jacob1")
- return 0
- if jacob1 and jacob1.prefix and jacob1.prefix != "+":
- xchat.hook_timer(timer, command_timer, ["mode " + channel + " " + mode + " " + toban, server, channel])
- return 1
- elif bot and bot.prefix and bot.prefix != "+":
- xchat.hook_timer(timer, command_timer, ["msg " + bot.nick + " mode " + channel + " " + mode + " " + toban, server, channel])
- return 1
- print("Error: cannot ban " + user)
- return 0
- def user_kick(user, server, channel, message):
- tokick = get_user(user, server, channel)
- jacob1 = get_user("jacob1", server, channel)
- bot = get_bot(server, channel)
- if tokick and not istrusted(tokick) and not "jacob1" in tokick.nick:
- xchat.command("gui flash")
- xchat.command("gui color 3")
- if jacob1 and jacob1.prefix and jacob1.prefix != "+":
- send(["kick " + tokick.nick + " " + message, server, channel])
- return 1
- elif bot and bot.prefix and bot.prefix != "+":
- send(["msg " + bot.nick + " kick " + channel + " " + tokick.nick + " " + message, server, channel])
- return 1
- print("Error: cannot kick " + user)
- return 0
- def color_strip(text):
- regex = re.compile("\x03(?:\d{1,2}(?:,\d{1,2})?)?|\x01|\x02|\x09|\x0f|\x13|\x15|\x16|\x1d|\x1f", re.UNICODE)
- return regex.sub("", text)
- class tempuser:
- nick = ""
- host = ""
- prefix = ""
- def get_user(username, server, channel):
- try:
- if channel is not None:
- thechannel = xchat.find_context(server, channel)
- else:
- thechannel = xchat.get_context()
- except:
- thechannel = channel
- if thechannel:
- thechannel.command("")
- users = thechannel.get_list("users")
- for i in range(len(users)):
- if users[i].nick == username:
- return users[i]
- # Main Main Main Main
- # Main Main Main Main
- # Main Main Main Main
- # Main Main Main Main
- def main(word, word_eol, userdata):
- if len(word) < 2:
- return
- #if xchat.get_info("network") != "wolfznc" and xchat.get_info("network") != "iota": # a fix for it doing commands twice when commected twice
- # return
- server = xchat.get_info("server")
- channel = xchat.get_info("channel")
- text = word[1].split()
- if channel == "###xsbot" and "<" in text[0] and ">" in text[0]:
- text.pop(0)
- if len(text) < 1:
- return
- jacob1 = get_user(xchat.get_info("nick"), server, channel)
- if (channel == "#powder" or channel == "##powder-bots" or channel == "##jacob1") and not jacob1.prefix:
- return
- tmpuser = color_strip(word[0])
- user = get_user(tmpuser, server, channel)
- if not user and "#" in channel:
- return
- elif not user:
- user = tempuser()
- user.nick = tmpuser
- if tmpuser == xchat.get_info("nick"):
- user.host = "~jacob1@Powder/Developer/jacob1"
- else:
- user.host = "unknown"
- user.prefix = ""
- for i in ignore_list: #ignore both nicks and hosts
- if user.nick == i or i in user.host:
- return
- #if not isowner(user):
- # return
- command = text[0].lower()
- for i in command_list:
- if (command == i[0] or i[0] == "*") and len(i) > 3:
- if i[3] == "*":
- Enabled = True
- for j in i[3:]:
- if channel == j and not isowner(user):
- Enabled = False
- if Enabled:
- i[1](text, user, server, channel)
- else:
- commandEnabled = False
- for j in i[3:]:
- if channel == j or j == "*" or isowner(user):
- commandEnabled = True
- if commandEnabled:
- i[1](text, user, server, channel)
- command_add(["*", command_badwordsearch, "Searches all messages for badwords", "##powder-bots"])
- command_add(["!echo", command_echo, "Repeats text", "##powder-bots", "#botters", "##jacob1", "##boxmein", "#chat"])
- command_add(["!mod", command_mod, "Gives a link to jacob1's Mod", "*"])
- command_add(["!ban", command_ban, "(!ban <nick|hostmask> [<length>]) Bans a user", "#powder", "##powder-bots", "##jacob1"])
- command_add(["!unban", command_unban, "(!unban <nick|hostmask>) Unbans a user", "#powder", "##powder-bots", "##jacob1"])
- command_add(["!stab", command_stab, "(!stab <nick|hostmask> [<length>]) Quiets a user", "#powder", "##powder-bots", "##jacob1"])
- command_add(["!unstab", command_unstab, "(!unstab <nick|hostmask>) Unquiets a user", "#powder", "##powder-bots", "##jacob1"])
- command_add(["$ban", command_ban, "($ban <nick|hostmask> [<length>]) Bans a user", "#powder"])
- command_add(["$unban", command_unban, "($unban <nick|hostmask>) Unbans a user", "#powder"])
- command_add(["$stab", command_stab, "($stab <nick|hostmask> [<length>]) Quiets a user", "#powder"])
- command_add(["$unstab", command_unstab, "($unstab <nick|hostmask>) Unquiets a user", "#powder"])
- command_add(["!badwords", command_badwords, "(!badwords list|add|remove|clear [<word>])", "##powder-bots"])
- command_add(["$badwords", command_badwords, "($badwords list|add|remove|clear [<word>])", ""])
- command_add(["!potato", command_potato, "I'm a potato", "##powder-bots", "##jacob1", "#chat"])
- command_add(["!list", command_list2, "Lists all commands available in the channel", "*", "##TPT-DieWelle"])
- command_add(["!help", command_help, "(!help <command>) Shows help for a command", "*", "##TPT-DieWelle"])
- command_add(["!enable", command_enable, "Enables a command, jacob1 only", ""])
- command_add(["!disable", command_disable, "Disables a command, jacob1 only", ""])
- command_add(["!ignore", command_ignore, "Ignores a user, jacob1 only", ""])
- command_add(["!unignore", command_ignore, "Unignores a user, jacob1 only", ""])
- command_add(["!ping", command_ping, "PONG", "*", "##TPT-DieWelle"])
- command_add(["!vote", command_vote, "(!vote yes|no|start|end|info)", "*"])
- command_add(["!sgs", command_sgs, "sends a command to StewieGriffinSub to be run", "*", "#powder"])
- command_add(["!hostmask", command_hostmask, "returns your hostmask", "*"])
- command_add(["!test", command_test, "random command for testing", ""])
- # Hooks
- def hook_unload(text, user, server, channel):
- xchat.unhook(hooks[0])
- xchat.unhook(hooks[1])
- xchat.unhook(hooks[2])
- xchat.unhook(hooks[3])
- xchat.unhook(hooks[4])
- xchat.unhook(hooks[5])
- xchat.unhook(hooks[6])
- xchat.unhook(hooks[7])
- xchat.unhook(hooks[8])
- xchat.unhook(hooks[9])
- xchat.unhook(hooks[10])
- print("*** Unloaded script")
- def hook_unload2(userdata):
- hook_unload("", "", "", "")
- command_add(["!panic", hook_unload, "panic and disable all hooks", ""])
- hooks = [ ]
- def hook_delay(userdata):
- hooks.append(xchat.hook_print("Channel Message", main))
- hooks.append(xchat.hook_print("Private Message", main))
- hooks.append(xchat.hook_print("Private Message to Dialog", main))
- hooks.append(xchat.hook_print("Channel Msg Hilight", main))
- hooks.append(xchat.hook_print("Channel Action", main))
- hooks.append(xchat.hook_print("Private Action to Dialog", main))
- hooks.append(xchat.hook_print("Channel Action Hilight", main))
- hooks.append(xchat.hook_print("Your Message", main))
- hooks.append(xchat.hook_print("Your Action", main))
- hooks.append(xchat.hook_print("Notice", notice_hook))
- hooks.append(xchat.hook_unload(hook_unload2))
- global votes
- votes = []
- context = xchat.get_context()
- temptest = get_user(xchat.get_info("nick"), xchat.get_info("server"), "#powder")
- if temptest and temptest.host:
- hook_delay("")
- context.prnt("*** Loaded script")
- else:
- xchat.hook_timer(6000, hook_delay)
- xchat.hook_timer(3000, command_timer, "who #powder")
- xchat.hook_timer(3000, command_timer, "who #powder-social")
- xchat.hook_timer(3000, command_timer, "who ##powder-bots")
- xchat.hook_timer(3000, command_timer, "who ##jacob1")
- context.prnt("*** Loaded script")
- random.seed()
Advertisement
Add Comment
Please, Sign In to add comment