Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6df9ec1 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3r committed Sep 9, 2022
1 parent bc27e73 commit b148858
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rules/anatomy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,12 @@ <h1>Anatomy of a Rule</h1>
<ul>
<li><strong>name</strong> (<em>string</em>) Choose a name of the rule. This should match the name of yaml file, should be short and descriptive.</li>
<li><strong>active</strong> (<em>boolean</em>) If set to true, the bot will look for the match in the rooms it is in and take stated actions.</li>
<li><strong>respond</strong> (<em>string</em>) Choose a string to match or regex pattern that this rule should trigger actions for.
<li><strong>respond</strong> (<em>string</em>) Choose a string to match or regex pattern that this rule should trigger actions for. Regex rules with <a href="https://pkg.go.dev/regexp/syntax#:%7E:text=named%20%26%20numbered%20capturing%20group">named capture groups</a> will be processed as arguments.
<ul>
<li><strong>args</strong> (<em>yaml array</em>) The number of items in this array determines how many args you're trying to capture after the match is found. Each argument captured after the match will be mapped to a variable name you assign in this array. Optional arguments (denoted with a <code>?</code> suffix) have to be listed last - their variable name will not contain the <code>?</code>.</li>
</ul>
</li>
<li><strong>hear</strong> (<em>string</em>) Choose a string to match or regex pattern that this rule should trigger actions for. Hear will match any occurrence of the pattern in the room regardless of whether the bot is addressed. This trigger takes no arguments.</li>
<li><strong>hear</strong> (<em>string</em>) Choose a string to match or regex pattern that this rule should trigger actions for. Hear will match any occurrence of the pattern in the room regardless of whether the bot is addressed. Regex rules with <a href="https://pkg.go.dev/regexp/syntax#:%7E:text=named%20%26%20numbered%20capturing%20group">named capture groups</a> will be processed as arguments.</li>
<li><strong>schedule</strong> (<em>string</em>) <a href="https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format">Cronspec</a> for when you want a rule to run on a schedule.</li>
<li><strong>reaction</strong> (<em>string</em>) Any time a rule is matched by the bot, it will add this reaction to the message that triggered the rule.
<ul>
Expand Down
50 changes: 50 additions & 0 deletions rules/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,56 @@ <h2 id="fotd">FOTD</h2>

# help
include_in_help: false
</code></pre>
<h2 id="application-deployments">Application Deployments</h2>
<p>This rule contains named capture groups and will expose each capture group as an argument that can be used throughout the rule.</p>
<pre data-lang="yaml" class="language-yaml "><code class="language-yaml" data-lang="yaml"># meta
name: deployments
active: true

respond: /deploy (?P<application>\S+)@(?P<version>\S+) to (?P<environment>\S+)/

# actions
actions:
- name: example deployment command
type: exec
cmd: echo "deploy-cmd -a ${application} -e ${environment} -v ${version}"

# response
format_output: "Successfully deployed ${application} to ${environment}"
direct_message_only: false

# help
include_in_help: false
</code></pre>
<h2 id="greatness-joke">Greatness Joke</h2>
<p>This rule contains a captured group named <code>person</code> that when heard will return a Chuck Norris like joke about that person.</p>
<pre data-lang="yaml" class="language-yaml "><code class="language-yaml" data-lang="yaml"># meta
name: greatness-joke
active: true

# trigger and args
hear: /(?P<person>\S+) is so great/

# actions
actions:
- name: praise
type: GET
url: http://api.icndb.com/jokes/random
query_data:
limitTo: "[nerdy]"
firstName: ""
lastName: "${person}"
expose_json_fields:
joke: '.value.joke'

# response
format_output: "${joke}"
direct_message_only: false

# help
help_text: <name> is so great
include_in_help: true
</code></pre>


Expand Down
2 changes: 1 addition & 1 deletion search_index.en.js

Large diffs are not rendered by default.

0 comments on commit b148858

Please sign in to comment.