Good morning ! I am new to Js and I code a twitch bot that would change the html code of a web page. For that I wrote these lines:
const element = document.getElementById(“1”)
if (commandName === ‘!1’) {
element.InnerHTML = “2”;
console.log(* Executed ${commandName} command
);
}
Except that my console displays this ReferenceError: document is not defined
What to do ? Thank you
If your bot is running as a process there is not document
If your bot is runningin the browser there is a document.
Sounds like your bot isn’t running in a browser?
My bot is running on my Pc with the terminal
My index.js is in the forlder like to my html
Then there isn’t a document to talk to
Hence the issue.
if you want a bot command to talk to a web page.
You’ll need to devise a way for the bot to communicate/control the webpage.
Do you know how to do that ?
There are many ways to do this.
So yes I do.
do you have link please ? Thank you !
Not really no.
Theres too many “what if’s” involved to say just go use x solution or y solution
system
Closed
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.