Skip to content

Commit

Permalink
Merge pull request #1796 from CalvT/patch-1
Browse files Browse the repository at this point in the history
Sanitize other_user on coffee
  • Loading branch information
angussidney committed Mar 24, 2018
2 parents d212e61 + e2907c3 commit 7bdd50a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chatcommands.py
Expand Up @@ -399,6 +399,7 @@ def coffee(msg, other_user):
if other_user is None:
return "*brews a cup of {} for @{}*".format(random.choice(COFFEES), msg.owner.name.replace(" ", ""))
else:
other_user = regex.sub(r'^@*|\b\s.{1,}', '', other_user)
return "*brews a cup of {} for @{}*".format(random.choice(COFFEES), other_user)


Expand Down Expand Up @@ -428,6 +429,7 @@ def tea(msg, other_user):
if other_user is None:
return "*brews a cup of {} tea for @{}*".format(random.choice(TEAS), msg.owner.name.replace(" ", ""))
else:
other_user = regex.sub(r'^@*|\b\s.{1,}', '', other_user)
return "*brews a cup of {} tea for @{}*".format(random.choice(TEAS), other_user)


Expand Down Expand Up @@ -559,7 +561,7 @@ def welcome(msg, other_user):
"and posts alerts to chat. You can find more about me on the "
"[Charcoal website](https://charcoal-se.org/).")
if other_user is None:
return w_msg.format(room=msg.room.name, user="", me=GlobalVars.chatmessage_prefix)
raise CmdException(w_msg.format(room=msg.room.name, user="", me=GlobalVars.chatmessage_prefix))
else:
other_user = regex.sub(r'^@*|\b\s.{1,}', '', other_user)
raise CmdException(w_msg.format(room=msg.room.name, user=" @" + other_user, me=GlobalVars.chatmessage_prefix))
Expand Down

0 comments on commit 7bdd50a

Please sign in to comment.