Fix error when no email can be found

This commit is contained in:
Mark Veidemanis 2022-08-27 11:19:28 +01:00
parent d7adffb47f
commit 2c3d83fe9a
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
3 changed files with 9 additions and 6 deletions

View File

@ -1,7 +1,8 @@
from json import dumps
import main import main
from modules import chankeep from modules import chankeep
from modules import helpers
from json import dumps
class DedupCommand: class DedupCommand:
def __init__(self, *args): def __init__(self, *args):

View File

@ -1,6 +1,5 @@
import main import main
from modules import chankeep from modules import chankeep
from utils.logging.debug import debug from utils.logging.debug import debug

View File

@ -55,8 +55,7 @@ def substitute(net, num, token=None):
email = f"{alias['nickname']}@{domain}" email = f"{alias['nickname']}@{domain}"
gotemail = True gotemail = True
if not gotemail: if not gotemail:
error(f"Could not get email for {net} - {num}") inst["email"] = False
return False
nickname = alias["nick"] nickname = alias["nick"]
# username = nickname + "/" + net # username = nickname + "/" + net
password = main.network[net].aliases[num]["password"] password = main.network[net].aliases[num]["password"]
@ -73,7 +72,8 @@ def substitute(net, num, token=None):
inst[i] = inst[i].replace("{nickname}", nickname) inst[i] = inst[i].replace("{nickname}", nickname)
inst[i] = inst[i].replace("{curnick}", curnick) inst[i] = inst[i].replace("{curnick}", curnick)
inst[i] = inst[i].replace("{password}", password) inst[i] = inst[i].replace("{password}", password)
inst[i] = inst[i].replace("{email}", email) if gotemail:
inst[i] = inst[i].replace("{email}", email)
if token: if token:
inst[i] = inst[i].replace("{token}", token) inst[i] = inst[i].replace("{token}", token)
return inst return inst
@ -85,6 +85,9 @@ def registerAccount(net, num):
if not sinst: if not sinst:
error(f"Register account failed for {net} - {num}") error(f"Register account failed for {net} - {num}")
return return
if not sinst["email"]:
error(f"Could not get email for {net} - {num}")
return
if not sinst["register"]: if not sinst["register"]:
error("Cannot register for %s: function disabled" % (net)) error("Cannot register for %s: function disabled" % (net))
return False return False