Merge branch 'develop' into refresh
Conflicts: core/irc.py plugins/correction.py plugins/history.py requirements.txt
This commit is contained in:
commit
9f029c8ceb
17 changed files with 463 additions and 210 deletions
|
@ -1,6 +1,8 @@
|
|||
from util import hook
|
||||
|
||||
import re
|
||||
|
||||
<<<<<<< HEAD
|
||||
@hook.regex(r'^(s|S)/.*/.*/\S*$')
|
||||
def correction(inp, message=None, input=None, notice=None, db=None):
|
||||
splitinput = input.msg.split("/")
|
||||
|
@ -24,8 +26,38 @@ def correction(inp, message=None, input=None, notice=None, db=None):
|
|||
message(u"Correction, <{}> {}".format(nick, msg.replace(find, "\x02" + replace + "\x02")))
|
||||
else:
|
||||
notice(u"{} can't be found in your last message".format(find))
|
||||
=======
|
||||
CORRECTION_RE = r'^(s|S)/.*/.*/?\S*$'
|
||||
|
||||
|
||||
@hook.regex(CORRECTION_RE)
|
||||
def correction(match, input=None, conn=None, message=None):
|
||||
split = input.msg.split("/")
|
||||
|
||||
if len(split) == 4:
|
||||
nick = split[3].lower()
|
||||
>>>>>>> develop
|
||||
else:
|
||||
if nick == input.nick:
|
||||
notice(u"I haven't seen you say anything here yet")
|
||||
nick = None
|
||||
|
||||
find = split[1]
|
||||
replace = split[2]
|
||||
|
||||
for item in conn.history[input.chan].__reversed__():
|
||||
name, timestamp, msg = item
|
||||
if msg.startswith("s/"):
|
||||
# don't correct corrections, it gets really confusing
|
||||
continue
|
||||
if nick:
|
||||
if nick != name.lower():
|
||||
continue
|
||||
if find in msg:
|
||||
if "\x01ACTION" in msg:
|
||||
msg = msg.replace("\x01ACTION ", "/me ").replace("\x01", "")
|
||||
message(u"Correction, <{}> {}".format(name, msg.replace(find, "\x02" + replace + "\x02")))
|
||||
return
|
||||
else:
|
||||
notice(u"I haven't seen {} say anything here yet".format(nick))
|
||||
continue
|
||||
|
||||
return u"Did not find {} in any recent messages.".format(find)
|
||||
|
||||
|
|
Reference in a new issue