factoids just got a whole lot more dynamic
This commit is contained in:
parent
8358134ec6
commit
4dc3980d99
1 changed files with 14 additions and 4 deletions
|
@ -106,7 +106,7 @@ def forget(inp, db=None, input=None, notice=None):
|
|||
|
||||
@hook.command("info")
|
||||
@hook.regex(r'^\? ?(.+)')
|
||||
def factoid(inp, say=None, db=None, bot=None):
|
||||
def factoid(inp, say=None, db=None, bot=None, me=None, conn=None, input=None):
|
||||
"?<word> -- Shows what data is associated with <word>."
|
||||
try:
|
||||
prefix_on = bot.config["plugins"]["factoids"].get("prefix", False)
|
||||
|
@ -118,6 +118,16 @@ def factoid(inp, say=None, db=None, bot=None):
|
|||
data = get_memory(db, inp.group(1).strip())
|
||||
if data:
|
||||
out = multiwordReplace(data, shortcodes)
|
||||
|
||||
# dynamic variables for factoids
|
||||
out = out.replace("$nick", input.nick)
|
||||
out = out.replace("$chan", input.chan)
|
||||
out = out.replace("$botnick", conn.nick)
|
||||
|
||||
if out.startswith("<act>"):
|
||||
out = out[5:].strip()
|
||||
me(out)
|
||||
else:
|
||||
if prefix_on:
|
||||
say("\x02[%s]:\x02 %s" % (inp.group(1).strip(), out))
|
||||
else:
|
||||
|
|
Reference in a new issue