Skip to content

Commit 5d9634c

Browse files
committed
allow input to be embedded in a factoid output.
1 parent 4f25061 commit 5d9634c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

plugins/factoids.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def del_factoid(db, chan, word):
7676

7777
@hook.command("r","remember", permissions=["op"])
7878
def remember(text, nick, db, chan, notice):
79-
"""<word> [+]<data> - remembers <data> with <word> - add + to <data> to append"""
79+
"""<word> [+]<data> - remembers <data> with <word> - add + to <data> to append. If the input starts with <act> the message will be sent as an action. If <user> in in the message it will be replaced by input arguments when command is called."""
8080
global factoid_cache
8181
try:
8282
word, data = text.split(None, 1)
@@ -138,9 +138,11 @@ def info(text, chan, notice):
138138

139139

140140
@hook.regex(factoid_re)
141-
def factoid(match, chan, event, message, action):
141+
def factoid( content, match, chan, event, message, action):
142142
"""<word> - shows what data is associated with <word>"""
143-
143+
arg1 = ""
144+
if len(content.split()) >= 2:
145+
arg1 = content.split()[1]
144146
# split up the input
145147
split = match.group(1).strip().split(" ")
146148
factoid_id = split[0].lower()
@@ -156,7 +158,8 @@ def factoid(match, chan, event, message, action):
156158

157159
# factoid post-processors
158160
result = colors.parse(result)
159-
161+
if arg1:
162+
result = result.replace("<user>", arg1)
160163
if result.startswith("<act>"):
161164
result = result[5:].strip()
162165
action(result)

0 commit comments

Comments
 (0)