-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup channels if engine dies uncleanly
Also add sample bot demonstrating timed messages
- Loading branch information
Showing
6 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CONFIG_DIR = $(HOME)/teabot-engines | ||
|
||
all: | ||
@echo Run \"make install\" to install the cuckoobot engine | ||
|
||
install: $(CONFIG_DIR) $(CONFIG_DIR)/cuckoobot.yaml $(CONFIG_DIR)/cuckoobot.sh | ||
|
||
$(CONFIG_DIR)/cuckoobot.yaml: cuckoobot.yaml.tmpl | ||
sed -e 's|@CONFIG_DIR@|$(CONFIG_DIR)|' $< > $@ | ||
|
||
$(CONFIG_DIR)/cuckoobot.sh: cuckoobot.sh | ||
cp $< $@ | ||
chmod 755 $@ | ||
|
||
$(CONFIG_DIR): | ||
mkdir -p $@ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Basic bot engine | ||
|
||
A simple bot which prints the message "cuckoo" on the hour every hour in any | ||
channel it is invited into. | ||
|
||
### Installation | ||
|
||
``` | ||
make install | ||
``` | ||
|
||
This copies the bot's config as well as the bot script to the | ||
default config directory: `~/teabot-engines`. | ||
|
||
If `teabot` is already running, make it reload its engines: | ||
|
||
``` | ||
pkill -HUP teabot | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
while :; do | ||
# Say cuckoo every hour | ||
if ! (( `date +'%M'` % 60 )); then | ||
echo "cuckoo" | ||
fi | ||
sleep 60 | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
handler: @CONFIG_DIR@/cuckoobot.sh | ||
threaded: false | ||
direct-messages-only: false |