PS-Commands/Scripts/Send-ToTelegram.psm1

18 lines
460 B
PowerShell
Raw Normal View History

2023-11-03 16:25:24 +03:00
function Send-ToTelegram {
param (
2024-01-18 18:52:30 +03:00
[Parameter(Mandatory = $True)]$Text,
$Token = "687...:AAF...",
$Chat = "125468108",
$Keyboard
2023-11-03 16:25:24 +03:00
)
2024-01-18 18:52:30 +03:00
$endpoint = "sendMessage"
$url = "https://api.telegram.org/bot$Token/$endpoint"
$Body = @{
chat_id = $Chat
text = $Text
}
if ($keyboard -ne $null) {
$Body += @{reply_markup = $keyboard}
}
Invoke-RestMethod -Uri $url -Body $Body
2023-11-03 16:25:24 +03:00
}