Giter VIP home page Giter VIP logo

hangouts-bot's Introduction

Hangouts-Bot for Node.js

Very simple library that allows you to build chat builds with Node.js.

npm install hangouts-bot
var hangoutsBot = require("hangouts-bot");
var bot = new hangoutsBot("[email protected]", "password");

bot.on('online', function() {
	console.log('online');
});

bot.on('message', function(from, message) {
	console.log(from + ">> " + message);
});

More to come!

Shameless Plug

I hack around with Vim plugins, Node.js, Google Glass, and more. If any of that sounds interesting, follow me!

hangouts-bot's People

Contributors

denouche avatar jaxbot avatar jmrog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hangouts-bot's Issues

Work with groups

This may be a feature request but there is a way to make it work with hangouts groups?

As default it doesn't hears when a user type to a group.

Error: Cannot find module 'node-xmpp-core'

Hi

After i installed the module via npm install hangouts-bot there is still a module left.

var hangoutsBot = require('hangouts-bot');
var bot = new hangoutsBot(config.hangouts.email, config.hangouts.password);

I am running Windows and get the following error message:

λ node index.js
module.js:339
    throw err;
    ^

Error: Cannot find module 'node-xmpp-core'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at new module.exports (C:\Users\user\Repositories\.tmp\proj\node_modules\hangouts-bot\index.js:7:16)
    at Object.<anonymous> (C:\Users\user\Repositories\.tmp\proj\index.js:41:11)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)

XMPP authentication failure

Hello
When I run the example, it gives me this error

$ node example/example.js "[email protected]" "xxxxxxxxxxxx"
(node:12470) [DEP0107] DeprecationWarning: tls.convertNPNProtocols() is deprecated.
XMPP authentication failure

I checked the login and password, they definitely match and I can login in hangout

Lots of errors

I create a test script, but keep getting errors while running it. I tried installing node-stringprep, but the result was the same:
$ node test.js
Cannot load StringPrep-0.7.0 bindings (using fallback). You may need to npm install node-stringprep
createCredentials() is deprecated, use tls.createSecureContext instead
XMPP authentication failure
{ [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }

Update to use newer node-xmpp projects

It looks like node-xmpp-stanza is available as a separate package (not sure whether it was before), so that you can now require it directly rather than requiring node-xmpp-core in order to get access to it (as hangouts-bot does in index.js at line 7). In fact, newer versions of node-xmpp-core do not provide access to .Stanza.Element, which means that hangouts-bot will break with those versions. It would be nice to have hangouts-bot updated to work with the newer packages.

send message

I couldn't figure out sending messages. I tried the following

var hangoutsBot = require("hangouts-bot");
var bot = new hangoutsBot("xxxxx", "xxxx");

bot.on('online', function() {
console.log('online');
bot.sendMessage("[email protected]","testing from nodejs");

});

bot.on('message', function(from, message) {
console.log(from + ">> " + message);
});

How to fix XMPP authentication failure

Below is my code in nodejs.

var hangoutsBot = require("hangouts-bot");
const xmpp = require('node-xmpp');
var fs = require('fs');
var path = require('path');
var credentials = JSON.parse(fs.readFileSync(path.join(__dirname, "credentials.json")));

var bot = new hangoutsBot(credentials.email, credentials.password);

bot.on('online', function() {
	console.log('online');
});



bot.on('message', function(from, message) {
	console.log(from + ">> " + message);
});

bot.on('message', function(from, message) {
	console.log(from + ">> " + message);

	switch (message) {
		case "help":
			bot.sendMessage(from, "I an example Hangouts bot. Try saying hello.");
			break;
		case "hello":
			bot.sendMessage(from, "Why hello to you too.");
			break;
	}
});

Why i am getting authentication failure...despite of correct creds being used.Kindly help.?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.