Skip to content

Commit

Permalink
feat(hubot-modules): Add message-aggreator hubot module
Browse files Browse the repository at this point in the history
This commit adds a new package called `hubot-message-aggregator` to the
MandatoryFun software suite. The goal of this module to is to enable hubot to
collect messages that get certian emoji reactions and post them to an
aggregation channel. See the README for a lot more detail.
  • Loading branch information
Michael Stahnke committed Mar 1, 2024
1 parent 73ff262 commit c2e23f3
Show file tree
Hide file tree
Showing 7 changed files with 5,215 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hubot-modules/hubot-message-aggregator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
*.tar.gz
7 changes: 7 additions & 0 deletions hubot-modules/hubot-message-aggregator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 Michael Stahnke

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
61 changes: 61 additions & 0 deletions hubot-modules/hubot-message-aggregator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# hubot-message-aggregator

![95feb390-e7b4-4033-b02a-49b1557efd6f](https://github.com/stahnma/mandatoryFun/assets/6961/84f209cb-8ad4-41ac-ac50-c41018d71f28)



This is a simplistic module designed to aggreate message into a single channel based upon an emoji reaction.

The idea is that if a people react to a message, it will "bookmark" it, or
aggregate it into a channel. An example could be to have any message where
people react to a message with a `:thankyou:` emoji placed into a `#thanks` or
`#gratitude` channel.

Another example could be that any messages with a :computer: emoji reaction
gets passed to an incident or alert channel.


# Installation

npm i --save hubot-message-aggregator


Edit your `external-scripts.json` file in your hubot applicaiton directory and add `hubot-post-aggregator` to it.

# Configuration

## Variables

By default, the pattern it looks for in the emoji name is "thank". This can be
set via `HUBOT_AGGREGATION_PATTERN`. The value for it is just the string portion
of the regex (e.g. no need for `/` around it.)

By default, the aggregator will *not* post messages from private channels or
conversations. This can be overridden by setting
`HUBOT_AGGREGATION_FROM_PRIVATE_CONVERSATIONS` to `true`.

`HUBOT_AGGREGATION_CHANNEL` is required. It can be specified as a Slack
ChannelID such as C1234567890 or a string such as "general". Note, the "#"
should not be included.


## Behavior

To reduce noise, in case a message gets several reactions that match the
pattern, a message is only posted to the aggreagation target channel once per
24 hours.

The aggreator does aggreate or repost messages inside the aggreator channel, as
this get into a :turtles: all the way down type situation.

### Limitations

Right now, the 24 hours period is not configurable. Perhaps it should be.

There is exaclty 1 ruleset. It might be nice to have several options for this
like sirens go the incident channel and praying hands go to a thanks channel.
Patches welcome.


# License
MIT
8 changes: 8 additions & 0 deletions hubot-modules/hubot-message-aggregator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict'

const path = require('path')

module.exports = (robot) => {
const scriptsPath = path.resolve(__dirname, 'src')
robot.loadFile(scriptsPath, 'aggregator.js')
}
Loading

0 comments on commit c2e23f3

Please sign in to comment.