merged mute with admin
This commit is contained in:
parent
be1a5777f5
commit
5c09e0c0d1
2 changed files with 39 additions and 41 deletions
|
@ -1,8 +1,11 @@
|
||||||
# Shitty plugin made by iloveportalz0r
|
# Shitty plugin made by iloveportalz0r
|
||||||
# Broken by The Noodle
|
# Broken by The Noodle
|
||||||
# Improved by Lukeroge
|
# Improved by Lukeroge
|
||||||
|
# Mute added by neersighted
|
||||||
from util import hook
|
from util import hook
|
||||||
import sys
|
import sys
|
||||||
|
import usertracking
|
||||||
|
import time
|
||||||
|
|
||||||
# Added to make the move to a new auth system a lot easier
|
# Added to make the move to a new auth system a lot easier
|
||||||
def isadmin(input):
|
def isadmin(input):
|
||||||
|
@ -158,3 +161,39 @@ def topic(inp, input=None, notice=None):
|
||||||
else:
|
else:
|
||||||
out = "TOPIC %s :%s" % (input.chan, message)
|
out = "TOPIC %s :%s" % (input.chan, message)
|
||||||
input.conn.send(out)
|
input.conn.send(out)
|
||||||
|
|
||||||
|
@hook.sieve
|
||||||
|
def mutesieve(bot, input, func, kind, args):
|
||||||
|
if kind == "event":
|
||||||
|
return input
|
||||||
|
if "chan" in input.keys() and input.chan in input.conn.users.channels and hasattr(input.conn.users[input.chan], "mute"):
|
||||||
|
if input.command == "PRIVMSG" and input.lastparam[1:] == "unmute":
|
||||||
|
return input
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
return input
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def mute(inp, input=None, db=None, bot=None, users=None):
|
||||||
|
if inp and inp in input.conn.users.channels.keys():
|
||||||
|
input.chan = inp
|
||||||
|
".mute <channel> -- Mutes the bot"
|
||||||
|
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
||||||
|
users[input.chan].mute = "%s %d" % (input.nick, time.time())
|
||||||
|
input.notice("Muted")
|
||||||
|
else:
|
||||||
|
input.notice("Only bot admins can use this command!")
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def unmute(inp, input=None, db=None, bot=None, users=None):
|
||||||
|
if inp and inp in users.channels.keys():
|
||||||
|
input.chan = inp
|
||||||
|
".unmute <channel> -- Unmutes the bot"
|
||||||
|
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
||||||
|
if hasattr(users[input.chan], "mute"):
|
||||||
|
input.notice("Unmuted")
|
||||||
|
del users[input.chan].mute
|
||||||
|
else:
|
||||||
|
input.notice("Not Muted")
|
||||||
|
else:
|
||||||
|
input.notice("Only bot admins can use this command!")
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
from util import hook
|
|
||||||
import usertracking
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
@hook.sieve
|
|
||||||
def mutesieve(bot, input, func, kind, args):
|
|
||||||
if kind == "event":
|
|
||||||
return input
|
|
||||||
if "chan" in input.keys() and input.chan in input.conn.users.channels and hasattr(input.conn.users[input.chan], "mute"):
|
|
||||||
if input.command == "PRIVMSG" and input.lastparam[1:] == "unmute":
|
|
||||||
return input
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
return input
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def mute(inp, input=None, db=None, bot=None, users=None):
|
|
||||||
if inp and inp in input.conn.users.channels.keys():
|
|
||||||
input.chan = inp
|
|
||||||
".mute <channel> -- Mutes the bot"
|
|
||||||
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
|
||||||
users[input.chan].mute = "%s %d" % (input.nick, time.time())
|
|
||||||
input.notice("Muted")
|
|
||||||
else:
|
|
||||||
input.notice("Only bot admins can use this command!")
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def unmute(inp, input=None, db=None, bot=None, users=None):
|
|
||||||
if inp and inp in users.channels.keys():
|
|
||||||
input.chan = inp
|
|
||||||
".unmute <channel> -- Unmutes the bot"
|
|
||||||
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
|
||||||
if hasattr(users[input.chan], "mute"):
|
|
||||||
input.notice("Unmuted")
|
|
||||||
del users[input.chan].mute
|
|
||||||
else:
|
|
||||||
input.notice("Not Muted")
|
|
||||||
else:
|
|
||||||
input.notice("Only bot admins can use this command!")
|
|
Reference in a new issue