Unbust user continue in group chats
This commit is contained in:
parent
e8742a3e9d
commit
7450112e9b
|
@ -860,9 +860,31 @@ function activateImpersonate(members) {
|
|||
return memberIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates a group member based on the last message.
|
||||
* @param {string[]} members Array of group member avatar ids
|
||||
* @returns {number[]} Array of character ids
|
||||
*/
|
||||
function activateSwipe(members) {
|
||||
let activatedNames = [];
|
||||
|
||||
if (chat[chat.length - 1].is_user) {
|
||||
for (const message of chat.slice().reverse()) {
|
||||
if (message.is_system || message.is_user) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (message.original_avatar) {
|
||||
activatedNames.push(message.original_avatar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (activatedNames.length === 0) {
|
||||
activatedNames.push(shuffle(members.slice())[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// pre-update group chat swipe
|
||||
if (!chat[chat.length - 1].original_avatar) {
|
||||
const matches = characters.filter(x => x.name == chat[chat.length - 1].name);
|
||||
|
|
Loading…
Reference in New Issue