Added ability to apply profile to several characters

This commit is contained in:
RisaDev
2024-10-19 02:55:38 +03:00
parent 3ff5806322
commit 7085cf616c
14 changed files with 324 additions and 164 deletions

View File

@@ -183,10 +183,10 @@ public class CommandService : IDisposable
if (!isTurningOffAllProfiles)
{
profileName = subArgumentList[1].Trim();
targetProfile = _profileManager.Profiles.FirstOrDefault(x => x.Name == profileName && x.Character.ToNameWithoutOwnerName() == characterName);
targetProfile = _profileManager.Profiles.FirstOrDefault(x => x.Name == profileName && x.Characters.Any(x => x.ToNameWithoutOwnerName() == characterName));
}
else
targetProfile = _profileManager.Profiles.FirstOrDefault(x => x.Character.ToNameWithoutOwnerName() == characterName && x.Enabled);
targetProfile = _profileManager.Profiles.FirstOrDefault(x => x.Characters.Any(x => x.ToNameWithoutOwnerName() == characterName) && x.Enabled);
if (targetProfile == null)
{
@@ -225,7 +225,7 @@ public class CommandService : IDisposable
.AddText(" was successfully ")
.AddBlue(state != null ? ((bool)state ? "enabled" : "disabled") : "toggled")
.AddText(" for ")
.AddRed(targetProfile.Character.ToNameWithoutOwnerName()).BuiltString);
.AddRed(string.Join(',', targetProfile.Characters.Select(x => x.ToNameWithoutOwnerName()))).BuiltString);
}
catch (Exception e)
{

View File

@@ -68,7 +68,7 @@ public class SupportLogBuilderService
sb.Append($"> > **`{profile.ToString(),-32}`*\n");
sb.Append($"> > **`Name: `** {profile.Name.Text.Incognify()}\n");
sb.Append($"> > **`Type: `** {profile.ProfileType} \n");
sb.Append($"> > **`Character name: `** {profile.Character.Incognito(null)}\n");
sb.Append($"> > **`Characters: `** {string.Join(',', profile.Characters.Select(x => x.Incognito(null)))}\n");
sb.Append($"> > **`Templates:`**\n");
sb.Append($"> > > **`Count: `** {profile.Templates.Count}\n");
foreach (var template in profile.Templates)