Coder Social home page Coder Social logo

lmammino / norrisbot Goto Github PK

View Code? Open in Web Editor NEW
135.0 8.0 104.0 3.41 MB

a Slack bot that kicks asses (roundhouse-kicks to be accurate...)

Home Page: https://scotch.io/tutorials/building-a-slack-bot-with-node-js-and-chuck-norris-super-powers

License: MIT License

JavaScript 99.86% Shell 0.14%
norrisbot chuck-norris kicks-asses jokes bot bots slack slack-bot tutorial tutorials

norrisbot's Introduction

norrisbot

CircleCI npm version codecov Known Vulnerabilities

Make your team hyper-productive with cutting Chuck Norris jokes

The NorrisBot is a Slack bot that kicks asses, roundhouse-kicks to be precise... It's super-powered with Chuck Norris jokes and it aims to make your Slack channel even more "slacker" and enjoyable.

Chuck Norris face

NorrisBot is loaded with guns and jokes about Chuck Norris and it will tell a random joke every time that someone says “Chuck Norris” or "norrisbot" in a slack channel.

Norrisbot in action

Installation

As simple as installing any other global node package. Be sure to have npm and node (>= 4.3.2 version) installed and launch:

$ npm install -g norrisbot

Alternative Installation (binaries)

From release 2.0.3, every release comes also with dependency-free binaries for linux, mac and windows that can be downloaded in the Releases page on GitHub.

Running the NorrisBot

To run the NorrisBot you must have a valid Slack BOT token to authenticate the bot on your slack organization. Once you get it (instructions on the next paragraph) you just have to run:

NORRISBOT_TOKEN=somesecretkey norrisbot

Once the bot is up and running, you need to invite him into the channels you want it to be available in.

Getting the BOT token for your Slack channel

To allow the NorrisBot to connect your Slack channel you must provide him a BOT token. To retrieve it you need to add a new Bot in your Slack organization by visiting the following url: https://yourorganization.slack.com/services/new/bot, where yourorganization must be substituted with the name of your organization (e.g. https://loige.slack.com/services/new/bot). Ensure you are logged to your Slack organization in your browser and you have the admin rights to add a new bot.

You will find your BOT token under the field API Token, copy it in a safe place and get ready to use it.

As an alternative you can create a bot by creating a custom application in the Slack developer portal. Inside the application settings you will be able to add a bot user and retrieve a OAUTH BOT token for it.

Configuration

The NorrisBot is configurable through environment variables. There are several variable available:

Environment variable Description
NORRISBOT_TOKEN The Slack Bot User OAuth Access Token for your organisation/team (mandatory)
NORRISBOT_TRIGGERS A coma separated list of words that triggers the bot to reply with a joke (default: "Chuck Norris,norrisbot")
NORRISBOT_CATEGORIES A coma separated list to enable special joke categories like "explicit" and "nerdy" (default: "nerdy")
NORRISBOT_NO_PICTURES If set to TRUE will disable pictures in jokes (default: FALSE)
NORRISBOT_MESSAGE_COLOR The hex color used by the bot to mark it's messages (default: "#590088")

Installing on Heroku

A great place where to deploy our lovely NorrisBot is Heroku. We can go reasonably well with their free worker tier and the deploy process is reasonably easy and convenient. Let’s see how we can do that.

I am assuming you already have and account on Heroku and that you have installed and configured the Heroku toolbelt on your machine.

1. Create a new Heroku app

Create a local folder and install norrisbot on it:

mkdir norrisbot-myorg
cd norrisbot-myorg
npm init -y
npm i --save norrisbot

Then create a new app on heroku:

heroku create norrisbot-myorg

2. Configure your Heroku app:

heroku config:set --app norrisbot-myorg NORRISBOT_TOKEN=xoxb-YOUR-AWESOME-BOT-TOKEN

(of course you need to replace xoxb-YOUR-AWESOME-BOT-TOKEN with your actual token).

You can add extra configuration by defining values for the other supported environment variables if you want to customize the behavior of the bot.

3. Initialize your Heroku app

Create an Heroku Procfile (service definition)

echo "worker: node_modules/.bin/norrisbot" >> Procfile

Then prepare the project to be published through git:

git init
echo "node_modules/" >> .gitignore
git add --all
git commit -am "first version"
heroku git:remote --app norrisbot-myorg

4. Publish and launch the Heroku app

Through heroku git

git push heroku master

Stop the web app (not present but started by default by Heroku) and run the worker:

heroku ps:scale web=0 worker=1

That's it, now go on your Slack organization and start enjoying Chuck Norris jokes! 😂

Building the bot from source

If you downloaded the source code of the bot you can build the bot with

npm run build

Then you can run it with:

$ npm start

Don't forget to set your NORRISBOT_TOKEN environment variable bedore doing so and to install all the dependencies (including dev ones with NPM or Yarn).

Bugs and improvements

If you find a bug or have an idea about how to improve the NorrisBot you can open an issue or submit a pull request, it will definitely make you a better person! :P

The Making of

Version 1 of NorrisBot has been developed in collaboration with Scotch.io. A very detailed article has been published to explain every single line of code. It also explains you how to deploy the bot on a free Heroku instance, so you should give it a shot!

Building a Slack Bot with Node.js and Chuck Norris Super Powers

Enjoy your reading!

License

Licensed under MIT License. © Luciano Mammino.

norrisbot's People

Contributors

lmammino avatar snyk-bot 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

norrisbot's Issues

NorrisBot id Issue

Hiya,

I've pulled down the latest master of the repo and got get the following issue:

TypeError: Cannot read property 'id' of undefined
at Constructor.NorrisBot._isFromNorrisBot (/usr/local/lib/node_modules/norrisbot/lib/norrisbot.js:184:38)
at Constructor.NorrisBot._onMessage (/usr/local/lib/node_modules/norrisbot/lib/norrisbot.js:61:15)
at emitOne (events.js:96:13)
at Constructor.emit (events.js:188:7)
at Constructor. (/usr/local/lib/node_modules/norrisbot/node_modules/slackbots/index.js:62:18)
at emitTwo (events.js:106:13)
at WebSocket.emit (events.js:191:7)
at Receiver.ontext (/usr/local/lib/node_modules/norrisbot/node_modules/ws/lib/WebSocket.js:841:10)
at /usr/local/lib/node_modules/norrisbot/node_modules/ws/lib/Receiver.js:536:18
at Receiver.applyExtensions (/usr/local/lib/node_modules/norrisbot/node_modules/ws/lib/Receiver.js:371:5)

I've tried to get around it, but not having much luck. Your guide is awesome, I'm trying to modify it to basically build the foundations of some ChatOps I'm doing.

message.channel[0] = D instead of C

I am following your tutorial, and in _isChannelConversation function, when I print the message.channel[0] , it is showing D instead of C. Can, you please tell me how to fix this.

Cannot read property 'id' of undefined, I am getting this error during run. Mac El Capitan. My Bot (not Chuck Norris) turns on but chuck norris doesn't reply on anything and it is shown offline

TypeError: Cannot read property 'id' of undefined
at Constructor.NorrisBot._isFromNorrisBot (/Users/dlambor/norrisbot-master/lib/norrisbot.js:184:38)
at Constructor.NorrisBot._onMessage (/Users/dlambor/norrisbot-master/lib/norrisbot.js:61:15)
at emitOne (events.js:96:13)
at Constructor.emit (events.js:188:7)
at Constructor. (/Users/dlambor/norrisbot-master/node_modules/slackbots/index.js:59:18)
at emitTwo (events.js:106:13)
at WebSocket.emit (events.js:191:7)
at Receiver.ontext (/Users/dlambor/norrisbot-master/node_modules/ws/lib/WebSocket.js:797:10)
at /Users/dlambor/norrisbot-master/node_modules/ws/lib/Receiver.js:473:18
at Receiver.applyExtensions (/Users/dlambor/norrisbot-master/node_modules/ws/lib/Receiver.js:360:5)

NorrisBot is not working with nodeJS 4.2.6

I was trying out the example on this post: https://scotch.io/tutorials/building-a-slack-bot-with-node-js-and-chuck-norris-super-powers

When I ran the bot, I got the following error:
TypeError: Class constructors cannot be invoked without 'new'
at Constructor.Bot (/home/noberto/workspaces/norrisbot/node_modules/slackbots/index.js:16:17)
at Constructor.NorrisBot.run (/home/noberto/workspaces/norrisbot/lib/norrisbot.js:24:20)
at Object. (/home/noberto/workspaces/norrisbot/bin/bot.js:17:11)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

After a brief research, I found that that way of inheritance is not supported on ES6. Before changing anything else, I cloned this repo and it was working. I checked the differences and found that the package.json specifies a different Engine >=0.10 . I'm not sure if that's the problem but when I run my code with the package.json on this repository, the error is not being shown.

Is that an expected behavior? Should I rewrite the entire code of my bot to use classes and extension?

Thanks!

Unexpected identifier with db

I've been trying to run the bot, I've followed the tutorial on Scotch.io, I tried copying the '.db' file in my '/data/' folder but also using the generator but I keep getting 'unexpected identifier:

/Users/huascar/Projects/cabify/slack_bot_practice/chuck_norris_bot/data/norrisbot.db:1
(function (exports, require, module, __filename, __dirname) { SQLite format 3
                                                                     ^^^^^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (module.js:613:28)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)

onMessage not working for channels

The _onMessage method only seems to be trigger when direct messaging to the norrisBot.
But it seems not to be trigger talking in a channel. (for example #general)

npm install -g norrisbot fails

Logs

$ npm install -g norrisbot
/usr/local/bin/norrisbot -> /usr/local/lib/node_modules/norrisbot/bin/bot.js

[email protected] install /usr/local/lib/node_modules/norrisbot/node_modules/bufferutil
node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
In file included from ../src/bufferutil.cc:16:
../../nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local NanEnsureLocal(v8::Local val) {
^
../../nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local NanEnsureLocal(v8::Handle val) {
^
../../nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
, node::smalloc::FreeCallback callback
~~~~~~^
../../nan/nan.h:672:12: error: no matching function for call to 'New'
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^~~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate,
^
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char ') would lose const qualifier
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate
isolate,
^
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, size_t length);
^
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate,
^
In file included from ../src/bufferutil.cc:16:
../../nan/nan.h:676:12: error: no viable conversion from returned value of type 'v8::MaybeLocalv8::Object' to function return type 'v8::Localv8::Object'
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocalv8::Object' to 'const v8::Localv8::Object &' for 1st argument
class Local {
^
/Users/username/.node-gyp/5.5.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocalv8::Object' to 'v8::Localv8::Object &&' for 1st argument
/Users/username/.node-gyp/5.5.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
V8_INLINE Local(Local that)
^
/Users/username/.node-gyp/5.5.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S ' against 'v8::MaybeLocalv8::Object'
V8_INLINE Local(S
that)
^
In file included from ../src/bufferutil.cc:16:
../../nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
~~~~~~~~~~~~~~^
In file included from ../src/bufferutil.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
(static_cast<T volatile
>(0)) = static_cast<S
>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Localv8::Primitive::Localv8::Value' requested here
return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

In file included from ../src/bufferutil.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Boolean volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T
volatile_>(0)) = static_cast<S_>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Localv8::Boolean::Localv8::Value' requested here
return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

In file included from ../src/bufferutil.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Function volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T
volatile_>(0)) = static_cast<S_>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Localv8::Function::Localv8::Value' requested here
return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

In file included from ../src/bufferutil.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Object volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T
volatile_>(0)) = static_cast<S_>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Localv8::Object::Localv8::Value' requested here
return NanEscapeScope(handle->Get(NanNew(key)).Asv8::Object());
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

9 errors generated.
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.4.0
gyp ERR! command "/usr/local/Cellar/node/5.5.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/norrisbot/node_modules/bufferutil
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: node-gyp rebuild
npm WARN install:[email protected] Exit status 1

[email protected] install /usr/local/lib/node_modules/norrisbot/node_modules/utf-8-validate
node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

CXX(target) Release/obj.target/validation/src/validation.o
In file included from ../src/validation.cc:15:
../../nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local NanEnsureLocal(v8::Local val) {
^
../../nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local NanEnsureLocal(v8::Handle val) {
^
../../nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
, node::smalloc::FreeCallback callback
~~~~~~^
../../nan/nan.h:672:12: error: no matching function for call to 'New'
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^~~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate,
^
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char ') would lose const qualifier
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate
isolate,
^
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, size_t length);
^
/Users/username/.node-gyp/5.5.0/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate,
^
In file included from ../src/validation.cc:15:
../../nan/nan.h:676:12: error: no viable conversion from returned value of type 'v8::MaybeLocalv8::Object' to function return type 'v8::Localv8::Object'
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocalv8::Object' to 'const v8::Localv8::Object &' for 1st argument
class Local {
^
/Users/username/.node-gyp/5.5.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocalv8::Object' to 'v8::Localv8::Object &&' for 1st argument
/Users/username/.node-gyp/5.5.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
V8_INLINE Local(Local that)
^
/Users/username/.node-gyp/5.5.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S ' against 'v8::MaybeLocalv8::Object'
V8_INLINE Local(S
that)
^
In file included from ../src/validation.cc:15:
../../nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
~~~~~~~~~~~~~~^
In file included from ../src/validation.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
(static_cast<T volatile
>(0)) = static_cast<S
>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Localv8::Primitive::Localv8::Value' requested here
return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

In file included from ../src/validation.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Boolean volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T
volatile_>(0)) = static_cast<S_>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Localv8::Boolean::Localv8::Value' requested here
return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

In file included from ../src/validation.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Function volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T
volatile_>(0)) = static_cast<S_>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Localv8::Function::Localv8::Value' requested here
return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

In file included from ../src/validation.cc:7:
/Users/username/.node-gyp/5.5.0/include/node/v8.h:221:5: error: assigning to 'v8::Object volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/username/.node-gyp/5.5.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T
volatile_>(0)) = static_cast<S_>(0);
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Localv8::Object::Localv8::Value' requested here
return NanEscapeScope(handle->Get(NanNew(key)).Asv8::Object());
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                         ^

9 errors generated.
make: *** [Release/obj.target/validation/src/validation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.4.0
gyp ERR! command "/usr/local/Cellar/node/5.5.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/norrisbot/node_modules/utf-8-validate
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: node-gyp rebuild
npm WARN install:[email protected] Exit status 1
/usr/local/lib
└── [email protected]

An error pops while intergrating the norrisbot

/npm-debug.log/
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: node bin/bot.js
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid [email protected]
11 verbose cwd /var/www/html/norrisbot
12 error Linux 3.16.0-46-generic
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
14 error node v0.12.7
15 error npm v2.11.3
16 error code ELIFECYCLE
17 error [email protected] start: node bin/bot.js
17 error Exit status 1
18 error Failed at the [email protected] start script 'node bin/bot.js'.
18 error This is most likely a problem with the norrisbot package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node bin/bot.js
18 error You can get their info via:
18 error npm owner ls norrisbot
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

Running via Proxy inside a cooporate Network

Hi Guys..
Thanks for the bot.
My question is more genereal thant specific to this project. Is it possible to run this bot inside a coorporate network via a proxy ???
Regards.
Fofie.

Scaling question

I wonder how would you scale your bot (or more exaclty avoid a single point of failure) ?

Right now, if you run heroku ps:scale worker=2 then the bot will anwser mutliple times the same message...

Trying to launch the bot but nothing happens

I am trying to make the bot run, note that I am not very skilled with npm and node yet :)
I follow the instructions and try to run the bot with the help of the npm start command.

Here's the output I get :

F:\norrisbot>npm start

> [email protected] start F:\norrisbot
> node bin/bot.js


F:\norrisbot>

No error, but nothing happens either in the console or the slack general channel...

By the way I set up my BOT_API_KEY variable correctly (with the token.js method)

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.