yt-bot.js
v2.2.4
Published
Welcome to youtube-bot.js! ========================== This is a package made designed to make a youtube bot for live streams ========================== ### Features - **Message Event** Track messages sent by users in the live stream - **Channel Id finder*
Readme
Welcome to youtube-bot.js!
This is a package made designed to make a youtube bot for live streams
Features
- Message Event Track messages sent by users in the live stream
- Channel Id finder Automatically find channel id's by simply using their username (they have to have sent a message in the stream)
- Token Refresher Automatically Refresh your access_token with tokenRefresh()
If you need more support/track new features join my server https://discord.gg/q37dyyMuwz
Using the package
- Heres a basic setup of the package in index.js
const { YouTubeClient } = require('yt-bot.js');
const prefix = '.'
const client = new YouTubeClient({
credentials: './credentials.json',
tokens: './tokens.json',
prefix: prefix
});
client.on('ready', async () => {
console.log(`Logged in as ${client.name}!`)
await client.join('STREAM_ID');
})
client.tokenRefresh().then(() => {
client.initialize();
})- there are 3 supported types for credentials/tokens
supported version 1
const client = new YouTubeClient({
credentials: './credentials.json',
tokens: './tokens.json',
});supported version 2
const client = new YouTubeClient({
credentials: {
client_id: 'your-client-id',
client_secret: 'your-client-secret',
redirect_uris: ['http://localhost'],
},
tokens: { access_token: '...', refresh_token: '...' },
});supported version 3
const client = new YouTubeClient({
credentials: '{"client_id":"your-client-id","client_secret":"your-client-secret","redirect_uris":["http://localhost"]}',
tokens: '{"access_token":"...","refresh_token":"..."}',
});- And here is a basic example of a command which is automatically handled by the package
client.command({
name: 'hi',
response: 'hello'
})
client.command({
name: 'hi',
execute: async () => {
client.send('hi')
}
})- Heres a simple example of the message event
client.onMessage(async (data) => {
console.log(`${data.author.displayName}: ${data.content}`);
});- You can also send messages by using the send() function
client.send('Hello, world!')