safesupport-bot/README.md

67 lines
2.1 KiB
Markdown
Raw Normal View History

2020-05-07 00:43:20 +00:00
# Safe Support Chat Bot
2020-03-02 22:43:30 +00:00
2021-12-20 19:24:18 +00:00
A simple Matrix bot that handles inviting, uninviting, and notifying Riot users on the recieving end of the [Safe Support chatbox](https://github.com/Safe-Support-Chat/ocrcc-chatbox).
The bot configuration file is `config.json`. It can also pull in user-set configurations from the Safe Support Chat Admin app. To do so, run the command `yarn setup` before starting the bot.
2020-03-02 22:43:30 +00:00
2020-03-23 03:38:07 +00:00
## 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
2020-03-23 03:45:42 +00:00
* On startup, the bot deletes all of the old device IDs for its account
2020-03-23 03:38:07 +00:00
### Bot commands
|Command|Response|
--- | ---
2020-03-23 03:40:35 +00:00
|`!bot hi`|Bot responds with a greeting|
|`!bot transcript`|Bot sends the chat transcript as a .txt file|
2020-03-23 03:41:18 +00:00
|`!bot transcript please`|Bot happily sends the transcript :)|
2020-03-02 22:43:30 +00:00
## Local development
If you prefer to develop locally instead of on Glitch:
Clone the project
```
2021-12-20 19:24:18 +00:00
git clone https://github.com/Safe-Support-Chat/ocrcc-bot.git
2020-03-02 22:43:30 +00:00
```
Install dependencies
```
2020-05-07 00:43:20 +00:00
cd safesupport-bot
2020-03-02 22:43:30 +00:00
yarn
```
Copy the sample config file and add in the missing values.
```
cp sample.config.json config.json
```
Pull in the user-defined settings (if there are any).
2020-03-02 22:43:30 +00:00
```
yarn setup
2020-03-02 22:43:30 +00:00
```
Start the local server
```
2020-03-16 22:21:04 +00:00
yarn develop
```
Run the tests
```
yarn test
```
Production build
```
yarn build
2020-03-02 22:43:30 +00:00
```