I’m trying to figure out how to launch a website from a discord bot written in javascript and this is the first time I’m experimenting with online communication. The html is local but I’m using the youtube url as a test url.
Google is suggesting window.open() but with trying that seems to be with a client side javascript file that already is viewing a website.
Is there a resource or library specific to open a browser? I’m still farely new to javascript and still getting used to npm and node and eventually using the website to send requests to discord.
Current Code:
require('dotenv').config();
const { Client, IntentsBitField } = require('discord.js');
const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent
]
});
client.on('ready', (c) => {
//Thing I'm trying to open on launch
window.open("https://www.youtube.com/", "_blank");
const generalChannel = client.channels.cache.get(process.env.CHANNEL_ID);
generalChannel.send(`${c.user.displayName} is online`);
console.log(c.user.tag + ' is online');
})
//For use later on another project
client.on('messageCreate', (message)=>{
});
client.login(process.env.TOKEN);