-
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.
- Loading branch information
Tjeerd Ritsma
committed
Sep 23, 2017
1 parent
00c5db1
commit 41f9a09
Showing
5 changed files
with
84 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,2 @@ | ||
# ModularSlackBot | ||
# Modular Slack Bot | ||
This wil be a basic slack bot that allows you to easily add modules containing responses | ||
|
||
Before use: | ||
`glide install` to install dependencies using glide | ||
|
||
Set the bot token in `main.go` | ||
|
||
`go run main.go` to start this bot | ||
|
||
make changes to `modules/test.go` | ||
|
||
# Roadmap | ||
v1.0 | ||
- √ improve project structure | ||
- change structs | ||
- Bot | ||
Add functions to allow module management on the bot | ||
- integrate RTM into bot | ||
- let bot handle | ||
- activating/deactivating a module | ||
- triggering module info | ||
- triggering module help | ||
Contains interaction with slack, default functions to allow basic desired functionality | ||
|
||
- change Message struct to provide the actual channel name | ||
- change Message struct to provide the actual user name | ||
|
||
- Module | ||
- change Module struct to remove configuration struct because it should be part of the module itself | ||
- create example bot project | ||
- create example module project | ||
- create tests | ||
- Solely Trigger based | ||
|
||
v1.1 | ||
- add time based triggers (cron) | ||
|
||
v1.2 | ||
- add interactive mode |
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,5 @@ | ||
# Documentation | ||
|
||
* [Modules](modules.md) | ||
* [Triggers](triggers.md) | ||
* [Roadmap](roadmap.md) |
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,8 @@ | ||
# Modules | ||
We'll list public modules here in the future | ||
|
||
## Making your own module? | ||
see this [repository](https://github.com/TheWolfNL/ModularSlackBot-example-module-hello) to get you going. | ||
|
||
### Additional examples | ||
* [Reminder Module [WIP]](https://github.com/TheWolfNL/ModularSlackBot-example-module-reminder) |
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,28 @@ | ||
# Roadmap | ||
v1.0 | ||
- √ improve project structure | ||
- √ create example module project | ||
- change structs | ||
- Bot | ||
Add functions to allow module management on the bot | ||
- integrate RTM into bot | ||
- let bot handle | ||
- activating/deactivating a module | ||
- triggering module info | ||
- triggering module help | ||
Contains interaction with slack, default functions to allow basic desired functionality | ||
|
||
- change Message struct to provide the actual channel name | ||
- change Message struct to provide the actual user name | ||
|
||
- Module | ||
- change Module struct to remove configuration struct because it should be part of the module itself | ||
- create bot example | ||
- create tests | ||
- Solely Trigger based | ||
|
||
v1.1 | ||
- add time based triggers (cron) | ||
|
||
v1.2 | ||
- add interactive mode |
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,42 @@ | ||
# Triggers | ||
Use the following code and change the repsonse message and trigger regex. | ||
``` | ||
module.AddTrigger("ping", func(message bot.Message) { | ||
module.Respond("pong") | ||
}) | ||
``` | ||
This example trigger will listen to "ping" inside a message. You can use regular expressions to define this trigger. | ||
|
||
## Regex | ||
Use a website like [Regex101](https://regex101.com/) and select `Golang` as flavor. | ||
|
||
Copy the following lines into the `test string` area | ||
``` | ||
Asswooping | ||
ping | ||
typing | ||
ping google.com | ||
PingPong | ||
PING | ||
Sentences containing ping? | ||
``` | ||
|
||
If you then type `ping` in the regular expression field, You'll see 5 highlights, these sentences will trigger the function. | ||
|
||
* You can also notice it is case sensitive, change the expression to `(?i)ping` to solve this. | ||
* To make sure `ping` is a word on its own we can change it to `\bping\b` | ||
|
||
This `\b` defines a word boundary. | ||
* It can also be used to find words ending in `ping` by using `\bping`. | ||
* Or words starting with `ping` by using `ping\b`. | ||
* Combined with case sensitivity it will become `(?i)\bping\b` | ||
* You're also able to have multiple keywords `(\bping\b|Pong)` | ||
|
||
This will only trigger if `ping` is a word on it's own or `Pong` is found | ||
* To make sure `ping` is the only thing sent we can use `^ping$` to check | ||
|
||
Make sure the `multi-line` flag is active by clicking on the flag at the end of the input field | ||
* It's also possible to only check for the start of the string `^ping` | ||
* Ot at the end of the string `ping$` | ||
|
||
There is a lot more possible when using regular expressions, but this site will help you test it. |