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

JAVA CLASSLOADER- Types, usages.

JVM loads library and classes dynamically only. Its on demand only. A Class will be loaded only when needed and only once. There can be system supported class loader and user supplied class loader. When JVM starts it loads three type of class loader 1. Bootstrap loader - When system boots. Loads from jre_home/lib/ 2. External class loader - Loads from jre_home/lib/ext. 3. System Class loader - Loads classes from system property CLASSPATH. Besides this user can provide their own class loader which is pretty easy to implement in Java. User supplied loader will work in conjunction with other loader i.e. system loader too. Some of the examples are: 1. Load library at runtime from http resources. Example scripting classes, bean classes. 2. Can load encrypted class files with new class loader. 3. Modify the byte code. Application Container loads classes from deployed WAR or EAR files using a tree of class loaders.

Permutations Sum(xi)

You have given "k" dice. How many way you can get a sum "S" and yes you have to throw all the dice. Write program for this. Its same permutations program...but we have to try with all the six S(1,2,3,4,5,6) possibilities for a dice. Exit condition will be If all the dice run out. SumP(dice,sum) = SumP(dice-1,sum-i)+i (from S).