Skip to content

Instantly share code, notes, and snippets.

@shaneis
Created January 8, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneis/a51e4864dbaeb7eff53d3100e0b04e1e to your computer and use it in GitHub Desktop.
Save shaneis/a51e4864dbaeb7eff53d3100e0b04e1e to your computer and use it in GitHub Desktop.
function Update-JamesStatus {
[CmdletBinding()]
param(
[Parameter(Position = 1)]
[ValidateNotNullOrEmpty()]
[String]
$SlackTitle = 'James is locked out again...',
[Parameter(Position = 2)]
[ValidateNotNullOrEmpty()]
[String]
$SlackText = '...again.',
[Parameter(Position = 0, Mandatory)]
[ValidateSet('James.ReportWriter')]
[String]
$SlackUser
)
begin { $SlackToken = 'Get-your-own-dont-try-and-use-mine' }
process {
$SlackMessageAttachment = @{
Color = $_PSSlackColorMap.green
Title = $SlackTitle
Text = $SlackText
Fallback = $SlackTitle
}
$SlackMessage = @{
Channel = $SlackUser
IconEmoji = ':bomb:'
AsUser = $true
UserName = 'TFS_Bot'
}
$null = New-SlackMessageAttachment @SlackMessageAttachment |
New-SlackMessage @SlackMessage |
Send-SlackMessage -Token $SlackToken
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment