Skip to content

Commit

Permalink
fix: treat wrong team inputs a bit better
Browse files Browse the repository at this point in the history
  • Loading branch information
maduck committed Jul 26, 2020
1 parent 758665e commit b1b91ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class DiscordBot(discord.Client):
{
'function': 'handle_team_code',
'pattern': re.compile(
r'.*?(?P<lang>en|fr|de|ru|it|es|cn)?(?P<shortened>-)?\[(?P<team_code>(\d+,?){1,13})\].*',
r'.*?(?P<lang>en|fr|de|ru|it|es|cn)?(?P<shortened>-)?\[(?P<team_code>(\d+,?){1,12})\].*',
re.IGNORECASE)
},
{
Expand Down
4 changes: 3 additions & 1 deletion team_expando.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def get_team_from_code(self, code, lang):
'troops_title': _('[TROOPS]', lang),
}
has_weapon = False
has_class = False

for element in code:
troop = self.troops.get(element)
Expand All @@ -221,6 +222,7 @@ def get_team_from_code(self, code, lang):
if _class:
result['class'] = _(_class['name'], lang)
result['class_talents'] = _class['talents']
has_class = True
continue

banner = self.banners.get(element)
Expand All @@ -233,7 +235,7 @@ def get_team_from_code(self, code, lang):
result['talents'].append(element)
continue

if has_weapon:
if has_weapon and has_class:
new_talents = []
for talent_no, talent_code in enumerate(result['talents']):
talent = '-'
Expand Down

0 comments on commit b1b91ea

Please sign in to comment.