Add a way of appending a comment on an API key, to denote what it's for.

This commit is contained in:
jesopo 2018-11-11 09:02:48 +00:00
parent b06eff217f
commit b8e6bfd5e5

View file

@ -108,9 +108,13 @@ class Module(ModuleManager.BaseModule):
def api_key(self, event): def api_key(self, event):
""" """
:help: Generate a new API key :help: Generate a new API key
:usage: [comment]
:permission: api-key :permission: api-key
:prefix: APIKey :prefix: APIKey
""" """
api_key = str(uuid.uuid4()) api_key = str(uuid.uuid4())
if event["args_split"]:
api_key = "%s-%s" % (event["args_split"][0], api_key)
self.bot.set_setting("api-key-%s" % api_key, True) self.bot.set_setting("api-key-%s" % api_key, True)
event["stdout"].write(api_key) event["stdout"].write(api_key)