Also recognize numX to award more pancake points
This commit is contained in:
parent
7267d03ddd
commit
896e1927a5
1 changed files with 10 additions and 0 deletions
|
@ -9,6 +9,7 @@ import json
|
|||
from typing import Dict, Set
|
||||
import mattermost
|
||||
import mattermost.ws
|
||||
import re
|
||||
|
||||
SERVER = "mattermost.zeus.gent"
|
||||
TEAM_NAME = "zeus"
|
||||
|
@ -64,6 +65,7 @@ def first(iterable, default=None):
|
|||
return x
|
||||
return default
|
||||
|
||||
NUMBER_EMOJI_NAMES = "zero,one,two,three,four,five,six,seven,eight,nine,keycap_ten".split(",")
|
||||
|
||||
##################################
|
||||
# Log in
|
||||
|
@ -141,6 +143,14 @@ def reaction_qualifies(reaction):
|
|||
return 1
|
||||
if reaction["emoji_name"] == DOUBLE_EMOJI_NAME:
|
||||
return 2
|
||||
m = re.fullmatch(r"num([0-9]+)", reaction["emoji_name"])
|
||||
if m:
|
||||
return int(m.group(1))
|
||||
try:
|
||||
i = NUMBER_EMOJI_NAMES.index(reaction["emoji_name"])
|
||||
return i
|
||||
except ValueError:
|
||||
pass
|
||||
return 0
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue