diff --git a/README.md b/README.md index a3a5cee..4e16272 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ PoshGram provides functionality to send various message types to a specified Tel - **Versatile Messaging**: Send a wide variety of message types, including text, contact, dice, animation, audio, document, photo, sticker, video, location, multi-media, poll, and venue messages. It also supports HTML and Markdown for rich text formatting. - **Interactive Elements**: Incorporate custom keyboards and inline buttons to make your messages interactive. -Sticker Info**: Easily query sticker packs, get sticker information, and send stickers directly through PowerShell commands. +- **Sticker Info**: Easily query sticker packs, get sticker information, and send stickers directly through PowerShell commands. +- **Forum Support**: Send messages to specific forum topics (threads) within forum supergroups using the `MessageThreadID` parameter. - **Notification Control**: Opt to send messages silently or with notifications. - **Content Protection**: Enable features to protect messages from being forwarded or saved. - **Flexible Application**: Use in various scenarios like integrating with task schedulers, alert systems, serverless functions, or automating chat responses. @@ -75,6 +76,9 @@ Test-BotToken -BotToken $botToken # send a basic Text Message Send-TelegramTextMessage -BotToken $botToken -ChatID $chatID -Message 'Hello' #------------------------------------------------------------------------------------------------ +# send a message to a specific forum topic (thread) +Send-TelegramTextMessage -BotToken $botToken -ChatID $chatID -Message 'Hello forum topic!' -MessageThreadID 123 +#------------------------------------------------------------------------------------------------ # get information for a Telegram sticker pack Get-TelegramStickerPackInfo -BotToken $botToken -StickerSetName STPicard #------------------------------------------------------------------------------------------------ diff --git a/docs/Send-TelegramContact.md b/docs/Send-TelegramContact.md index 6266d2c..0237a68 100644 --- a/docs/Send-TelegramContact.md +++ b/docs/Send-TelegramContact.md @@ -14,7 +14,8 @@ Sends Telegram phone contact message via BOT API. ``` Send-TelegramContact [-BotToken] [-ChatID] [-PhoneNumber] [-FirstName] - [[-LastName] ] [-DisableNotification] [-ProtectContent] [] + [[-LastName] ] [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] + [] ``` ## DESCRIPTION @@ -48,6 +49,7 @@ $sendTelegramContactSplat = @{ LastName = $lastName DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramContact @sendTelegramContactSplat @@ -163,6 +165,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramDice.md b/docs/Send-TelegramDice.md index 00fc8a2..845e49d 100644 --- a/docs/Send-TelegramDice.md +++ b/docs/Send-TelegramDice.md @@ -14,7 +14,7 @@ Sends Telegram animated emoji that will display a random value. ``` Send-TelegramDice [-BotToken] [-ChatID] [-Emoji] [-DisableNotification] - [-ProtectContent] [] + [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -42,6 +42,7 @@ $sendTelegramDiceSplat = @{ ChatID = $chatID DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true Emoji = $emoji } @@ -128,6 +129,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramLocalAnimation.md b/docs/Send-TelegramLocalAnimation.md index b89906a..57a3ad8 100644 --- a/docs/Send-TelegramLocalAnimation.md +++ b/docs/Send-TelegramLocalAnimation.md @@ -15,7 +15,7 @@ Sends Telegram animation message via Bot API from locally sourced animation ``` Send-TelegramLocalAnimation [-BotToken] [-ChatID] [-AnimationPath] [[-Caption] ] [[-ParseMode] ] [-HasSpoiler] [-DisableNotification] [-ProtectContent] - [] + [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -49,6 +49,7 @@ $sendTelegramLocalAnimationSplat = @{ HasSpoiler = $true DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramLocalAnimation @sendTelegramLocalAnimationSplat @@ -197,6 +198,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramLocalAudio.md b/docs/Send-TelegramLocalAudio.md index 63ae92e..acf6768 100644 --- a/docs/Send-TelegramLocalAudio.md +++ b/docs/Send-TelegramLocalAudio.md @@ -15,7 +15,8 @@ Sends Telegram audio message via Bot API from locally sourced file ``` Send-TelegramLocalAudio [-BotToken] [-ChatID] [-Audio] [[-Caption] ] [[-ParseMode] ] [[-Duration] ] [[-Performer] ] [[-Title] ] - [[-FileName] ] [-DisableNotification] [-ProtectContent] [] + [[-FileName] ] [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] + [] ``` ## DESCRIPTION @@ -53,6 +54,7 @@ $sendTelegramLocalAudioSplat = @{ FileName = 'halo_on_fire.mp3' DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramLocalAudio @sendTelegramLocalAudioSplat @@ -249,6 +251,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramLocalDocument.md b/docs/Send-TelegramLocalDocument.md index b6a2e91..142ab5e 100644 --- a/docs/Send-TelegramLocalDocument.md +++ b/docs/Send-TelegramLocalDocument.md @@ -15,7 +15,7 @@ Sends Telegram document message via Bot API from locally sourced file ``` Send-TelegramLocalDocument [-BotToken] [-ChatID] [-File] [[-Caption] ] [[-ParseMode] ] [-DisableContentTypeDetection] [-DisableNotification] [-ProtectContent] - [] + [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -48,6 +48,7 @@ $sendTelegramLocalDocumentSplat = @{ ParseMode = 'MarkdownV2' DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramLocalDocument @sendTelegramLocalDocumentSplat @@ -196,6 +197,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramLocalPhoto.md b/docs/Send-TelegramLocalPhoto.md index f14e3e3..6ab4ae7 100644 --- a/docs/Send-TelegramLocalPhoto.md +++ b/docs/Send-TelegramLocalPhoto.md @@ -14,7 +14,8 @@ Sends Telegram photo message via Bot API from locally sourced photo image ``` Send-TelegramLocalPhoto [-BotToken] [-ChatID] [-PhotoPath] [[-Caption] ] - [[-ParseMode] ] [-HasSpoiler] [-DisableNotification] [-ProtectContent] [] + [[-ParseMode] ] [-HasSpoiler] [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] + [] ``` ## DESCRIPTION @@ -48,6 +49,7 @@ $sendTelegramLocalPhotoSplat = @{ HasSpoiler = $true DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramLocalPhoto @sendTelegramLocalPhotoSplat @@ -196,6 +198,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramLocalSticker.md b/docs/Send-TelegramLocalSticker.md index 82e2a40..d09a51e 100644 --- a/docs/Send-TelegramLocalSticker.md +++ b/docs/Send-TelegramLocalSticker.md @@ -14,7 +14,7 @@ Sends Telegram sticker message via Bot API from locally sourced sticker image ``` Send-TelegramLocalSticker [-BotToken] [-ChatID] [-StickerPath] [[-Emoji] ] - [-DisableNotification] [-ProtectContent] [] + [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -45,6 +45,7 @@ $sendTelegramLocalStickerSplat = @{ Emoji = '😀' DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramLocalSticker @sendTelegramLocalStickerSplat @@ -145,6 +146,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramLocalVideo.md b/docs/Send-TelegramLocalVideo.md index df8d100..e9a8ae9 100644 --- a/docs/Send-TelegramLocalVideo.md +++ b/docs/Send-TelegramLocalVideo.md @@ -15,7 +15,8 @@ Sends Telegram video message via Bot API from locally sourced file ``` Send-TelegramLocalVideo [-BotToken] [-ChatID] [-Video] [[-Duration] ] [[-Width] ] [[-Height] ] [[-FileName] ] [[-Caption] ] [[-ParseMode] ] - [-HasSpoiler] [-Streaming] [-DisableNotification] [-ProtectContent] [] + [-HasSpoiler] [-Streaming] [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] + [] ``` ## DESCRIPTION @@ -55,6 +56,7 @@ $sendTelegramLocalVideoSplat = @{ Streaming = $true DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramLocalVideo @sendTelegramLocalVideoSplat @@ -280,6 +282,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramLocation.md b/docs/Send-TelegramLocation.md index c8f1444..9b85645 100644 --- a/docs/Send-TelegramLocation.md +++ b/docs/Send-TelegramLocation.md @@ -14,7 +14,7 @@ Sends Telegram location to indicate point on map ``` Send-TelegramLocation [-BotToken] [-ChatID] [-Latitude] [-Longitude] - [-DisableNotification] [-ProtectContent] [] + [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -44,6 +44,7 @@ $sendTelegramLocationSplat = @{ Longitude = $longitude DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramLocation @sendTelegramLocationSplat @@ -144,6 +145,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramMediaGroup.md b/docs/Send-TelegramMediaGroup.md index 6f287b3..cc554e3 100644 --- a/docs/Send-TelegramMediaGroup.md +++ b/docs/Send-TelegramMediaGroup.md @@ -14,7 +14,7 @@ Sends Telegram a group of photos, videos, documents, or audios as an album via B ``` Send-TelegramMediaGroup [-BotToken] [-ChatID] [-MediaType] [[-FilePaths] ] - [-DisableNotification] [-ProtectContent] [] + [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -72,6 +72,7 @@ $sendTelegramMediaGroupSplat = @{ FilePaths = $vFiles DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 } Send-TelegramMediaGroup @sendTelegramMediaGroupSplat ``` @@ -171,6 +172,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramPoll.md b/docs/Send-TelegramPoll.md index 8bfedc6..bf2db61 100644 --- a/docs/Send-TelegramPoll.md +++ b/docs/Send-TelegramPoll.md @@ -17,7 +17,7 @@ Sends Telegram native poll. Send-TelegramPoll -BotToken -ChatID -Question -Options [-IsAnonymous ] [-PollType ] [-MultipleAnswers ] [-QuizAnswer ] [-Explanation ] [-ExplanationParseMode ] [-DisableNotification] [-ProtectContent] - [] + [[-MessageThreadID] ] [] ``` ### OpenPeriod @@ -25,7 +25,7 @@ Send-TelegramPoll -BotToken -ChatID -Question -Option Send-TelegramPoll -BotToken -ChatID -Question -Options [-IsAnonymous ] [-PollType ] [-MultipleAnswers ] [-QuizAnswer ] [-Explanation ] [-ExplanationParseMode ] [-OpenPeriod ] [-DisableNotification] - [-ProtectContent] [] + [-ProtectContent] [[-MessageThreadID] ] [] ``` ### OpenDate @@ -33,7 +33,7 @@ Send-TelegramPoll -BotToken -ChatID -Question -Option Send-TelegramPoll -BotToken -ChatID -Question -Options [-IsAnonymous ] [-PollType ] [-MultipleAnswers ] [-QuizAnswer ] [-Explanation ] [-ExplanationParseMode ] [-CloseDate ] [-DisableNotification] - [-ProtectContent] [] + [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -76,6 +76,7 @@ $sendTelegramPollSplat = @{ Options = $opt DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 IsAnonymous = $true PollType = 'regular' MultipleAnswers = $false @@ -391,6 +392,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramSticker.md b/docs/Send-TelegramSticker.md index 6f6347a..9444ca3 100644 --- a/docs/Send-TelegramSticker.md +++ b/docs/Send-TelegramSticker.md @@ -15,25 +15,25 @@ Sends Telegram sticker message via Bot API by file_id or sticker pack emoji. ### FileEmojiG ``` Send-TelegramSticker [-BotToken ] [-ChatID ] [-StickerSetName ] [-ShortCode ] - [-DisableNotification] [-ProtectContent] [] + [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] [] ``` ### FileIDG ``` Send-TelegramSticker [-BotToken ] [-ChatID ] [-FileID ] [-DisableNotification] - [-ProtectContent] [] + [-ProtectContent] [[-MessageThreadID] ] [] ``` ### ByFileID ``` Send-TelegramSticker -BotToken -ChatID -FileID [-DisableNotification] - [-ProtectContent] [] + [-ProtectContent] [[-MessageThreadID] ] [] ``` ### BySPShortCode ``` Send-TelegramSticker -BotToken -ChatID -StickerSetName -ShortCode - [-DisableNotification] [-ProtectContent] [] + [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -67,6 +67,7 @@ $sendTelegramStickerSplat = @{ FileID = $sticker DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramSticker @sendTelegramStickerSplat @@ -270,6 +271,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramTextMessage.md b/docs/Send-TelegramTextMessage.md index d3e8a0a..88382d8 100644 --- a/docs/Send-TelegramTextMessage.md +++ b/docs/Send-TelegramTextMessage.md @@ -15,7 +15,7 @@ Send a text message via Telegram Bot API. ``` Send-TelegramTextMessage [-BotToken] [-ChatID] [-Message] [[-ParseMode] ] [[-LinkPreviewURL] ] [[-LinkPreviewOption] ] [-LinkPreviewAboveText] [[-Keyboard] ] - [-DisableNotification] [-ProtectContent] [] + [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -213,6 +213,20 @@ Sends text message via Telegram Bot API and enables the 'LinkPreview' feature. When 'LinkPreview' is set to Small, it will generate a small link preview for the provided url. When 'LinkPreviewAboveText' is set to $true, it will display the link preview above the message text. +### EXAMPLE 10 +``` +$sendTelegramTextMessageSplat = @{ + BotToken = $botToken + ChatID = $chatID + Message = 'Sending a message to a specific forum topic' + MessageThreadID = 123 +} +Send-TelegramTextMessage @sendTelegramTextMessageSplat +``` + +Sends text message via Telegram Bot API to a specific forum topic (thread) within a forum supergroup. +When 'MessageThreadID' is specified, the message will be posted to that specific topic rather than the root chat. + ## PARAMETERS ### -BotToken @@ -371,6 +385,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramURLAnimation.md b/docs/Send-TelegramURLAnimation.md index 818ca29..a27360d 100644 --- a/docs/Send-TelegramURLAnimation.md +++ b/docs/Send-TelegramURLAnimation.md @@ -14,7 +14,8 @@ Sends Telegram animation message via Bot API from URL sourced animation image ``` Send-TelegramURLAnimation [-BotToken] [-ChatID] [-AnimationURL] - [[-Caption] ] [[-ParseMode] ] [-DisableNotification] [-ProtectContent] [] + [[-Caption] ] [[-ParseMode] ] [-DisableNotification] [-ProtectContent] + [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -46,6 +47,7 @@ $sendTelegramURLAnimationSplat = @{ Caption = 'Live long, and prosper.' DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramURLAnimation @sendTelegramURLAnimationSplat @@ -179,6 +181,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramURLAudio.md b/docs/Send-TelegramURLAudio.md index 209e2a9..7db926e 100644 --- a/docs/Send-TelegramURLAudio.md +++ b/docs/Send-TelegramURLAudio.md @@ -15,7 +15,8 @@ Sends Telegram audio message via Bot API from URL sourced file ``` Send-TelegramURLAudio [-BotToken] [-ChatID] [-AudioURL] [[-Caption] ] [[-ParseMode] ] [[-Duration] ] [[-Performer] ] [[-Title] ] - [[-FileName] ] [-DisableNotification] [-ProtectContent] [] + [[-FileName] ] [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] + [] ``` ## DESCRIPTION @@ -53,6 +54,7 @@ $sendTelegramURLAudioSplat = @{ FileName = 'halo_on_fire.mp3' DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramURLAudio @sendTelegramURLAudioSplat @@ -249,6 +251,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramURLDocument.md b/docs/Send-TelegramURLDocument.md index 4eaa303..6a61b86 100644 --- a/docs/Send-TelegramURLDocument.md +++ b/docs/Send-TelegramURLDocument.md @@ -15,7 +15,7 @@ Sends Telegram document message via Bot API from URL sourced file ``` Send-TelegramURLDocument [-BotToken] [-ChatID] [-FileURL] [[-Caption] ] [[-ParseMode] ] [-DisableContentTypeDetection] [-DisableNotification] [-ProtectContent] - [] + [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -49,6 +49,7 @@ $sendTelegramURLDocumentSplat = @{ ParseMode = 'MarkdownV2' DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramURLDocument @sendTelegramURLDocumentSplat @@ -197,6 +198,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramURLPhoto.md b/docs/Send-TelegramURLPhoto.md index feefc06..9e4bb46 100644 --- a/docs/Send-TelegramURLPhoto.md +++ b/docs/Send-TelegramURLPhoto.md @@ -14,7 +14,8 @@ Sends Telegram photo message via Bot API from URL sourced photo image ``` Send-TelegramURLPhoto [-BotToken] [-ChatID] [-PhotoURL] [[-Caption] ] - [[-ParseMode] ] [-DisableNotification] [-ProtectContent] [] + [[-ParseMode] ] [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] + [] ``` ## DESCRIPTION @@ -47,6 +48,7 @@ $sendTelegramURLPhotoSplat = @{ ParseMode = 'MarkdownV2' DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramURLPhoto @sendTelegramURLPhotoSplat @@ -180,6 +182,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramURLSticker.md b/docs/Send-TelegramURLSticker.md index 3a1e5ad..5661176 100644 --- a/docs/Send-TelegramURLSticker.md +++ b/docs/Send-TelegramURLSticker.md @@ -14,7 +14,7 @@ Sends Telegram sticker message via Bot API from URL sourced sticker image ``` Send-TelegramURLSticker [-BotToken] [-ChatID] [-StickerURL] [-DisableNotification] - [-ProtectContent] [] + [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -44,6 +44,7 @@ $sendTelegramURLStickerSplat = @{ StickerURL = $stickerURL DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramURLSticker @sendTelegramURLStickerSplat @@ -129,6 +130,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramURLVideo.md b/docs/Send-TelegramURLVideo.md index aae7730..28c6990 100644 --- a/docs/Send-TelegramURLVideo.md +++ b/docs/Send-TelegramURLVideo.md @@ -15,7 +15,7 @@ Sends Telegram video message via Bot API from URL sourced file ``` Send-TelegramURLVideo [-BotToken] [-ChatID] [-VideoURL] [[-Duration] ] [[-Width] ] [[-Height] ] [[-FileName] ] [[-Caption] ] [[-ParseMode] ] - [-Streaming] [-DisableNotification] [-ProtectContent] [] + [-Streaming] [-DisableNotification] [-ProtectContent] [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -54,6 +54,7 @@ $sendTelegramURLVideoSplat = @{ Streaming = $true DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramURLVideo @sendTelegramURLVideoSplat @@ -263,6 +264,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Send-TelegramVenue.md b/docs/Send-TelegramVenue.md index a9cbb38..dd86323 100644 --- a/docs/Send-TelegramVenue.md +++ b/docs/Send-TelegramVenue.md @@ -14,7 +14,8 @@ Sends Telegram information about a venue. ``` Send-TelegramVenue [-BotToken] [-ChatID] [-Latitude] [-Longitude] - [-Title] [-Address] [-DisableNotification] [-ProtectContent] [] + [-Title] [-Address] [-DisableNotification] [-ProtectContent] + [[-MessageThreadID] ] [] ``` ## DESCRIPTION @@ -52,6 +53,7 @@ $sendTelegramVenueSplat = @{ Address = $address DisableNotification = $true ProtectContent = $true + MessageThreadID = 123 Verbose = $true } Send-TelegramVenue @sendTelegramVenueSplat @@ -182,6 +184,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MessageThreadID +Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/index.md b/docs/index.md index 67abc1f..654865d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -156,7 +156,8 @@ To begin using PoshGram, ensure your bot token is set up and the bot is added to - **Versatile Messaging**: Send a wide variety of message types, including text, contact, dice, animation, audio, document, photo, sticker, video, location, multi-media, poll, and venue messages. It also supports HTML and Markdown for rich text formatting. - **Interactive Elements**: Incorporate custom keyboards and inline buttons to make your messages interactive. -Sticker Info**: Easily query sticker packs, get sticker information, and send stickers directly through PowerShell commands. +- **Sticker Info**: Easily query sticker packs, get sticker information, and send stickers directly through PowerShell commands. +- **Forum Support**: Send messages to specific forum topics (threads) within forum supergroups using the `MessageThreadID` parameter. - **Notification Control**: Opt to send messages silently or with notifications. - **Content Protection**: Enable features to protect messages from being forwarded or saved. - **Flexible Application**: Use in various scenarios like integrating with task schedulers, alert systems, serverless functions, or automating chat responses. diff --git a/src/PoshGram/Public/Send-TelegramContact.ps1 b/src/PoshGram/Public/Send-TelegramContact.ps1 index a93d8cf..a563149 100644 --- a/src/PoshGram/Public/Send-TelegramContact.ps1 +++ b/src/PoshGram/Public/Send-TelegramContact.ps1 @@ -44,6 +44,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -102,7 +104,12 @@ function Send-TelegramContact { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -116,6 +123,10 @@ function Send-TelegramContact { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendContact' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramDice.ps1 b/src/PoshGram/Public/Send-TelegramDice.ps1 index 7bcd2e1..38ce2b9 100644 --- a/src/PoshGram/Public/Send-TelegramDice.ps1 +++ b/src/PoshGram/Public/Send-TelegramDice.ps1 @@ -35,6 +35,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -82,7 +84,12 @@ function Send-TelegramDice { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -115,6 +122,10 @@ function Send-TelegramDice { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendDice' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramLocalAnimation.ps1 b/src/PoshGram/Public/Send-TelegramLocalAnimation.ps1 index b1cd596..a397529 100644 --- a/src/PoshGram/Public/Send-TelegramLocalAnimation.ps1 +++ b/src/PoshGram/Public/Send-TelegramLocalAnimation.ps1 @@ -58,6 +58,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -135,7 +137,12 @@ function Send-TelegramLocalAnimation { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -185,6 +192,10 @@ function Send-TelegramLocalAnimation { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendAnimation' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramLocalAudio.ps1 b/src/PoshGram/Public/Send-TelegramLocalAudio.ps1 index 0f5efa4..8be5d81 100644 --- a/src/PoshGram/Public/Send-TelegramLocalAudio.ps1 +++ b/src/PoshGram/Public/Send-TelegramLocalAudio.ps1 @@ -72,6 +72,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -159,7 +161,12 @@ function Send-TelegramLocalAudio { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -212,6 +219,10 @@ function Send-TelegramLocalAudio { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendAudio' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramLocalDocument.ps1 b/src/PoshGram/Public/Send-TelegramLocalDocument.ps1 index fcba0f7..1a7ca97 100644 --- a/src/PoshGram/Public/Send-TelegramLocalDocument.ps1 +++ b/src/PoshGram/Public/Send-TelegramLocalDocument.ps1 @@ -41,6 +41,20 @@ Send-TelegramLocalDocument @sendTelegramLocalDocumentSplat Sends document message via Telegram API with properly formatted underlined word and escaped special character. +.EXAMPLE + $botToken = 'nnnnnnnnn:xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxx' + $chatID = '-nnnnnnnnn' + $file = 'C:\Logs\Log1.txt' + $sendTelegramLocalDocumentSplat = @{ + BotToken = $botToken + ChatID = $chatID + File = $file + Caption = 'Document sent to a specific forum topic' + MessageThreadID = 123 + } + Send-TelegramLocalDocument @sendTelegramLocalDocumentSplat + + Sends document message via Telegram API to a specific forum topic (thread) within a forum supergroup. .PARAMETER BotToken Use this token to access the HTTP API .PARAMETER ChatID @@ -55,6 +69,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -127,7 +143,12 @@ function Send-TelegramLocalDocument { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -168,6 +189,10 @@ function Send-TelegramLocalDocument { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendDocument' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramLocalPhoto.ps1 b/src/PoshGram/Public/Send-TelegramLocalPhoto.ps1 index 41a5915..c57a8dc 100644 --- a/src/PoshGram/Public/Send-TelegramLocalPhoto.ps1 +++ b/src/PoshGram/Public/Send-TelegramLocalPhoto.ps1 @@ -42,6 +42,20 @@ Send-TelegramLocalPhoto @sendTelegramLocalPhotoSplat Sends photo message via Telegram API with properly formatted underlined word and escaped special character. +.EXAMPLE + $botToken = 'nnnnnnnnn:xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxx' + $chatID = '-nnnnnnnnn' + $photo = 'C:\photos\aphoto.jpg' + $sendTelegramLocalPhotoSplat = @{ + BotToken = $botToken + ChatID = $chatID + PhotoPath = $photo + Caption = 'Photo sent to a specific forum topic' + MessageThreadID = 123 + } + Send-TelegramLocalPhoto @sendTelegramLocalPhotoSplat + + Sends photo message via Telegram API to a specific forum topic (thread) within a forum supergroup. .PARAMETER BotToken Use this token to access the HTTP API .PARAMETER ChatID @@ -58,6 +72,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -133,7 +149,12 @@ function Send-TelegramLocalPhoto { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -183,6 +204,10 @@ function Send-TelegramLocalPhoto { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendphoto' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramLocalSticker.ps1 b/src/PoshGram/Public/Send-TelegramLocalSticker.ps1 index 0f05254..82dbd61 100644 --- a/src/PoshGram/Public/Send-TelegramLocalSticker.ps1 +++ b/src/PoshGram/Public/Send-TelegramLocalSticker.ps1 @@ -96,7 +96,12 @@ function Send-TelegramLocalSticker { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -145,6 +150,10 @@ function Send-TelegramLocalSticker { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + if ($Emoji) { $form.Add('emoji', $Emoji) } #if_emoji diff --git a/src/PoshGram/Public/Send-TelegramLocalVideo.ps1 b/src/PoshGram/Public/Send-TelegramLocalVideo.ps1 index e3234ab..d4cd81e 100644 --- a/src/PoshGram/Public/Send-TelegramLocalVideo.ps1 +++ b/src/PoshGram/Public/Send-TelegramLocalVideo.ps1 @@ -75,6 +75,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -179,7 +181,12 @@ function Send-TelegramLocalVideo { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -234,6 +241,10 @@ function Send-TelegramLocalVideo { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendVideo' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramLocation.ps1 b/src/PoshGram/Public/Send-TelegramLocation.ps1 index 65791d6..3e5cde3 100644 --- a/src/PoshGram/Public/Send-TelegramLocation.ps1 +++ b/src/PoshGram/Public/Send-TelegramLocation.ps1 @@ -38,6 +38,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -91,7 +93,12 @@ function Send-TelegramLocation { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -104,6 +111,10 @@ function Send-TelegramLocation { protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendLocation' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramMediaGroup.ps1 b/src/PoshGram/Public/Send-TelegramMediaGroup.ps1 index 3b5fb41..f245d9c 100644 --- a/src/PoshGram/Public/Send-TelegramMediaGroup.ps1 +++ b/src/PoshGram/Public/Send-TelegramMediaGroup.ps1 @@ -126,7 +126,12 @@ function Send-TelegramMediaGroup { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -147,6 +152,9 @@ function Send-TelegramMediaGroup { protect_content = $ProtectContent.IsPresent media = '' } + if ($MessageThreadID) { + $form['message_thread_id'] = $MessageThreadID + } $json = @' [ diff --git a/src/PoshGram/Public/Send-TelegramPoll.ps1 b/src/PoshGram/Public/Send-TelegramPoll.ps1 index 549e916..3c480a1 100644 --- a/src/PoshGram/Public/Send-TelegramPoll.ps1 +++ b/src/PoshGram/Public/Send-TelegramPoll.ps1 @@ -254,7 +254,12 @@ function Send-TelegramPoll { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -277,6 +282,9 @@ function Send-TelegramPoll { type = $PollType allows_multiple_answers = $MultipleAnswers } #form + if ($MessageThreadID) { + $form['message_thread_id'] = $MessageThreadID + } if ($PollType -eq 'quiz') { Write-Verbose -Message 'Processing quiz...' diff --git a/src/PoshGram/Public/Send-TelegramSticker.ps1 b/src/PoshGram/Public/Send-TelegramSticker.ps1 index e48adf4..8597177 100644 --- a/src/PoshGram/Public/Send-TelegramSticker.ps1 +++ b/src/PoshGram/Public/Send-TelegramSticker.ps1 @@ -3912,7 +3912,12 @@ function Send-TelegramSticker { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -3944,6 +3949,9 @@ function Send-TelegramSticker { disable_notification = $DisableNotification.IsPresent protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form['message_thread_id'] = $MessageThreadID + } $uri = 'https://api.telegram.org/bot{0}/sendSticker' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramTextMessage.ps1 b/src/PoshGram/Public/Send-TelegramTextMessage.ps1 index dc36f26..d61379d 100644 --- a/src/PoshGram/Public/Send-TelegramTextMessage.ps1 +++ b/src/PoshGram/Public/Send-TelegramTextMessage.ps1 @@ -156,6 +156,16 @@ Send-TelegramTextMessage @sendTelegramTextMessageSplat Sends text message via Telegram Bot API and enables the 'LinkPreview' feature. When 'LinkPreview' is set to Small, it will generate a small link preview for the provided url. When 'LinkPreviewAboveText' is set to $true, it will display the link preview above the message text. +.EXAMPLE + $sendTelegramTextMessageSplat = @{ + BotToken = $botToken + ChatID = $chatID + Message = 'Sending a message to a specific forum topic' + MessageThreadID = 123 + } + Send-TelegramTextMessage @sendTelegramTextMessageSplat + + Sends text message via Telegram Bot API to a specific forum topic (thread) within a forum supergroup. When 'MessageThreadID' is specified, the message will be posted to that specific topic rather than the root chat. .PARAMETER BotToken Use this token to access the HTTP API .PARAMETER ChatID @@ -176,6 +186,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -269,7 +281,12 @@ function Send-TelegramTextMessage { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -314,6 +331,10 @@ function Send-TelegramTextMessage { $payload.Add('reply_markup', $Keyboard) } + if ($MessageThreadID) { + $payload.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendMessage' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramURLAnimation.ps1 b/src/PoshGram/Public/Send-TelegramURLAnimation.ps1 index 103822d..890fe49 100644 --- a/src/PoshGram/Public/Send-TelegramURLAnimation.ps1 +++ b/src/PoshGram/Public/Send-TelegramURLAnimation.ps1 @@ -120,7 +120,12 @@ function Send-TelegramURLAnimation { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -151,6 +156,9 @@ function Send-TelegramURLAnimation { disable_notification = $DisableNotification.IsPresent protect_content = $ProtectContent.IsPresent } #payload + if ($MessageThreadID) { + $payload['message_thread_id'] = $MessageThreadID + } $uri = 'https://api.telegram.org/bot{0}/sendAnimation' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramURLAudio.ps1 b/src/PoshGram/Public/Send-TelegramURLAudio.ps1 index 0bbbf22..164d50d 100644 --- a/src/PoshGram/Public/Send-TelegramURLAudio.ps1 +++ b/src/PoshGram/Public/Send-TelegramURLAudio.ps1 @@ -157,7 +157,12 @@ function Send-TelegramURLAudio { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -192,6 +197,9 @@ function Send-TelegramURLAudio { disable_notification = $DisableNotification.IsPresent protect_content = $ProtectContent.IsPresent } #payload + if ($MessageThreadID) { + $payload['message_thread_id'] = $MessageThreadID + } $uri = 'https://api.telegram.org/bot{0}/sendAudio' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramURLDocument.ps1 b/src/PoshGram/Public/Send-TelegramURLDocument.ps1 index 6e5610a..e97b295 100644 --- a/src/PoshGram/Public/Send-TelegramURLDocument.ps1 +++ b/src/PoshGram/Public/Send-TelegramURLDocument.ps1 @@ -55,6 +55,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -127,7 +129,12 @@ function Send-TelegramURLDocument { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -160,6 +167,10 @@ function Send-TelegramURLDocument { protect_content = $ProtectContent.IsPresent } #payload + if ($MessageThreadID) { + $payload.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendDocument' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramURLPhoto.ps1 b/src/PoshGram/Public/Send-TelegramURLPhoto.ps1 index 9d2a38f..2608257 100644 --- a/src/PoshGram/Public/Send-TelegramURLPhoto.ps1 +++ b/src/PoshGram/Public/Send-TelegramURLPhoto.ps1 @@ -55,6 +55,8 @@ Send the message silently. Users will receive a notification with no sound. .PARAMETER ProtectContent Protects the contents of the sent message from forwarding and saving +.PARAMETER MessageThreadID + Unique identifier for the target message thread (topic) of the forum; for forum supergroups only .OUTPUTS System.Management.Automation.PSCustomObject .NOTES @@ -121,7 +123,12 @@ function Send-TelegramURLPhoto { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -153,6 +160,10 @@ function Send-TelegramURLPhoto { protect_content = $ProtectContent.IsPresent } #payload + if ($MessageThreadID) { + $payload.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendphoto' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramURLSticker.ps1 b/src/PoshGram/Public/Send-TelegramURLSticker.ps1 index 7f9c57c..077a8b4 100644 --- a/src/PoshGram/Public/Send-TelegramURLSticker.ps1 +++ b/src/PoshGram/Public/Send-TelegramURLSticker.ps1 @@ -86,7 +86,12 @@ function Send-TelegramURLSticker { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -115,6 +120,9 @@ function Send-TelegramURLSticker { disable_notification = $DisableNotification.IsPresent protect_content = $ProtectContent.IsPresent } #payload + if ($MessageThreadID) { + $payload['message_thread_id'] = $MessageThreadID + } $uri = 'https://api.telegram.org/bot{0}/sendSticker' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramURLVideo.ps1 b/src/PoshGram/Public/Send-TelegramURLVideo.ps1 index 72e0b0a..f69228c 100644 --- a/src/PoshGram/Public/Send-TelegramURLVideo.ps1 +++ b/src/PoshGram/Public/Send-TelegramURLVideo.ps1 @@ -172,7 +172,12 @@ function Send-TelegramURLVideo { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -209,6 +214,10 @@ function Send-TelegramURLVideo { protect_content = $ProtectContent.IsPresent } #payload + if ($MessageThreadID) { + $payload.Add('message_thread_id', $MessageThreadID) + } + $uri = 'https://api.telegram.org/bot{0}/sendVideo' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri) diff --git a/src/PoshGram/Public/Send-TelegramVenue.ps1 b/src/PoshGram/Public/Send-TelegramVenue.ps1 index c093dde..e3b45a2 100644 --- a/src/PoshGram/Public/Send-TelegramVenue.ps1 +++ b/src/PoshGram/Public/Send-TelegramVenue.ps1 @@ -115,7 +115,12 @@ function Send-TelegramVenue { [Parameter(Mandatory = $false, HelpMessage = 'Protects the contents of the sent message from forwarding and saving')] - [switch]$ProtectContent + [switch]$ProtectContent, + + [Parameter(Mandatory = $false, + HelpMessage = 'Unique identifier for the target message thread (topic) of the forum; for forum supergroups only')] + [ValidateRange(1, [int]::MaxValue)] + [int]$MessageThreadID ) Write-Verbose -Message ('Starting: {0}' -f $MyInvocation.Mycommand) @@ -129,6 +134,9 @@ function Send-TelegramVenue { disable_notification = $DisableNotification.IsPresent protect_content = $ProtectContent.IsPresent } #form + if ($MessageThreadID) { + $form['message_thread_id'] = $MessageThreadID + } $uri = 'https://api.telegram.org/bot{0}/sendVenue' -f $BotToken Write-Debug -Message ('Base URI: {0}' -f $uri)