From 699b85746ced130d9741870b6dc3bfd12e11e53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Ta=C5=9Fkaya?= <47358913+isidentical@users.noreply.github.com> Date: Sun, 20 Oct 2019 00:30:19 +0300 Subject: [PATCH] support gnu+thing --- bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 05fba97..f08fdfa 100644 --- a/bot.py +++ b/bot.py @@ -1,6 +1,7 @@ import argparse import asyncio import datetime +import itertools import json import random import re @@ -320,7 +321,11 @@ def msg_ping(match: Match[str]) -> Response: @handle_message(r'.*\b(nano|linux|windows|emacs)\b', flags=re.IGNORECASE) def msg_gnu_please(match: Match[str]) -> Response: msg, word = match[3], match[4] - if f'GNU/{word}' in msg or f'gnu/{word}' in msg: + cases = { + f'{gnu}{sep}{word}' + for gnu, sep in itertools.product(('gnu', 'GNU'), '/+') + } + if msg in cases: return MessageResponse(match, f'YES! GNU/{esc(word)}') else: return MessageResponse(match, f"Um please, it's GNU/{esc(word)}!")