added the main op commands

This commit is contained in:
neersighted 2012-04-01 21:30:04 -07:00
parent adc9a3c608
commit 5af42f128a
2 changed files with 91 additions and 24 deletions

View file

@ -91,16 +91,16 @@ def say(inp, conn=None, chan=None, notice=None):
".say [channel] <message> -- Makes the bot say <message> in [channel]. "\ ".say [channel] <message> -- Makes the bot say <message> in [channel]. "\
"If [channel] is blank the bot will say the <message> in "\ "If [channel] is blank the bot will say the <message> in "\
"the channel the command was used in." "the channel the command was used in."
split = inp.split(" ") inp = inp.split(" ")
if split[0][0] == "#": if inp[0][0] == "#":
message = "" message = ""
for x in split[1:]: for x in inp[1:]:
message = message + x + " " message = message + x + " "
message = message[:-1] message = message[:-1]
out = "PRIVMSG %s :%s" % (split[0], message) out = "PRIVMSG %s :%s" % (inp[0], message)
else: else:
message = "" message = ""
for x in split[0:]: for x in inp[0:]:
message = message + x + " " message = message + x + " "
message = message[:-1] message = message[:-1]
out = "PRIVMSG %s :%s" % (chan, message) out = "PRIVMSG %s :%s" % (chan, message)
@ -113,16 +113,16 @@ def me(inp, conn=None, chan=None, notice=None):
".me [channel] <action> -- Makes the bot act out <action> in [channel] "\ ".me [channel] <action> -- Makes the bot act out <action> in [channel] "\
"If [channel] is blank the bot will act the <action> in "\ "If [channel] is blank the bot will act the <action> in "\
"the channel the command was used in." "the channel the command was used in."
split = inp.split(" ") inp = inp.split(" ")
if split[0][0] == "#": if inp[0][0] == "#":
message = "" message = ""
for x in split[1:]: for x in inp[1:]:
message = message + x + " " message = message + x + " "
message = message[:-1] message = message[:-1]
out = "PRIVMSG %s :\x01ACTION %s\x01" % (split[0], message) out = "PRIVMSG %s :\x01ACTION %s\x01" % (inp[0], message)
else: else:
message = "" message = ""
for x in split[0:]: for x in inp[0:]:
message = message + x + " " message = message + x + " "
message = message[:-1] message = message[:-1]
out = "PRIVMSG %s :\x01ACTION %s\x01" % (chan, message) out = "PRIVMSG %s :\x01ACTION %s\x01" % (chan, message)

View file

@ -1,28 +1,29 @@
# Plugin made by iloveportalz0r, TheNoodle, Lukeroge and neersighted # Plugin made by Lukeroge and neersighted
from util import hook from util import hook
@hook.command(adminonly=True) @hook.command(adminonly=True)
def kick(inp, chan=None, conn=None, notice=None): def kick(inp, chan=None, conn=None, notice=None):
".kick [channel] <user> [reason] -- Makes the bot kick <user> in [channel] "\ ".kick [channel] <user> [reason] -- Makes the bot kick <user> in [channel] "\
"If [channel] is blank the bot will kick the <user> in "\ "If [channel] is blank the bot will kick the <user> in "\
"the channel the command was used in." "the channel the command was used in."
split = inp.split(" ") inp = inp.split(" ")
if split[0][0] == "#": if inp[0][0] == "#":
chan = split[0] chan = inp[0]
user = split[1] user = inp[1]
out = "KICK %s %s" % (chan, user) out = "KICK %s %s" % (chan, user)
if len(split) > 2: if len(inp) > 2:
reason = "" reason = ""
for x in split[2:]: for x in inp[2:]:
reason = reason + x + " " reason = reason + x + " "
reason = reason[:-1] reason = reason[:-1]
out = out + " :" + reason out = out + " :" + reason
else: else:
user = split[0] user = inp[0]
out = "KICK %s %s" % (chan, split[0]) out = "KICK %s %s" % (chan, user)
if len(split) > 1: if len(inp) > 1:
reason = "" reason = ""
for x in split[1:]: for x in inp[1:]:
reason = reason + x + " " reason = reason + x + " "
reason = reason[:-1] reason = reason[:-1]
out = out + " :" + reason out = out + " :" + reason
@ -30,12 +31,78 @@ def kick(inp, chan=None, conn=None, notice=None):
notice("Attempting to kick %s from %s..." % (user, chan)) notice("Attempting to kick %s from %s..." % (user, chan))
conn.send(out) conn.send(out)
@hook.command(adminonly=True)
def ban(inp, conn=None, chan=None, notice=None):
".ban [channel] <user> -- Makes the bot ban <user> in [channel]. "\
"If [channel] is blank the bot will ban <user> in "\
"the channel the command was used in."
inp = inp.split(" ")
if inp[0][0] == "#":
chan = inp[0]
user = inp[1]
out = "MODE %s +b %s" % (chan, user)
else:
user = inp[0]
out = "MODE %s +b %s" % (chan, user)
notice("Attempting to ban %s from %s..." % (user, chan))
conn.send(out)
@hook.command(adminonly=True)
def unban(inp, conn=None, chan=None, notice=None):
".unban [channel] <user> -- Makes the bot unban <user> in [channel]. "\
"If [channel] is blank the bot will unban <user> in "\
"the channel the command was used in."
inp = inp.split(" ")
if inp[0][0] == "#":
chan = inp[0]
user = inp[1]
out = "MODE %s -b %s" % (chan, user)
else:
user = inp[0]
out = "MODE %s -b %s" % (chan, user)
notice("Attempting to unban %s from %s..." % (user, chan))
conn.send(out)
@hook.command(adminonly=True)
def kickban(inp, chan=None, conn=None, notice=None):
".kickban [channel] <user> [reason] -- Makes the bot kickban <user> in [channel] "\
"If [channel] is blank the bot will kickban the <user> in "\
"the channel the command was used in."
inp = inp.split(" ")
if inp[0][0] == "#":
chan = inp[0]
user = inp[1]
out1 = "MODE %s +b %s" % (chan, user)
out2 = "KICK %s %s" % (chan, user)
if len(inp) > 2:
reason = ""
for x in inp[2:]:
reason = reason + x + " "
reason = reason[:-1]
out = out + " :" + reason
else:
user = inp[0]
out1 = "MODE %s +b %s" % (chan, user)
out2 = "KICK %s %s" % (chan, user)
if len(inp) > 1:
reason = ""
for x in inp[1:]:
reason = reason + x + " "
reason = reason[:-1]
out = out + " :" + reason
notice("Attempting to kickban %s from %s..." % (user, chan))
conn.send(out1)
conn.send(out2)
@hook.command(adminonly=True) @hook.command(adminonly=True)
def topic(inp, conn=None, chan=None, notice=None): def topic(inp, conn=None, chan=None, notice=None):
".topic [channel] <topic> -- Change the topic of a channel." ".topic [channel] <topic> -- Change the topic of a channel."
split = inp.split(" ") inp = inp.split(" ")
if split[0][0] == "#": if inp[0][0] == "#":
out = "PRIVMSG %s :%s" % (split[0], message) out = "PRIVMSG %s :%s" % (inp[0], message)
else: else:
out = "TOPIC %s :%s" % (chan, message) out = "TOPIC %s :%s" % (chan, message)
conn.send(out) conn.send(out)