mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Even more enum refactorings (not done yet)
- Add common enum icons - enum def for existing enum types, with color description
This commit is contained in:
@@ -230,6 +230,17 @@ export async function getGroupChat(groupId, reload = false) {
|
||||
await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the members of a group
|
||||
*
|
||||
* @param {string} [groupId=selected_group] - The ID of the group to retrieve members from. Defaults to the currently selected group.
|
||||
* @returns {import('../script.js').Character[]} An array of character objects representing the members of the group. If the group is not found, an empty array is returned.
|
||||
*/
|
||||
export function getGroupMembers(groupId = selected_group) {
|
||||
const group = groups.find((x) => x.id === groupId);
|
||||
return group?.members.map(member => characters.find(x => x.avatar === member)) ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the character ID for a group member.
|
||||
* @param {string} arg 1-based member index or character name
|
||||
|
Reference in New Issue
Block a user