You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-23Lines changed: 22 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,22 +17,22 @@ Minimalistic yet polyglot framework to build chat bots on top of a Roda backend
17
17
18
18
Thank you for supporting free and open-source software by sponsoring on [GitHub](https://github.com/sponsors/svoop) or on [Donorbox](https://donorbox.com/bitcetera). Any gesture is appreciated, from a single Euro for a ☕️ cup of coffee to 🍹 early retirement.
The **app service** is a [Roda app](https://roda.jeremyevans.net) where the real action happens. It acts on and responds to HTTP requests from:
112
112
@@ -177,11 +177,11 @@ Tag | Replaced with
177
177
`[[SENDER]]` | Mention the sender of the command.
178
178
`[[EVERYBODY]]` | Mention everybody.
179
179
180
-
#### Other Routes
180
+
#### Other routes
181
181
182
182
All higher level requests such as `GET /foo/bar` are not accessible by relays. Use them to implement other aspects of your bot such as webhooks or schedule tasks.
183
183
184
-
### Relay Services
184
+
### Relay services
185
185
186
186
The **relay service** act as glue between the **app service** and external communication networks such as Matrix.
187
187
@@ -199,15 +199,15 @@ rodbot simulator
199
199
200
200
Enter the command `!pay EUR 123` and you see the request `GET /pay?argument=EUR+123` hitting the **app service**.
201
201
202
-
#### TCP Socket
202
+
#### TCP socket
203
203
204
204
The TCP socket is primarily used by other Rodbot services to forward messages to the corresponding external communication network. However, you can use these sockets for non-Rodbot processes as well e.g. to issue notifications when events happen on the host running Rodbot.
205
205
206
206
Simply connect to a socket and submit the message as plain text or Markdown in UTF-8. Multiple lines are allowed, to finish and post the message, append the EOT character (`\x04` alias Ctrl-D).
207
207
208
208
Such simple messages are always posted to the primary room (aka: channel, group etc) of the communication network. For more complex scenarios, please take a look at [message objects](https://www.rubydoc.info/gems/rodbot/Rodbot/Message) which may contain meta information as well.
209
209
210
-
### Schedule Service
210
+
### Schedule service
211
211
212
212
The **schedule service** is a [Clockwork process](https://github.com/Rykian/clockwork) which triggers Ruby code asynchronously as configured in `config/schedule.rb`.
213
213
@@ -227,7 +227,7 @@ The `rodbot` CLI is the main tool to manage your bot. For a full list of functio
227
227
rodbot --help
228
228
```
229
229
230
-
### Starting and Stopping Services
230
+
### Starting and stopping services
231
231
232
232
While working on the app service, you certainly want to try routes:
233
233
@@ -364,7 +364,7 @@ You can further narrow where to post the message if you specify the relay plugin
364
364
say("Hello, Slack!", on::slack)
365
365
```
366
366
367
-
## Routes and Commands
367
+
## Routes and commands
368
368
369
369
Adding new tricks to your bot boils down to adding routes to the app service which is powered by Roda, a simple yet very powerful framework for web applications: Easy to learn (like Sinatra) but really fast and efficient. Take a minute and [get familiar with the basics of Roda](http://roda.jeremyevans.net/).
370
370
@@ -430,7 +430,7 @@ The Hash backend is not thread-safe and therefore shouldn't be used in productio
430
430
db 'hash'
431
431
```
432
432
433
-
### Write and Read Data
433
+
### Write and read data
434
434
435
435
With this in place, you can access the database with `Rodbot.db`:
436
436
@@ -480,7 +480,7 @@ In order not to commit secrets to repositories or environment variables, Rodbot
480
480
481
481
Rodbot aims to keep its core small and add features via plugins, either built-in or provided by gems.
482
482
483
-
### Built-In Plugins
483
+
### Built-in plugins
484
484
485
485
Name | Dependencies | Description
486
486
-----|--------------|------------
@@ -499,7 +499,7 @@ bundle config set --local with otp
499
499
bundle install
500
500
```
501
501
502
-
### How Plugins Work
502
+
### How plugins work
503
503
504
504
Given the following `config/rodbot.rb`:
505
505
@@ -519,7 +519,7 @@ Whenever a service boots, the corresponding file is required.
519
519
520
520
In order to keep these plugin files slim, you should extract functionality into service classes. Just put them into `rodbot/plugins/my_plugin/lib/` and use `require_relative` where you need them.
521
521
522
-
### Create Plugins
522
+
### Create plugins
523
523
524
524
You can create plugins in any of the following places:
525
525
@@ -529,7 +529,7 @@ You can create plugins in any of the following places:
529
529
530
530
Please adhere to common naming conventions and use the dashed prefix `rodbot-` (and Module `Rodbot`), however, underscores in case the remaining gem name consists of several words.
531
531
532
-
#### App Extension
532
+
#### App extension
533
533
534
534
An app extension `rodbot/plugins/my_plugin/app.rb` defines the module `App` and looks something like this:
535
535
@@ -569,7 +569,7 @@ The `App` module can be used to [extend all aspects of Roda](https://github.com/
569
569
570
570
For an example, take a look at the [:hal plugin](https://github.com/svoop/rodbot/tree/main/lib/rodbot/plugins/hal).
571
571
572
-
#### Relay Extension
572
+
#### Relay extension
573
573
574
574
A relay extension `rodbot/plugins/my_plugin/relay.rb` defines the class `Relay` and looks something like this:
575
575
@@ -610,7 +610,7 @@ Proactive messages require other parts of Rodbot to forward a message directly.
610
610
611
611
For an example, take a look at the [:matrix plugin](https://github.com/svoop/rodbot/tree/main/lib/rodbot/plugins/matrix).
612
612
613
-
#### Schedule Extension
613
+
#### Schedule extension
614
614
615
615
A schedule extension `rodbot/plugins/my_plugin/schedule.rb` defines the class `Schedule` and looks something like this:
616
616
@@ -647,7 +647,7 @@ Before you write a plugin, familiarise yourself with the following bundled helpe
647
647
*[Rodbot::Refinements](https://www.rubydoc.info/gems/rodbot/Rodbot/Refinements.html) – just a few handy extensions to Ruby core classes
648
648
*[Rodbot::Memoize](https://www.rubydoc.info/gems/rodbot/Rodbot/Memoize.html) – environment-aware memoization for method return values
649
649
650
-
## Environment Variables
650
+
## Environment variables
651
651
652
652
Environment variables are used for the configuration bits which cannot or should not be part of `config/rodbot.rb` mainly because they have to be set on the infrastructure level.
You're welcome to join the [discussion forum](https://github.com/svoop/rodbot/discussions) to ask questions or drop feature ideas, [submit issues](https://github.com/svoop/rodbot/issues) you may encounter or contribute code by [forking this project and submitting pull requests](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
0 commit comments