Skip to main content

Hubot test

I was searching for peer to peer video conferencing and landed up on Peer2Peer. While evaluating it and checking for other option i landed up to RocketChat and in terms how it supports bot by using  hubot. Today i will list out my quick test done on same.


Step 0:
 Hubot support various deployment platforms i.e. Heroku, Unix, Windows and Azure. So choose one for you. I just choose unix and create a VM on google cloud console.

Step 1:

Basic shell comes with node support, so just execute below command to install hubot.

npm install -g yo generator-hubot



Once successfully installed it will message like below:

No .bowerrc file in home directory Global configuration file is valid NODE_PATH matches the npm root No .yo-rc.json file in home directory Node.js version npm version yo versionEverything looks all right!npm WARN notsup Unsupported engine for got@5.7.1: wanted: {"node":">=0.10.0 <7"} (current: {"node":"10.14.2","npm":"6.14.5"})npm WARN notsup Not compatible with your version of node/npm: got@5.7.1+ yo@3.1.1+ generator-hubot@0.4.0added 994 packages from 424 contributors in 37.724s




Step 2:

Create a bot directory  and run "yo hubot" command from inside directory.


ashudevelopment2019@cloudshell:~$ mkdir botashudevelopment2019@cloudshell:~$ cd botashudevelopment2019@cloudshell:~/bot$ yo hubot _____________________________ / \ //\ | Extracting input for | ////\ _____ | self-replication process | //////\ /_____\ \ / ======= |[^_/\_]| /---------------------------- | | _|___@@__|__ +===+/ /// \_\ | |_\ /// HUBOT/\\ |___/\// / \\ \ / +---+ \____/ | | | //| +===+ \// |xx|? Owner abc@gmail.com? Bot name test? Description A test bot? Bot adapter shell create bin/hubot create bin/hubot.cmd create Procfile create README.md create external-scripts.json create hubot-scripts.json create .gitignore create package.json create scripts/example.coffee create .editorconfig _____________________________ _____ / \ \ \ | Self-replication process |

_____ / \ \ \ | Self-replication process | | | _____ | complete... | |__\\| /_____\ \ Good luck with that. / |//+ |[^_/\_]| /---------------------------- | | _|___@@__|__ +===+/ /// \_\ | |_\ /// HUBOT/\\ |___/\// / \\ \ / +---+ \____/ | | | //| +===+ \// |xx|npm notice created a lockfile as package-lock.json. You should commit this file.+ hubot-redis-brain@1.0.0+ hubot-diagnostics@1.0.0+ hubot-help@1.0.1+ hubot-google-translate@0.2.1+ hubot-maps@0.0.3+ hubot-google-images@0.2.7+ hubot-pugme@0.1.1+ hubot-scripts@2.17.2+ hubot@3.3.2+ hubot-heroku-keepalive@1.0.3+ hubot-rules@1.0.0+ hubot-shell@1.0.2+ hubot-shipit@0.2.1added 93 packages from 54 contributors and audited 93 packages in 3.606sfound 0 vulnerabilitiesashudevelopment2019@cloudshell:~/bot$

We have chosen shell adapter for testing/ development only. You can chose campfire after you have signed on campfire portal.

Step 3: Now its ready for test. you can execute like below:

Run bin/hubot on same prompt.


ashudevelopment2019@cloudshell:~/bot$ bin/hubotaudited 93 packages in 1.029sfound 0 vulnerabilitiesNo history availabletest> [Sun Jun 28 2020 20:34:52 GMT+0530 (India Standard Time)] WARNING Loading scripts from hubot-scripts.json is deprecated and will be removed in 3.0 (https://github.com/github/hubot-scripts/issues/1113) in favor of packages for each script.Your hubot-scripts.json is empty, so you just need to remove it.[Sun Jun 28 2020 20:34:52 GMT+0530 (India Standard Time)] INFO hubot-redis-brain: Using default redis on localhost:6379[Sun Jun 28 2020 20:34:52 GMT+0530 (India Standard Time)] ERROR hubot-heroku-keepalive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web.url | cut -d= -f2)`


Step 4:

You can execute test help to list down what are the option with bot.

test> test helptest> ship it - Display a motivation squirreltest adapter - Reply with the adaptertest animate me <query> - The same thing as `image me`, except adds a few parameters to try to return an animated GIF instead.test echo <text> - Reply back with <text>test help - Displays all of the help commands that this bot knows about.test help <query> - Displays all help commands that match <query>.test image me <query> - The Original. Queries Google Images for <query> and returns a random top result.test map me <query> - Returns a map view of the area returned by `query`.test mustache me <url|query> - Adds a mustache to the specified URL or query result.test ping - Reply with pongtest pug bomb N - get N pugstest pug me - Receive a pugtest the rules - Make sure hubot still knows the rules.test time - Reply with current timetest translate me <phrase> - Searches for a translation for the <phrase> and then prints that bad boy out.test translate me from <source> into <target> <phrase> - Translates <phrase> from <source> into <target>. Both <source> and <target> are optional


There are plenty of NPM packages for various activities. Check here for more details. hubot-scripts


As i explore will add more here.


Comments

Popular posts from this blog

[PUZZLE] ELEPHANT AND BANANA PUZZLE

A merchant has bough some 3000 banana from market and want to bring them to his home which is 1000 km far from Market. He have a elephant which can carry maximum of 1000/- banana at time. That could have been easy but this elephant is very shrewd and he charges 1 banana for every one kilometer he travel. Now we have to maximise number of banana which should reach to home. Solution: At present we are at 0th km with 3000 banana and elephant. Lets see if elephant have to shift all the 3000 banana and elephant by 1 km. For 1 km shift: Take first 1000 banana and drop at 1st km. 2 banana consumed. One banana each for to and fro. Second  1000 banana and drop at 1st km. 2 banana consumed. Third 1000 banana and reach at 1st km. 1 banana consumed. So all in all total 5 banana will be consumed if we shift a kilometer. But that's not all, our total banana number are also reducing so we may have to reduce the number of turns too. And this will happen once we have reduced the b...

Multi Factor Authentication

How to make sure User A is User A as he claims, not User a. Our old movies smugglers can teach us a few tricks here. There are multiple levels or factor of authentication. 1. First Factor - Something you only know. It's like a secret pin, key, pattern or password.     In the old movie, there used to be a secret code between smugglers.  Parties involved in the transaction only knows this secret code. 2. Second Factor - Something you only own. It's like the ATM card, phone, device or OTP.      In the old movies, smugglers used torn currency note. Both parties will have one part.  One party need to show ownership of half of the torn currency note to receive goods from another party. 3.  Third Factor - Something you are. It's related to your physical appearance. Like your face, your thumb impression or voice. Your personal physical traits will be used to identify you.      Remember hero duplicates being used to catch smuggl...

Car Parking Problem

There is n parking slots and n-1 car already parked. Lets say car parked with initial arrangement and we want to make the car to be parked to some other arrangement. Lets say n = 5, inital = free, 3, 4, 1, 2 desired = 1, free, 2, 4 ,3 Give an algorithm with minimum steps needed to get desired arrangement. Told by one of my friend and after a lot of search i really got a nice solution. I will post solution in comment part