Public/Invoke-RestartComputer.ps1

function Invoke-RestartComputer {
    <#
    .SYNOPSIS
        Invokes a restart for the target computer after 30 seconds.
    .PARAMETER ComputerName
        Target computer name
    .EXAMPLE
        !Restart SSCN115
    #>

    [PoshBot.BotCommand(
        CommandName = 'restart',
        Aliases = ('reboot', 'restartcomputer', 'restartpc')
    )]
    [cmdletbinding()]
    param(
        [parameter(Mandatory)]
        [string]$ComputerName
    )

    try {
        Restart-Computer -ComputerName $ComputerName
        New-PoshBotTextResponse -Text "$ComputerName restart invoked!" -AsCode
    }
    catch {
        Write-Output "$($_.Exception.Message)"
        Write-Output "$($_.error.message)"
    }
}