More fixes
This commit is contained in:
parent
3e2dad827f
commit
b23d54df44
1 changed files with 6 additions and 3 deletions
|
@ -5,16 +5,19 @@ muted = []
|
||||||
|
|
||||||
|
|
||||||
def mute_target(target):
|
def mute_target(target):
|
||||||
|
""" mutes someone """
|
||||||
target = target.lower()
|
target = target.lower()
|
||||||
muted.append(target)
|
muted.append(target)
|
||||||
|
|
||||||
|
|
||||||
def unmute_target(target):
|
def unmute_target(target):
|
||||||
|
""" unmutes someone """
|
||||||
target = target.lower()
|
target = target.lower()
|
||||||
muted.remove(target)
|
muted.remove(target)
|
||||||
|
|
||||||
|
|
||||||
def is_muted(target):
|
def is_muted(target):
|
||||||
|
""" checks of someone is muted """
|
||||||
target = target.lower()
|
target = target.lower()
|
||||||
if target in muted:
|
if target in muted:
|
||||||
return True
|
return True
|
||||||
|
@ -24,8 +27,10 @@ def is_muted(target):
|
||||||
|
|
||||||
@hook.sieve
|
@hook.sieve
|
||||||
def mutesieve(bot, input, func, type, args):
|
def mutesieve(bot, input, func, type, args):
|
||||||
|
""" blocks input from muted channels/users """
|
||||||
|
# don't block input to event hooks
|
||||||
if type == "event":
|
if type == "event":
|
||||||
return input
|
return input
|
||||||
if is_muted(input.chan) or is_muted(input.nick):
|
if is_muted(input.chan) or is_muted(input.nick):
|
||||||
if input.command == "PRIVMSG" and input.lastparam[1:] == "unmute":
|
if input.command == "PRIVMSG" and input.lastparam[1:] == "unmute":
|
||||||
return input
|
return input
|
||||||
|
@ -46,7 +51,6 @@ def listmuted(inp, bot=None):
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def mute(inp, input=None, db=None):
|
def mute(inp, input=None, db=None):
|
||||||
".mute <channel/user> -- Makes the bot ignore <channel/user>."
|
".mute <channel/user> -- Makes the bot ignore <channel/user>."
|
||||||
"If no channel is specified, it is muted in the current channel."
|
|
||||||
target = inp
|
target = inp
|
||||||
|
|
||||||
if is_muted(target):
|
if is_muted(target):
|
||||||
|
@ -59,7 +63,6 @@ def mute(inp, input=None, db=None):
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def unmute(inp, input=None, db=None):
|
def unmute(inp, input=None, db=None):
|
||||||
".unmute <channel/user> -- Makes the bot listen to <channel/user>."
|
".unmute <channel/user> -- Makes the bot listen to <channel/user>."
|
||||||
"If no channel is specified, it is unmuted in the current channel."
|
|
||||||
target = inp
|
target = inp
|
||||||
|
|
||||||
if is_muted(target):
|
if is_muted(target):
|
||||||
|
|
Reference in a new issue