Make 'account' arg for identify command optional

This commit is contained in:
jesopo 2018-09-29 10:51:16 +01:00
parent 3dbd997a90
commit c5a7978c9b

View file

@ -38,8 +38,8 @@ class Module(ModuleManager.BaseModule):
user.identified_account_override = None user.identified_account_override = None
user.identified_account_id_override = None user.identified_account_id_override = None
@Utils.hook("received.command.identify", private_only=True, min_args=2, @Utils.hook("received.command.identify", private_only=True, min_args=1,
usage="<account> <password>") usage="[account] <password>")
def identify(self, event): def identify(self, event):
""" """
Identify yourself Identify yourself
@ -57,8 +57,13 @@ class Module(ModuleManager.BaseModule):
return return
if not event["user"].identified_account_override: if not event["user"].identified_account_override:
if len(event["args_split"]) > 1:
account = event["args_split"][0] account = event["args_split"][0]
password = " ".join(event["args_split"][1:]) password = " ".join(event["args_split"][1:])
else:
account = event["user"].nickname
password = event["args"]
hash, salt = self._get_hash(event["server"], account) hash, salt = self._get_hash(event["server"], account)
if hash and salt: if hash and salt:
attempt, _ = self._make_hash(password, salt) attempt, _ = self._make_hash(password, salt)