@arg_botcmd('user', type=str, admin_only=True, template='otp_secret_create')
def otp_secret_create(self, message, user=None):
    '\n\t\tSend a new secret for a user.\n\t\t'
    secret = pyotp.random_base32()
    with self.lock:
        with self.stored('secrets') as secrets:
            secrets[user] = (secret, 0, _BASE_TIME)
    totp = pyotp.TOTP(secret)
    url = totp.provisioning_uri(user)
    self.build_qrcode(user, url)
    if self.config:
        if self.config.get('provision_via_chat'):
            f = open('{0}{1}-qrcode.png'.format(self.DATA_DIR, user), 'rb')
            self.send_stream_request(self.build_identifier(user), f, name='OTP-secret.png')
            self.send_templated(self.build_identifier(user), 'otp_secret_create_pm', dict(url=url))
            return dict(chat_enrollment=True, user=user)
    return dict(chat_enrollment=False, user=user)
Send a new secret for a user.
@arg_botcmd('user', type=str, admin_only=True, template='otp_secret_create')
def otp_secret_create(self, message, user=None):
    '\n\t\t\n\t\t'
    secret = pyotp.random_base32()
    with self.lock:
        with self.stored('secrets') as secrets:
            secrets[user] = (secret, 0, _BASE_TIME)
    totp = pyotp.TOTP(secret)
    url = totp.provisioning_uri(user)
    self.build_qrcode(user, url)
    if self.config:
        if self.config.get('provision_via_chat'):
            f = open('{0}{1}-qrcode.png'.format(self.DATA_DIR, user), 'rb')
            self.send_stream_request(self.build_identifier(user), f, name='OTP-secret.png')
            self.send_templated(self.build_identifier(user), 'otp_secret_create_pm', dict(url=url))
            return dict(chat_enrollment=True, user=user)
    return dict(chat_enrollment=False, user=user)