betty2 / example copy.js
sdgsdggds's picture
Upload folder using huggingface_hub
e7c953d verified
// Simple example of using the DubAPI library
const DubAPI = require('./index.js');
console.log('Starting DubAPI example...');
// Replace with your queup.net credentials
const username = 'kuber';
const password = 'cookTV12';
// Replace with the room you want to connect to
const roomName = 'nononono';
console.log('Attempting to create DubAPI instance with username:', username);
console.log('Connecting to room:', roomName);
new DubAPI({username: username, password: password}, function(err, bot) {
if (err) return console.error('Error connecting:', err);
console.log('Running DubAPI v' + bot.version);
function connect() {
console.log('Attempting to connect to room:', roomName);
bot.connect(roomName);
}
bot.on('connected', function(name) {
console.log('Connected to ' + name);
});
bot.on('disconnected', function(name) {
console.log('Disconnected from ' + name);
console.log('Attempting to reconnect in 15 seconds...');
setTimeout(connect, 15000);
});
bot.on('error', function(err) {
console.error('Error:', err);
});
bot.on(bot.events.chatMessage, function(data) {
console.log(data.user.username + ': ' + data.message);
});
// Connect to the room
connect();
});