Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connected to the server as undefined #17

Open
Kalo94 opened this issue Mar 23, 2021 · 0 comments
Open

Connected to the server as undefined #17

Kalo94 opened this issue Mar 23, 2021 · 0 comments

Comments

@Kalo94
Copy link

Kalo94 commented Mar 23, 2021

I keep getting “Connected to the server as undefined”, am I doing something wrong?

`
var Omegle = require('omegle-node');
var om = new Omegle();

om.on('omerror',function(err){
console.log('Error: ' + err);
});

om.on('recaptchaRequired',function(challenge){
//challenge is the link to the recaptcha image.
console.log(challenge);
//after solving the captcha, send the answer to omegle by calling
// om.solveReCAPTCHA(answer);
});

om.on('gotID',function(id){
console.log('Connected to server as: ' + id);
setTimeout(function(){
if(!om.connected()){
om.stopLookingForCommonLikes(); // or you could call om.slfcl()
console.log('Connecting to a random stranger instead...');
}
},5000);
});

om.on('waiting', function(){
console.log('Waiting for a stranger.');
});

om.on('serverUpdated',function(server){
console.log('Server updated to: ' + server);
});

om.on('connected',function(){
console.log('Connected');
om.startTyping();
setTimeout(function(){
om.stopTyping(); //It's better to check if you're still connected to the stranger when using setTimeout.
om.send('Hey there :D');
},3000);
});

om.on('gotMessage',function(msg){
console.log('Stranger: ' + msg);
});

om.on('commonLikes',function(likes){
console.log('Common likes: ' + likes);
});

om.on('typing',function(){
console.log('Stranger is typing...');
});

om.on('stoppedTyping',function(){
console.log('Stranger stopped typing.');
});

om.on('strangerDisconnected',function(){
console.log('Stranger has disconnected.');
});

om.on('disconnected',function(){
console.log('You have disconnected.');
});

var topics = ['bot'];
om.connect();

//call om.disconnect() before you call connect() again.
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant