Set active character for /random

This commit is contained in:
Cohee 2024-03-26 18:30:12 +02:00
parent 90e66e7782
commit 4e7cd6d63b

View File

@ -21,6 +21,8 @@ import {
saveChatConditional,
setAnimationDuration,
ANIMATION_DURATION_DEFAULT,
setActiveGroup,
setActiveCharacter,
} from '../script.js';
import { isMobile, initMovingUI, favsToHotswap } from './RossAscends-mods.js';
import {
@ -2302,6 +2304,8 @@ async function doRandomChat() {
resetSelectedGroup();
const characterId = Math.floor(Math.random() * characters.length).toString();
setCharacterId(characterId);
setActiveCharacter(characters[characterId]?.avatar);
setActiveGroup(null);
await delay(1);
await reloadCurrentChat();
return characters[characterId]?.name;