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

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

HTTP/2 : what and why

HTTP History In 1989, the hypertext transfer protocol have been invented. HTTP/1.1 has been released in 1997 and took the longest pause in evolution. In 2015, Google has redrafted its inhouse SPDY protocol to HTTP/2 to optimize the web page load time.  HTTP/1.1 Pitfalls Too heavy and big protocol. Too many parts have been added as optional led to complicating the protocols with less of usage. Since HTTP1.1 release, web technology have seen tremendous change. Page size has been increased to MBs, the number to pages increased manifolds and parallel components making HTTP calls increased too.  Each HTTP request has a separate TCP connection and its handshake does add to page load time.  Head of line blocking has slowed the page load. We can have a maximum 8 parallel connection to the same domain. Due to increase in multiple components making separate HTTP calls, this has been a bottleneck.  HTTP/2 Solution Binary framing layer: HTTP/1.1 was text-only messaging, which wa...

Two numbers with minimum difference

Find the two numbers whose difference is minimum among the set of numbers. For example the sequence is 5, 13, 7, 0, 10, 20, 1, 15, 4, 19 The algorithm should return min diff = 20-19 = 1. Make an efficient algorithm, yeah best could be O(n). Not sure if i could use DP here, will post a solution tommorow. Let me know if you find a answer. Algorithm:MiniMumDiffN Get the size of array , say n. Get the range of array, range. Bucket Sort the above array. Search the above sorted array for minimum difference. This will be the minimum difference numbers. Now question comes where the range of above given array is very big. Algorithm:DivideArray Take an random element. Search for its position in array. Return the index of element. Algorithm:MiniMumDiff if array_range > MAXRANGE int mid = divideArray (arr,start,end); d1,max1 = MiniMumDiff( arr,start,mid-1); d2,max2 = MiniMumDIff(arr,mid+1,end); d3 = difference max1 and arr[mid] d4 = difference max2 and arr[mid] return minimum( d1,d2...