Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/alain/alain3.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def lol(self, mask=None, channel=None, data=None):

@irc3.event(
r":(?P<mask>\S+) PRIVMSG {channel} :"
r".*\s(faudrai.|faut|ca serait bien que)\s+qu.*"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi enlever ce \s ? Il a du sens pour moi, pour éviter des faux positifs comme "arguments par défaut qui sont None"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je me dis qu'une alternative, si on veut reconnaître "faut que..." après un espace mais aussi en début de ligne, serait de mettre \b (frontière de mot) avant le motif.

\b Matches the empty string, but only at the beginning or end of a word.

https://docs.python.org/3/library/re.html

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vendu pour \b. Tu as raison ça règle plein de cas, comme (faut que qu'on merge ça).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai pas encore eu l'occasion de m'en occuper, je fais ça plus tard.

r".*(faudrai.|faut|[scç]a serai.? bien)\s+qu.*"
)
def yakafokon(self, mask=None, channel=None, data=None):
message = "WARNING !!! YAKAFOKON DETECTED !!!!"
Expand Down