improved the leaderboard regex
This commit is contained in:
11
robopage.py
11
robopage.py
@@ -25,9 +25,14 @@ class RoboPage(discord.Client):
|
|||||||
attrs = filter(lambda n: n.endswith('Joke') and not n.startswith('Joke'), dir(jokes))
|
attrs = filter(lambda n: n.endswith('Joke') and not n.startswith('Joke'), dir(jokes))
|
||||||
attrs = map(lambda n: getattr(jokes, n)(), attrs)
|
attrs = map(lambda n: getattr(jokes, n)(), attrs)
|
||||||
self.jokes = list(attrs)
|
self.jokes = list(attrs)
|
||||||
self.most_regex = re.compile("^who is the most (?P<emoji>\w+)(?: in the past (?P<days>\d+) days)?\??$",
|
self.most_regex = re.compile(
|
||||||
re.IGNORECASE)
|
"^who is the most (?P<emoji>\w+)(?: in the past (?P<days>\d+) days)?\??$",
|
||||||
self.leaderboard_regex = re.compile('^most (?P<emoji>\w+) leaderboard$', re.IGNORECASE)
|
re.IGNORECASE
|
||||||
|
)
|
||||||
|
self.leaderboard_regex = re.compile(
|
||||||
|
'^most (?P<emoji>\w+)(?=(?:.+)?leaderboard)(?:.+(?P<days>\d+) days)?',
|
||||||
|
re.IGNORECASE
|
||||||
|
)
|
||||||
|
|
||||||
with Path('gifs.json').open('r') as file:
|
with Path('gifs.json').open('r') as file:
|
||||||
self.gifs = json.load(file)
|
self.gifs = json.load(file)
|
||||||
|
|||||||
Reference in New Issue
Block a user