Skip to content

Instantly share code, notes, and snippets.

@a13ks3y
Last active May 18, 2023 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a13ks3y/ed4b751832d5bc7a9931694218fd513c to your computer and use it in GitHub Desktop.
Save a13ks3y/ed4b751832d5bc7a9931694218fd513c to your computer and use it in GitHub Desktop.
Very basic ChatGPT autoresponder.
function loop() {
if (loop.__lock) return; loop.__lock = true;
const btnEl = document.querySelector('button.absolute');
const inputEl = document.querySelector('#prompt-textarea');
const responseEl = document.querySelector("#__next > div.overflow-hidden.w-full.h-full.relative.flex.z-0 > div.relative.flex.h-full.max-w-full.flex-1.overflow-hidden > div > main > div.flex-1.overflow-hidden > div > div > div > div:nth-last-child(2)");
const response = responseEl ? responseEl.textContent : 'Sorry got distracted, where did we stop?';
const isItAQuestion = /(.*)\?/gi.test(response);
const request = isItAQuestion ? response : 'Ask me a question, according to my previous reply:\n\n' + response;
inputEl.value = request;
btnEl.removeAttribute('disabled');
btnEl.click();
setTimeout(() => loop.__lock = false, 60000);
if (isNaN(loop.__interval)) loop.__interval = setInterval(loop, 66666);
console.log('To stop it run:', 'clearInterval(loop.__interval)', 'or just reload the page');
}
@a13ks3y
Copy link
Author

a13ks3y commented May 18, 2023

This is just example of how to implement an infinite loop of noncence.
Just copy paste it to the javascript console while you on ChatGPT tab and call loop() when you ready.
Use it on own risk, openai could ban your account for using such approach, this exmple is just a proof-of-concept, please use official API if you need something more complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment