Skip to content

Commit

Permalink
Update command names and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill13579 committed Apr 28, 2020
1 parent 298902d commit d25e3f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ Simply do `cargo build --release`. It might take a while.
##### Step 2 - Write the Script that Igneous should follow

The script format is simple. There are 3 command types:
`S!bot? are you there?` - wait for user to type the preset string ("bot? are you there?")
`I!yeah, I'm here` - reply with the preset string ("yeah, I'm here")
`IMG![images/bot-selfie.png]` - reply with image
- `T!bot? are you there?` - wait for anyone (including other bots) to type the preset string "bot? are you there?"
- `R!yeah, I'm here` - reply with the preset string "yeah, I'm here"
- `IMG![images/bot-selfie.png]` - reply with image

All commands **must** have a timeout (the timeout **can** be `0.0`) after the command executes:
`S!bot? are you there?+3.0` - wait 3 seconds after the user types the preset string
`T!bot? are you there?+3.0` - wait 3 seconds after the user types the preset string

Always start a bot with an `S!`. That would be your trigger.
If the first command is a trigger, then the bot will only become active when the requirement for input is met. Otherwise, any message will activate the bot.

A simple ping-pong bot:
```
S!bot? are you there?+2.0
I!yeah, I'm here+0.0
S!ok+2.0
I!soooooo, why did you call me?+0.0
T!bot? are you there?+2.0
R!yeah, I'm here+0.0
T!ok+2.0
R!soooooo, why did you call me?+0.0
IMG![Confused.png]+0.0
```

Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ impl Handler {
let timeout: String = matched.get(3).unwrap().as_str().to_owned();
let timeout: f32 = timeout.parse().unwrap();
states.push(match cmd_type.as_str() {
"I" => State::Display(data, timeout),
"S" => State::Trigger(Requirement::new(data), timeout),
"R" => State::Display(data, timeout),
"IMG" => State::DisplayImage(data, timeout),
"INPUT" => State::Trigger(Requirement::new(data), timeout),
"T" => State::Trigger(Requirement::new(data), timeout),
"GO_OFFLINE" => State::GoOffline(timeout),
"GO_ONLINE" => State::GoOnline(timeout),
&_ => {
Expand Down

0 comments on commit d25e3f2

Please sign in to comment.