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