forked from zuckerberg/dailybot
Don't use notice
This commit is contained in:
parent
2e07bbb710
commit
31726089b6
@ -44,14 +44,14 @@ class Module:
|
|||||||
def main(i, irc):
|
def main(i, irc):
|
||||||
values = i.msg_nocmd.split('d')
|
values = i.msg_nocmd.split('d')
|
||||||
if len(values) != 2:
|
if len(values) != 2:
|
||||||
irc.notice(i.channel, f"Usage: {i.cmd_prefix}roll <n>d<s>")
|
irc.privmsg(i.channel, f"Usage: {i.cmd_prefix}roll <n>d<s>")
|
||||||
return
|
return
|
||||||
|
|
||||||
n_dice = int(values[0])
|
n_dice = int(values[0])
|
||||||
n_sides = int(values[1])
|
n_sides = int(values[1])
|
||||||
|
|
||||||
if n_dice > 1000 or n_sides > 1000:
|
if n_dice > 1000 or n_sides > 1000:
|
||||||
irc.notice(i.channel, f"{i.nickname}: Too many dice or sides given.")
|
irc.privmsg(i.channel, f"{i.nickname}: Too many dice or sides given.")
|
||||||
return
|
return
|
||||||
|
|
||||||
results = [random.randint(1, n_sides) for i in range(n_dice)]
|
results = [random.randint(1, n_sides) for i in range(n_dice)]
|
||||||
|
@ -84,13 +84,13 @@ def is_hidden(i, module_name):
|
|||||||
|
|
||||||
def module_checks(i, irc, module):
|
def module_checks(i, irc, module):
|
||||||
if module not in i.modules.keys():
|
if module not in i.modules.keys():
|
||||||
irc.notice(i.channel, f"Help: `{module}' is not an imported module.")
|
irc.privmsg(i.channel, f"Help: `{module}' is not an imported module.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
module_bl = irc.var.modules_obj["blacklist"][module]
|
module_bl = irc.var.modules_obj["blacklist"][module]
|
||||||
if module_bl and i.channel in module_bl:
|
if module_bl and i.channel in module_bl:
|
||||||
irc.notice(i.channel, f"Help: This module has been disabled.")
|
irc.privmsg(i.channel, f"Help: This module has been disabled.")
|
||||||
return False
|
return False
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass # No blacklist, move on
|
pass # No blacklist, move on
|
||||||
@ -98,14 +98,14 @@ def module_checks(i, irc, module):
|
|||||||
try:
|
try:
|
||||||
module_wl = irc.var.modules_obj["whitelist"][module]
|
module_wl = irc.var.modules_obj["whitelist"][module]
|
||||||
if module_wl and i.channel not in module_wl:
|
if module_wl and i.channel not in module_wl:
|
||||||
irc.notice(i.channel, f"Help: This module has been disabled.")
|
irc.privmsg(i.channel, f"Help: This module has been disabled.")
|
||||||
return False
|
return False
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass # No whitelist, move on
|
pass # No whitelist, move on
|
||||||
|
|
||||||
module_c = i.modules[module].Module()
|
module_c = i.modules[module].Module()
|
||||||
if not hasattr(module_c, "manual"):
|
if not hasattr(module_c, "manual"):
|
||||||
irc.notice(i.channel, "Help: This module does not have a manual.")
|
irc.privmsg(i.channel, "Help: This module does not have a manual.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -128,7 +128,7 @@ def module_help(i, irc, module):
|
|||||||
|
|
||||||
t = f"\x0311{module}\x0F: {commands}{info}"
|
t = f"\x0311{module}\x0F: {commands}{info}"
|
||||||
t += f" | Use: {i.cmd_prefix}help <module> <command> for command info."
|
t += f" | Use: {i.cmd_prefix}help <module> <command> for command info."
|
||||||
irc.notice(i.channel, t)
|
irc.privmsg(i.channel, t)
|
||||||
|
|
||||||
|
|
||||||
def command_help(i, irc, module, command):
|
def command_help(i, irc, module, command):
|
||||||
@ -138,17 +138,17 @@ def command_help(i, irc, module, command):
|
|||||||
module_c = i.modules[module].Module()
|
module_c = i.modules[module].Module()
|
||||||
|
|
||||||
if not hasattr(module_c, "commands"):
|
if not hasattr(module_c, "commands"):
|
||||||
irc.notice(i.channel, "Help: This module does not provide commands.")
|
irc.privmsg(i.channel, "Help: This module does not provide commands.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if "bot_commands" not in module_c.manual:
|
if "bot_commands" not in module_c.manual:
|
||||||
irc.notice(i.channel, "Help: No manual entry for this command ")
|
irc.privmsg(i.channel, "Help: No manual entry for this command ")
|
||||||
return
|
return
|
||||||
|
|
||||||
command_manual = module_c.manual["bot_commands"]
|
command_manual = module_c.manual["bot_commands"]
|
||||||
|
|
||||||
if command not in command_manual:
|
if command not in command_manual:
|
||||||
irc.notice(i.channel, "Help: No manual entry for this command.")
|
irc.privmsg(i.channel, "Help: No manual entry for this command.")
|
||||||
return
|
return
|
||||||
|
|
||||||
command_entry = command_manual[command]
|
command_entry = command_manual[command]
|
||||||
@ -172,7 +172,7 @@ def command_help(i, irc, module, command):
|
|||||||
|
|
||||||
t = " | ".join(t)
|
t = " | ".join(t)
|
||||||
t = f"{command}: {t}"
|
t = f"{command}: {t}"
|
||||||
irc.notice(i.channel, t)
|
irc.privmsg(i.channel, t)
|
||||||
|
|
||||||
|
|
||||||
def module_list(i, irc):
|
def module_list(i, irc):
|
||||||
@ -185,7 +185,7 @@ def module_list(i, irc):
|
|||||||
m = itertools.chain(m1, m2)
|
m = itertools.chain(m1, m2)
|
||||||
t = "Help: " + ", ".join(sorted(m))
|
t = "Help: " + ", ".join(sorted(m))
|
||||||
t += f" | Use: {i.cmd_prefix}help <module> for module info."
|
t += f" | Use: {i.cmd_prefix}help <module> for module info."
|
||||||
irc.notice(i.channel, t)
|
irc.privmsg(i.channel, t)
|
||||||
|
|
||||||
|
|
||||||
def main(i, irc):
|
def main(i, irc):
|
||||||
@ -198,6 +198,6 @@ def main(i, irc):
|
|||||||
command_help(i, irc, argv[0], argv[1])
|
command_help(i, irc, argv[0], argv[1])
|
||||||
else:
|
else:
|
||||||
m = f"Usage: {i.cmd_prefix}help [module] [command]"
|
m = f"Usage: {i.cmd_prefix}help [module] [command]"
|
||||||
irc.notice(i.channel, m)
|
irc.privmsg(i.channel, m)
|
||||||
else:
|
else:
|
||||||
module_list(i, irc)
|
module_list(i, irc)
|
||||||
|
@ -154,11 +154,11 @@ def listquotes(channel, nickname, dbc, irc):
|
|||||||
data += m
|
data += m
|
||||||
|
|
||||||
if not rest and not sbn:
|
if not rest and not sbn:
|
||||||
irc.notice(nickname, f"{logo}: No results.")
|
irc.privmsg(nickname, f"{logo}: No results.")
|
||||||
else:
|
else:
|
||||||
pomf_url = listquotes_pomf(data)
|
pomf_url = listquotes_pomf(data)
|
||||||
m = f"{logo}: Your quotes can be found here: {pomf_url}"
|
m = f"{logo}: Your quotes can be found here: {pomf_url}"
|
||||||
irc.notice(nickname, m)
|
irc.privmsg(nickname, m)
|
||||||
|
|
||||||
|
|
||||||
def listquotes_pomf(data):
|
def listquotes_pomf(data):
|
||||||
|
@ -212,4 +212,4 @@ def main(i, irc):
|
|||||||
# Truncate the output just in case. We can't send 512 bytes anyway.
|
# Truncate the output just in case. We can't send 512 bytes anyway.
|
||||||
m = m[:512]
|
m = m[:512]
|
||||||
|
|
||||||
irc.notice(receiver, m)
|
irc.privmsg(receiver, m)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user