-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Substitua a parte do script (e use o mesmo roteiro):
async function enviarScript(scriptText){
const lines = scriptText.split(/[\n\t]+/).map(line => line.trim()).filter(line => line);
const main = document.querySelector("#main");
if(!main) throw new Error("Painel principal não encontrado");
const textarea = main.querySelector(`div[contenteditable="true"]`);
if(!textarea) throw new Error("Não há uma conversa aberta");
console.log(`Iniciando envio de ${lines.length} linhas...`);
for(const line of lines){
console.log("Escrevendo:", line);
textarea.focus();
document.execCommand('insertText', false, line);
// Essencial: Dispara o evento 'input' para o React reconhecer o texto e mudar o ícone de microfone para o de enviar
textarea.dispatchEvent(new Event('input', {bubbles: true}));
// Aguarda a renderização do botão na interface
await new Promise(resolve => setTimeout(resolve, 100));
// Seletor atualizado com base no elemento inspecionado
const sendBtn = main.querySelector(`span[data-icon="wds-ic-send-filled"]`);
if(sendBtn){
sendBtn.click();
} else {
console.error("Botão de enviar não encontrado (o ícone não mudou?)");
}
if(lines.indexOf(line) !== lines.length - 1) await new Promise(resolve => setTimeout(resolve, 250));
}
return lines.length;
}
enviarScript(`
*** COLE TODO O ROTEIRO NESSE ESPAÇO ***
).then(e => console.log(Código finalizado, ${e} mensagens enviadas`)).catch(console.error)
Metadata
Metadata
Assignees
Labels
No labels