Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #25 from mart-w/testing
Browse files Browse the repository at this point in the history
Minor improvements.
  • Loading branch information
mart-w authored Jan 25, 2018
2 parents aee9eaa + e56f71d commit 616c2a1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions parrotbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@ async def search_message_by_quote(self, quote, partial=False):
):
if not match["author"] \
or await self.is_same_user(message.author, match["author"]):
if message.id.find(match["content"]) == 0 and not partial \
if not message.author.bot \
and not message.content.startswith(">") \
and (message.id.find(match["content"]) == 0 and not partial \
or re.search(
re.escape(match["content"]),
message.content,
flags=re.IGNORECASE
):
)):
return message

return None
Expand Down Expand Up @@ -474,10 +476,10 @@ async def on_ready(self):
"""
# Regular expression objects used to recognise quotes.
self.re_quote = re.compile(
r"(?P<author>.*)\s*>\s*(?P<content>.+)"
r"\s*(?P<author>(?:<.*?>)|(?:.*?))\s*>\s*(?P<content>.+)"
)
self.re_partial_quote = re.compile(
r"(?P<author>.*)\s*>>\s*(?P<content>.+)"
r"\s*(?P<author>(?:<.*?>)|(?:.*?))\s*>>\s*(?P<content>.+)"
)

# Regular expression object for user mention strings.
Expand Down

0 comments on commit 616c2a1

Please sign in to comment.