Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script para Adele Hello #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions adelehelloSendScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
async function enviarScript(scriptText){
const lines = scriptText.split(/[\n\t]+/).map(line => line.trim()).filter(line => line);
main = document.querySelector("#main"),
textarea = main.querySelector(`div[contenteditable="true"]`)

if(!textarea) throw new Error("Não há uma conversa aberta")

for(const line of lines){
console.log(line)

textarea.focus();
document.execCommand('insertText', false, line);
textarea.dispatchEvent(new Event('change', {bubbles: true}));

setTimeout(() => {
(main.querySelector(`[data-testid="send"]`) || main.querySelector(`[data-icon="send"]`)).click();
}, 100);

if(lines.indexOf(line) !== lines.length - 1) await new Promise(resolve => setTimeout(resolve, 250));
}

return lines.length;
}

enviarScript(`
Hello, it's me
I was wondering if after all these years you'd like to meet
To go over everything
They say that time's supposed to heal ya, but I ain't done much healing
Hello, can you hear me?
I'm in California dreaming about who we used to be
When we were younger and free
I've forgotten how it felt before the world fell at our feet
There's such a difference between us
And a million miles
Hello from the other side
I must've called a thousand times
To tell you I'm sorry for everything that I've done
But when I call, you never seem to be home
Hello from the outside
At least I can say that I've tried
To tell you I'm sorry for breaking your heart
But it don't matter, it clearly doesn't tear you apart anymore
Hello, how are you?
It's so typical of me to talk about myself, I'm sorry
I hope that you're well
Did you ever make it out of that town where nothing ever happened?
It's no secret that the both of us
Are running out of time
So hello from the other side (other side)
I must've called a thousand times (thousand times)
To tell you I'm sorry for everything that I've done
But when I call, you never seem to be home
Hello from the outside (outside)
At least I can say that I've tried (I've tried)
To tell you I'm sorry for breaking your heart
But it don't matter, it clearly doesn't tear you apart anymore
Ooh (lows, lows, lows, lows), anymore
(Highs, highs, highs, highs)
Ooh (lows, lows, lows, lows), anymore
(Highs, highs, highs, highs)
Ooh (lows, lows, lows, lows), anymore
(Highs, highs, highs, highs)
Anymore (lows, lows, lows, lows)
Hello from the other side (other side)
I must've called a thousand times (thousand times)
To tell you I'm sorry for everything that I've done
But when I call, you never seem to be home
Hello from the outside (outside)
At least I can say that I've tried (I've tried)
To tell you I'm sorry for breaking your heart
But it don't matter, it clearly doesn't tear you apart anymore
`).then(e => console.log(`Código finalizado, ${e} mensagens enviadas`)).catch(console.error)