Fix for !alts add with non-existing character

This commit is contained in:
2022-02-16 14:56:22 +01:00
parent d3461ef462
commit fd84d82af2
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -69,7 +69,7 @@ class AltsController:
main = self.account_service.get_main(request.sender.char_id)
for alt in alt_chars:
if not alt.char_id:
notfound.append(alt)
notfound.append(alt.name if type(alt) == SenderObj else alt)
continue
if main.char_id == alt.char_id:
failed.append(self.getresp("module/alts", "add_fail_self"))
@@ -86,9 +86,9 @@ class AltsController:
reply += self.getresp("module/alts", "add_success_self",
{"char": ", ".join(done)})
if len(notfound) > 0:
reply += "\n" + self.getresp("global", "char_not_found", {"char": ", ".join(notfound)})
reply += "\n" if reply != "" else '' + self.getresp("global", "char_not_found", {"char": ", ".join(notfound)})
if len(gotalts) > 0:
reply += "\n" + self.getresp("module/alts", "add_fail_already", {"char": ", ".join(gotalts)})
reply += "\n" if reply != "" else '' + self.getresp("module/alts", "add_fail_already", {"char": ", ".join(gotalts)})
reply += "\n".join(failed)
return reply