Public/Invoke-SyncAAD.ps1

function Invoke-SyncAAD {
    <#
    .SYNOPSIS
        Invoke a delta synchronization between on-premise Active Directory and Azure Active Directory.
    .EXAMPLE
        !sync
    #>

    [PoshBot.BotCommand(
        CommandName = 'syncaad',
        Aliases = ('sync', 'aad', 'sync-aad')
    )]
    [cmdletbinding()]
    param()
    try {
        $result = Invoke-Command -ComputerName "sun-aad.sunssc.local" -ScriptBlock {
            Start-ADSyncSyncCycle -PolicyType Delta
        }
        New-PoshBotCardResponse -Text ($result | Out-String)
    }
    catch {
        Write-Output "$($_.Exception.Message)"
        Write-Output "$($_.error.message)"
    }
}