fix: handle edge-case regarding extra whitespace on char name

This commit is contained in:
11b 2022-12-21 16:15:49 -03:00
parent d638bb5625
commit e612386424
1 changed files with 3 additions and 3 deletions

View File

@ -184,7 +184,7 @@ const configureXHookIntercepts = () => {
let characterIdentifier;
if (res.finalUrl === CHARACTER_INFO_URL) {
characterIdentifier = data.character.name;
characterIdentifier = data.character.name.trim();
data.character.user__username = "[BOT_CREATOR_NAME_REDACTED]";
log(`Got character info for ${characterIdentifier}, caching...`);
@ -194,7 +194,7 @@ const configureXHookIntercepts = () => {
}
characterToSavedDataMap[characterIdentifier].info = data;
} else if (res.finalUrl === CHARACTER_HISTORIES_URL) {
characterIdentifier = data.histories[0].msgs[0].src.name;
characterIdentifier = data.histories[0].msgs[0].src.name.trim();
log(`Got chat histories for ${characterIdentifier}, caching...`);
if (!characterToSavedDataMap[characterIdentifier]) {
@ -203,7 +203,7 @@ const configureXHookIntercepts = () => {
characterToSavedDataMap[characterIdentifier].histories =
anonymizeHistories(data);
} else if (res.finalUrl === CHARACTER_EXTRA_INFO_URL) {
characterIdentifier = data.character.name;
characterIdentifier = data.character.name.trim();
data.user__username = "[BOT_CREATOR_NAME_REDACTED]";
data.character.user__username = "[BOT_CREATOR_NAME_REDACTED]";