Change handling of Tupperbox per-member tags

This commit is contained in:
Ske 2019-12-28 15:53:11 +01:00
parent 0f22285824
commit 54aa9fb7d7
2 changed files with 10 additions and 8 deletions

View File

@ -73,7 +73,7 @@ namespace PluralKit.Bot.Commands
"\n- PluralKit does not support member groups. Members will be imported without groups.";
if (res.HadIndividualTags)
issueStr +=
"\n- PluralKit does not support per-member system tags. Since you had multiple members with distinct tags, tags will not be imported. You can set your system tag using the `pk;system tag <tag>` command later.";
"\n- PluralKit does not support per-member system tags. Since you had multiple members with distinct tags, those tags will be applied to the members' *display names*/nicknames instead.";
var msg = await ctx.Reply($"{issueStr}\n\nDo you want to proceed with the import?");
if (!await ctx.PromptYesNo(msg)) throw Errors.ImportCancelled;

View File

@ -269,14 +269,15 @@ namespace PluralKit.Bot
string lastSetTag = null;
TupperboxConversionResult output = default(TupperboxConversionResult);
var members = Tuppers.Select(t => t.ToPluralKit(ref lastSetTag, ref output.HadIndividualTags,
ref output.HadGroups)).ToList();
// Nowadays we set each member's display name to their name + tag, so we don't set a global system tag
output.System = new DataFileSystem
{
Members = Tuppers.Select(t => t.ToPluralKit(ref lastSetTag, ref output.HadIndividualTags,
ref output.HadGroups)).ToList(),
Switches = new List<DataFileSwitch>(),
// If we haven't had multiple tags set, use the last (and only) one we set as the system tag
Tag = !output.HadIndividualTags ? lastSetTag : null
Members = members,
Switches = new List<DataFileSwitch>()
};
return output;
}
@ -291,7 +292,7 @@ namespace PluralKit.Bot
[JsonProperty("show_brackets")] public bool ShowBrackets;
[JsonProperty("birthday")] public string Birthday;
[JsonProperty("description")] public string Description;
[JsonProperty("tag")] public string Tag; // Not supported by PK
[JsonProperty("tag")] public string Tag;
[JsonProperty("group_id")] public string GroupId; // Not supported by PK
[JsonProperty("group_pos")] public int? GroupPos; // Not supported by PK
@ -321,7 +322,8 @@ namespace PluralKit.Bot
Birthday = Birthday,
Description = Description,
ProxyTags = tags,
KeepProxy = ShowBrackets
KeepProxy = ShowBrackets,
DisplayName = Tag != null ? $"{Name} {Tag}" : null
};
}
}