Created
January 8, 2019 14:06
-
-
Save shaneis/a51e4864dbaeb7eff53d3100e0b04e1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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