Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
venkytv committed May 13, 2023
1 parent f0327c2 commit 0a6f4be
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Botters Engine

Botters is a bot engine designed to siplify the process of creating Slack bots.
Botters bots handle a single conversation, reading input on stdin and writing
responses on stdout. (Think [inetd](https://en.wikipedia.org/wiki/Inetd) for
Slack conversations.) Botters launches multiple instances of the bots on demand,
one for each individual conversation. Conversations terminate when the bot
exits.

Botters bots can be very simple. This is the complete code for a working bot
which keeps track of when was the last time someone mentioned "ChatGPT" in the
channel:

```bash
#!/bin/bash

LAST_MENTION=

while :; do
read MSG
if [[ "$MSG" = *ChatGPT* ]]; then
NOW=$( date +'%s' )
if [[ -n "$LAST_MENTION" ]]; then
echo "It has been $(( NOW - LAST_MENTION )) seconds since someone mentioned ChatGPT last!"
fi
LAST_MENTION="$NOW"
fi

sleep 0.1
done
```

See [examples](examples) for more examples.

0 comments on commit 0a6f4be

Please sign in to comment.