Merge branch 'master' of github.com:nomadic-labs/ocrcc-bot

This commit is contained in:
Sharon Kennedy 2020-03-23 00:28:06 -04:00
commit 6389210cf3

View File

@ -1,20 +1,40 @@
# OCRCC Bot # OCRCC Bot
A simple Matrix bot that handles inviting, uninviting, and notifying Riot users on the recieving end of the [OCRCC chatbox](https://github.com/nomadic-labs/ocrcc-chatbox) A simple Matrix bot that handles inviting, uninviting, and notifying Riot users on the recieving end of the [OCRCC chatbox](https://github.com/nomadic-labs/ocrcc-chatbox).
A demo of this bot is hosted on Glitch: https://glitch.com/edit/#!/nomadic-labs-ocrcc-bot A demo of this bot is hosted on Glitch: https://glitch.com/edit/#!/nomadic-labs-ocrcc-bot
You can remix it and continue developing directly on Glitch. All you need to do is add an `.env` file with the following variables: You can remix it and continue developing directly on Glitch. All you need to do is add an `.env` file with the following variables:
``` ```
MATRIX_SERVER_URL="https://matrix.org" MATRIX_SERVER_URL=
BOT_DISPLAY_NAME="Example Bot" BOT_DISPLAY_NAME=
BOT_USERNAME="example-bot" BOT_USERNAME=
BOT_PASSWORD="password" BOT_PASSWORD=
BOT_USERID="@example-bot:matrix.org" BOT_USERID=
FACILITATOR_ROOM_ID="!example:matrix.org" FACILITATOR_ROOM_ID=
CHAT_OFFLINE_MESSAGE="There is no-one currently available to chat." FACILITATOR_GROUP_ID=
CAPTURE_TRANSCRIPTS=true CHAT_OFFLINE_MESSAGE=
CAPTURE_TRANSCRIPTS=
``` ```
## What does the bot do?
* The bot receives an invitation to every chatroom created by the embedded chatbox, and automatically accepts
* Upon joining a new room, the bot invites all of the members of the Facilitators community
* When the first facilitator accepts the invitation, the bot uninvites the rest of the facilitators
* The bot notifies the Support Chat Notifications chatroom when there is a support request and when a facilitator joins
* If there are no facilitators online, the bot notifies the support seeker
* The bot makes the facilitator a moderator of the chatroom so they can change the room settings (i.e. room name)
* The bot listens to all the incoming messages and prints them to a transcript if that setting is enabled (`CAPTURE_TRANSCRIPT`)
* Messages that start with `!bot` are treated as commands.
* The bot sends a notification to the support chatroom and the Support Chat Notifications room if it crashes
* On startup, the bot deletes all of the old device IDs for its account
### Bot commands
|Command|Response|
--- | ---
|`!bot hi`|Bot responds with a greeting|
|`!bot transcript`|Bot sends the chat transcript as a .txt file|
|`!bot transcript please`|Bot happily sends the transcript :)|
## Local development ## Local development
If you prefer to develop locally instead of on Glitch: If you prefer to develop locally instead of on Glitch: