Open samhavens opened 5 years ago
Hi Sam, I've developed this little project in order to be able to code a Hubot bot with Typescript and DI. Be aware that I'm not using this in production, although I would, I just don't have any bots now. Besides I don't know anyone using it, so yeah, there are no docs either, all there is is the readme.
In order to get started, you'll use a Yeoman generator to scaffold a new project. First you need to install the generator using: (if you're not using yarn, replace with proper npm command, or install yarn)
yarn global add yo generator-hubular
Then you can scaffold a new project with:
yo hubular
It will ask you a couple of question about the new bot, and once it finishes you should have a working Hubot bot. I recommend you select the shell
adapter for play testing, you can afterwards change it to use Slack.
Once the command finishes, you can start the hubot bot using
yarn start
It will open a console where you can chat to the bot, you can test connection by saying <botname> ping
HUBOT> hubot ping
HUBOT > PONG
Check the readme added to your project for more startup examples.
yarn add hubot-slack
Change the adapter
in hubular.json
to slack
Create a .env
file to provide slack environment variables. Hubular with load this file for you.
I've not tested this with Slack, but same guides should apply.
To host this in production, you can use Docker. Here's a Dockerfile and compose example:
FROM node:alpine
# ENV NODE_ENV=production
RUN mkdir -p /code
WORKDIR /code
COPY ./package.json ./yarn.lock ./
RUN yarn install
COPY external-scripts.json tsconfig.json hubular.json ./
COPY ./scripts ./scripts
COPY ./src ./src
RUN yarn build
EXPOSE 8080
CMD yarn build && yarn hubular
version: '2'
services:
hubot:
build:
context: ./
volumes:
- ./scripts:/code/scripts
- ./src:/code/src
# - ./hubular-scripts:/code/hubular-scripts
environment:
HUBOT_LOG_LEVEL: debug
I'm happy to help you if you need further help. If you'd like to fix anything, or add docs, I'd welcome any PRs.
As a user new to Hubot, I am unsure: how to get started, run and host this, how to connect it to e.g. Slack, and what I can do with it. It seems really cool though! I'm happy to help with documentation if you can lead me through the process.