diff --git a/groupchatbot/bot.py b/groupchatbot/bot.py index 07e23e7..d2318b8 100644 --- a/groupchatbot/bot.py +++ b/groupchatbot/bot.py @@ -11,6 +11,7 @@ PASS = '34a77e61000b2ba1f56201332ef64d93f9cdc60e63ab48bc255102586ef7e592' WRONG_LOGIN_BAN_DURATION = 30 USERS_NAME = "hswroconference:users" BANNED_NAME = "hswroconference:banned" +ALLOWED_NAME_CHARS = ['_', '-', '/'] # this + .isalnum() def check_password(password: str) -> bool: @@ -40,7 +41,7 @@ def check_banned(r, userhash): def check_name(username: str) -> bool: if len(username) >= 16: return False - return all(map(lambda c: c.isalnum(), username)) + return all(map(lambda c: c.isalnum() or c in ALLOWED_NAME_CHARS, username)) def handle_login(msg, r, from_known_sender, known_senders: Iterable): @@ -94,7 +95,7 @@ def handle_whoami(msg, _, from_known_sender, known_senders: Iterable): assert False -def handle_help(msg, _, __, ___): +def handle_help(msg, _=None, __=None, ___=None): msg.reply("""Supported commands: /login [NICK] [PASSWORD] - Logs user in. Partyline messages will be sent. /logout - Logs user out. Partyline messages will stop.