This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE IF NOT EXISTS bob DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; | |
USE bob; | |
CREATE TABLE IF NOT EXISTS brain (id INT,data TEXT, PRIMARY KEY (id)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
bob-the-bot: | |
build: . | |
container_name: "bob-the-bot" | |
image: "bob-the-bot" | |
ports: | |
- 80:8080 | |
environment: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:8.12.0-alpine | |
RUN apk add python \ | |
&& apk add make \ | |
&& apk add g++ \ | |
&& apk add tzdata | |
RUN cp /usr/share/zoneinfo/Europe/Warsaw /etc/localtime | |
RUN echo "Europe/Warsaw" > /etc/timezone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rabbitmq:3.7 | |
WORKDIR / | |
RUN rabbitmq-plugins enable rabbitmq_management | |
RUN rabbitmq-plugins enable rabbitmq_federation | |
RUN rabbitmq-plugins enable rabbitmq_federation_management | |
RUN apt-get -qq update &&\ | |
apt-get -qq install curl python &&\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rabbitmq:3.7 | |
WORKDIR / | |
RUN rabbitmq-plugins enable rabbitmq_management | |
RUN rabbitmq-plugins enable rabbitmq_federation | |
RUN rabbitmq-plugins enable rabbitmq_federation_management | |
RUN chmod +x /docker-entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -m | |
docker-entrypoint.sh rabbitmq-server & | |
# This is a temporary solution, please see https://www.rabbitmq.com/configure.html | |
echo "Waiting on RabbitMQ to start" | |
sleep 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (robot) -> | |
robot.hear /^(halina)? (.+)/i, (msg) -> | |
msg.finish() | |
robot.logger.info "Catching: #{msg.match[2]}" | |
message = msg.message | |
message.done = false | |
message.text = message.text.replace(msg.match[1], robot.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
robot.respond /show survey$/i, (msg) -> | |
msg.finish() | |
loadSurveys() | |
.then (surveys) -> | |
attachments = [] | |
attachments.push | |
title: survey.fullName | |
title_link: survey.linkToResult() | |
attachments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (robot) -> | |
robot.respond /ping$/i, (msg) -> | |
msg.finish() | |
msg.send "pong!\nDo you want to play again?" | |
robot.respond /echo (.*)$/i, (msg) -> | |
msg.finish() | |
msg.send msg.match[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
robot.listen( | |
(msg) -> | |
# catch all text messages and unhandled | |
if msg.text and msg.done == false | |
# remove bot's name | |
if msg.text.toLowerCase().indexOf(robot.name) == 0 | |
regex = new RegExp "^#{robot.name}", 'ig' | |
msg.text.replace(regex, '').trim() | |
else if msg.text.toLowerCase().indexOf("@#{robot.name}") == 0 | |
regex = new RegExp "^@#{robot.name}", 'ig' |
NewerOlder