Skip to content

Commit

Permalink
Channel info (#70)
Browse files Browse the repository at this point in the history
feat(channel): make channel information available
  • Loading branch information
wass3r authored and JordanSussman committed Oct 25, 2018
1 parent 71d5f56 commit 348f7f9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 44 deletions.
70 changes: 26 additions & 44 deletions .vscode/tasks.json
@@ -1,45 +1,27 @@
{
"version": "2.0.0",
"tasks": [{
"label": "build-debug",
"type": "shell",
"command": "go",
"group": "build",
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared"
},
"args": [
"build",
"-i",
"-gcflags",
"'-N -l'"
],
"linux": {
"args": [
"-o",
"debug",
"${workspaceRoot}/cmd/flottbot/main.go"
]
},
"osx": {
"args": [
"-o",
"debug",
"${workspaceRoot}/cmd/flottbot/main.go"
]
},
"windows": {
"args": [
"-o",
"debug.exe",
"\"${workspaceRoot}\\cmd\\flottbot\\main.go\""
]
},
"problemMatcher": [
"$go"
]
}]
}
"version": "2.0.0",
"tasks": [
{
"label": "build-debug",
"type": "shell",
"command": "go",
"group": "build",
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared"
},
"args": [
"build",
"-i",
"-gcflags",
"'-N -l'",
"-o",
"debug",
"${workspaceFolder}/cmd/flottbot/main.go"
],
"problemMatcher": ["$go"]
}
]
}
3 changes: 3 additions & 0 deletions remote/discord/helper.go
Expand Up @@ -30,6 +30,9 @@ func populateMessage(message models.Message, msgType models.MessageType, channel
// message.ChannelName = name
// }

message.Vars["_channel.id"] = channel
message.Vars["_channel.name"] = channel

// Populate message user sender
// These will be accessible on rules via ${_user.email}, etc
if user != nil { // nil user implies a message from an api/bot (i.e. not an actual user)
Expand Down
4 changes: 4 additions & 0 deletions remote/slack/helper.go
Expand Up @@ -396,6 +396,10 @@ func populateMessage(message models.Message, msgType models.MessageType, channel
message.ChannelName = name
}

// make channel variables available
message.Vars["_channel.id"] = message.ChannelID
message.Vars["_channel.name"] = message.ChannelName // will be empty if it came via DM

// Populate message with user information (i.e. who sent the message)
// These will be accessible on rules via ${_user.email}, ${_user.id}, etc.
if user != nil { // nil user implies a message from an api/bot (i.e. not an actual user)
Expand Down

0 comments on commit 348f7f9

Please sign in to comment.