Simple chat bot that can be used to announce scrum time by sending a message to a chat room with a defined schedule.
Supported chat platforms:
Create a yaml file called config.yaml
and insert data according the the following structure
Config example:
bots:
ex_slack:
platform: slack
api_key: 'xoxp-388...123'
ex_telegram:
platform: telegram
api_key: '123456789:AAF...E_Y'
messages:
example:
body: 'Hello world!'
messengers:
- bot: ex_slack
chat_ids: test_channel
- bot: ex_telegram
chat_ids: ['-123456789']
schedule: '0 0 0 * * 1-5' # The version of the cron lib used for scheduling uses the Quartz format (first field represents seconds)
expiretime: 10m # Optional time after which the message will be deleted. Format: https://golang.org/src/time/format.go?s=40541:40587#L1364
disable_link_preview: True # Optional flag for disabling link preview when sending url's
Schedule is in a Quarts Scheduler format, more info can he found here.
Run
# this will take `./config.yaml` as config file by default
go run main.go
Alternatively to explicitly add the config file:
go run main.go -c <path/to/file>/myconfig.yaml
This project has a Dockerfile to create a small docker image of this project.
Generate image:
docker build -t scrumtime .
Specify Go version (Go version to build with)
docker build -t scrumtime . --build-arg go_version=1.11
Specify Alpine version (Final image base into which the binary is copied)
docker build -t scrumtime . --build-arg alpine_version=3.8.4
Run container with image:
docker create --name scrumtime_helloworld scrumtime
docker cp config.yaml scrumtime_helloworld:/
docker start scrumtime_helloworld
Alternatively, the image pushed on Docker Hub can be used.
This command also mounts (-v
) the config file into the container instead of copying to it
and runs it in the background (-d
).
docker run --name scrumtime_helloworld -d -v $PWD/config.yaml:/config.yaml chrisvdg/scrumtime # Or with version tag: chrisvdg/scrumtime:0.0.1
By default the image uses the UTC timezone. To set the timezone of your container, set the TZ
environmental variable.
Using this, you can't set it with abbreviated, use the full name of the TZ
Database. (Timezone may be changed but time will still be UTC)
docker run -e "TZ=Europe/Brussels" -d -v $PWD/config.yaml:/config.yaml chrisvdg/scrumtime
The timezone can also be configured in the Dockerfile so there won't be a need to set it when starting the container. For this the abbreviations can be used.
Replace the line RUN apk add tzdata
with:
Replace EST
(2x) with your timezone.
RUN apk add tzdata && cp /usr/share/zoneinfo/EST /etc/localtime && echo "EST" > /etc/timezone && apk del tzdata