Add modules for Discord

This commit is contained in:
Alex Kup 2024-01-17 18:43:19 +03:00 committed by GitHub
parent 5d692b9b45
commit 16132c92a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1,14 @@
function Send-DiscordChannel {
param (
$Token,
$Channel,
$Text
)
$URL = "https://discordapp.com/api/channels/$Channel/messages"
$Body = @{
content = $Text
} | ConvertTo-Json
curl -s $URL -X POST -H "Authorization: Bot $Token" -H "Content-Type: application/json" -d $Body
}
# Send-DiscordChannel -Token $DISCORD_TOKEN -Channel $DISCORD_CHANNEL_ID -Text "Test message from PowerShell"