Public/Emoji/Get-RandomSlackEmoji.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function Get-RandomSlackEmoji {
    <#
    .SYNOPSIS
        Returns a random Slack Emoji
    .DESCRIPTION
        This function returns a random Slack Emoji based on tags.
    .PARAMETER tag
        A string the designates the desired category of emoji from which to select.
    .EXAMPLE
        Get-RandomSlackEmoji -tag "person"
    #>

    [cmdletbinding()]
    param(
        [string]
        $tag
    )
    $emoji = (Get-Content -Path .\PSlickPSlack\Private\Emoji\SlackEmoji.json | ConvertFrom-Json) | Where-Object -Property "Tags" -Contains $tag | Get-Random
    return $emoji
}