Skip to content

Commit

Permalink
updated help for Send-TelegramTextMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
techthoughts2 committed Dec 27, 2023
1 parent 3ca8ae4 commit cc35e39
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 29 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

- Module Changes
- Updated help for all functions
- Build Updates
- AWS Deployment Updates
- Updated CodeBuild containers from `aws/codebuild/standard:6.0` to `aws/codebuild/standard:7.0`
Expand Down
4 changes: 2 additions & 2 deletions docs/PoshGram.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Name: PoshGram
Module Guid: 277b92bc-0ea9-4659-8f6c-ed5a1dfdfda2
Download Help Link: NA
Help Version: 2.3.0
Help Version: 2.3.1
Locale: en-US
---

Expand Down Expand Up @@ -51,7 +51,7 @@ Sends Telegram native poll.
Sends Telegram sticker message via Bot API by file_id or sticker pack emoji.

### [Send-TelegramTextMessage](Send-TelegramTextMessage.md)
Sends Telegram text message via Bot API
Send a text message via Telegram Bot API.

### [Send-TelegramURLAnimation](Send-TelegramURLAnimation.md)
Sends Telegram animation message via Bot API from URL sourced animation image
Expand Down
42 changes: 28 additions & 14 deletions docs/Send-TelegramTextMessage.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
external help file: PoshGram-help.xml
Module Name: PoshGram
online version: https://github.com/techthoughts2/PoshGram/blob/main/docs/Send-TelegramTextMessage.md
online version: https://poshgram.readthedocs.io/en/latest/Send-TelegramTextMessage/
schema: 2.0.0
---

# Send-TelegramTextMessage

## SYNOPSIS
Sends Telegram text message via Bot API
Send a text message via Telegram Bot API.

## SYNTAX

Expand All @@ -21,6 +21,9 @@ Send-TelegramTextMessage [-BotToken] <String> [-ChatID] <String> [-Message] <Str
Uses Telegram Bot API to send text message to specified Telegram chat.
Several options can be specified to adjust message parameters.

Interfaces with the Telegram Bot API to send text messages to a specified Telegram chat.
It supports various messaging options, including different parse modes, message delivery options, and custom keyboards.

## EXAMPLES

### EXAMPLE 1
Expand All @@ -30,7 +33,7 @@ $chat = '-nnnnnnnnn'
Send-TelegramTextMessage -BotToken $botToken -ChatID $chat -Message "Hello"
```

Sends text message via Telegram API
Sends text message via Telegram Bot API.

### EXAMPLE 2
```
Expand All @@ -54,7 +57,8 @@ $sendTelegramTextMessageSplat = @{
Send-TelegramTextMessage @sendTelegramTextMessageSplat
```

Sends text message via Telegram API with properly formatted default HTML syntax.
Sends a text message through the Telegram Bot API using HTML for text formatting.
This example illustrates how to apply various HTML tags like bold, italic, underline, strikethrough, and more to create richly formatted messages.

### EXAMPLE 3
```
Expand All @@ -80,6 +84,9 @@ Send-TelegramTextMessage @sendTelegramTextMessageSplat

Sends text message via Telegram API with properly formatted MarkdownV2 syntax.

Sends a text message via the Telegram Bot API using MarkdownV2 syntax for text formatting.
This example showcases the use of various MarkdownV2 formatting options, such as bold, italic, underline, strikethrough, and more, to create richly formatted messages.

### EXAMPLE 4
```
$sendTelegramTextMessageSplat = @{
Expand All @@ -91,7 +98,8 @@ $sendTelegramTextMessageSplat = @{
Send-TelegramTextMessage @sendTelegramTextMessageSplat
```

Sends text message via Telegram API using MarkdownV2 with an underlined word and a properly escaped character.
Sends text message via Telegram Bot API using MarkdownV2 syntax for text formatting.
This example showcases an underlined word and a properly escaped character.

### EXAMPLE 5
```
Expand All @@ -104,7 +112,8 @@ $sendTelegramTextMessageSplat = @{
Send-TelegramTextMessage @sendTelegramTextMessageSplat
```

Sends text message via Telegram API with two properly escaped special character (!) and emojis.
Sends text message via Telegram Bot API using MarkdownV2 syntax for text formatting.
This example showcases two properly escaped special character (!) and use of emojis.

### EXAMPLE 6
```
Expand Down Expand Up @@ -136,7 +145,6 @@ Send-TelegramTextMessage @sendTelegramTextMessageSplat
```

Sends text message with an inline keyboard right next to the message it belongs to.
See https://core.telegram.org/bots/api#inlinekeyboardbutton for additional details for forming inline keyboards.

### EXAMPLE 7
```
Expand Down Expand Up @@ -167,7 +175,6 @@ Send-TelegramTextMessage @sendTelegramTextMessageSplat
```

Sends text message with a custom keyboard.
See https://core.telegram.org/bots/api#replykeyboardmarkup for additional details for forming custom keyboards.

### EXAMPLE 8
```
Expand All @@ -180,7 +187,9 @@ $sendTelegramTextMessageSplat = @{
Send-TelegramTextMessage @sendTelegramTextMessageSplat
```

Sends text message via Telegram API with protected content.
Sends text message via Telegram Bot API and enables the 'ProtectContent' feature.
When 'ProtectContent' is set to $true, it prevents the message from being forwarded or saved.
This is useful for sending sensitive or confidential information that should remain within the confines of the original chat.

## PARAMETERS

Expand Down Expand Up @@ -318,18 +327,19 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
## NOTES
Author: Jake Morrison - @jakemorrison - https://www.techthoughts.info/
How do I get my channel ID?
Use the getidsbot https://telegram.me/getidsbot -or- Use the Telegram web client and copy the channel ID in the address
How do I set up a bot and get a token?
Use the BotFather https://t.me/BotFather
Questions on how to set up a bot, get a token, or get your channel ID?
Answers on the PoshGram documentation: https://poshgram.readthedocs.io/en/latest/PoshGram-FAQ/
Markdown Style: This is a legacy mode, retained for backward compatibility.
When using Markdown/Markdownv2 you must properly escape characters.
Certain characters in Telegram must be escaped with the preceding character '\' - see examples.
See https://core.telegram.org/bots/api#inlinekeyboardbutton for additional details for forming inline keyboards.
See https://core.telegram.org/bots/api#replykeyboardmarkup for additional details for forming custom keyboards.
## RELATED LINKS
[https://github.com/techthoughts2/PoshGram/blob/main/docs/Send-TelegramTextMessage.md](https://github.com/techthoughts2/PoshGram/blob/main/docs/Send-TelegramTextMessage.md)
[https://poshgram.readthedocs.io/en/latest/Send-TelegramTextMessage/](https://poshgram.readthedocs.io/en/latest/Send-TelegramTextMessage/)
[https://core.telegram.org/bots/api#sendmessage](https://core.telegram.org/bots/api#sendmessage)
Expand All @@ -339,5 +349,9 @@ Certain characters in Telegram must be escaped with the preceding character '\'
[https://core.telegram.org/bots/api#markdown-style](https://core.telegram.org/bots/api#markdown-style)
[https://core.telegram.org/bots/api#inlinekeyboardbutton](https://core.telegram.org/bots/api#inlinekeyboardbutton)
[https://core.telegram.org/bots/api#replykeyboardmarkup](https://core.telegram.org/bots/api#replykeyboardmarkup)
[https://core.telegram.org/bots/api](https://core.telegram.org/bots/api)
3 changes: 3 additions & 0 deletions docs/TelegramAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ TBD

TBD

How do I get my channel ID? Use the getidsbot https://telegram.me/getidsbot -or- Use the Telegram web client and copy the channel ID in the address
How do I set up a bot and get a token? Use the BotFather https://t.me/BotFather

### How to get a Telegram Bot API Key

- To learn how to create and set up a bot:
Expand Down
2 changes: 1 addition & 1 deletion src/PoshGram/PoshGram.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PoshGram.psm1'

# Version number of this module.
ModuleVersion = '2.3.0'
ModuleVersion = '2.3.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
33 changes: 21 additions & 12 deletions src/PoshGram/Public/Send-TelegramTextMessage.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<#
.Synopsis
Sends Telegram text message via Bot API
Send a text message via Telegram Bot API.
.DESCRIPTION
Uses Telegram Bot API to send text message to specified Telegram chat. Several options can be specified to adjust message parameters.
Interfaces with the Telegram Bot API to send text messages to a specified Telegram chat. It supports various messaging options, including different parse modes, message delivery options, and custom keyboards.
.EXAMPLE
$botToken = 'nnnnnnnnn:xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxx'
$chat = '-nnnnnnnnn'
Send-TelegramTextMessage -BotToken $botToken -ChatID $chat -Message "Hello"
Sends text message via Telegram API
Sends text message via Telegram Bot API.
.EXAMPLE
$botToken = 'nnnnnnnnn:xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxx'
$chat = '-nnnnnnnnn'
Expand All @@ -29,7 +31,7 @@
}
Send-TelegramTextMessage @sendTelegramTextMessageSplat
Sends text message via Telegram API with properly formatted default HTML syntax.
Sends a text message through the Telegram Bot API using HTML for text formatting. This example illustrates how to apply various HTML tags like bold, italic, underline, strikethrough, and more to create richly formatted messages.
.EXAMPLE
$botToken = 'nnnnnnnnn:xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxx'
$chat = '-nnnnnnnnn'
Expand All @@ -51,6 +53,8 @@
Send-TelegramTextMessage @sendTelegramTextMessageSplat
Sends text message via Telegram API with properly formatted MarkdownV2 syntax.
Sends a text message via the Telegram Bot API using MarkdownV2 syntax for text formatting. This example showcases the use of various MarkdownV2 formatting options, such as bold, italic, underline, strikethrough, and more, to create richly formatted messages.
.EXAMPLE
$sendTelegramTextMessageSplat = @{
BotToken = $botToken
Expand All @@ -60,7 +64,7 @@
}
Send-TelegramTextMessage @sendTelegramTextMessageSplat
Sends text message via Telegram API using MarkdownV2 with an underlined word and a properly escaped character.
Sends text message via Telegram Bot API using MarkdownV2 syntax for text formatting. This example showcases an underlined word and a properly escaped character.
.EXAMPLE
$sendTelegramTextMessageSplat = @{
BotToken = $botToken
Expand All @@ -70,7 +74,7 @@
}
Send-TelegramTextMessage @sendTelegramTextMessageSplat
Sends text message via Telegram API with two properly escaped special character (!) and emojis.
Sends text message via Telegram Bot API using MarkdownV2 syntax for text formatting. This example showcases two properly escaped special character (!) and use of emojis.
.EXAMPLE
$inlineRow1 = @(
@{
Expand Down Expand Up @@ -99,7 +103,6 @@
Send-TelegramTextMessage @sendTelegramTextMessageSplat
Sends text message with an inline keyboard right next to the message it belongs to.
See https://core.telegram.org/bots/api#inlinekeyboardbutton for additional details for forming inline keyboards.
.EXAMPLE
$row1 = @(
@{
Expand Down Expand Up @@ -127,7 +130,6 @@
Send-TelegramTextMessage @sendTelegramTextMessageSplat
Sends text message with a custom keyboard.
See https://core.telegram.org/bots/api#replykeyboardmarkup for additional details for forming custom keyboards.
.EXAMPLE
$sendTelegramTextMessageSplat = @{
BotToken = $botToken
Expand All @@ -137,7 +139,7 @@
}
Send-TelegramTextMessage @sendTelegramTextMessageSplat
Sends text message via Telegram API with protected content.
Sends text message via Telegram Bot API and enables the 'ProtectContent' feature. When 'ProtectContent' is set to $true, it prevents the message from being forwarded or saved. This is useful for sending sensitive or confidential information that should remain within the confines of the original chat.
.PARAMETER BotToken
Use this token to access the HTTP API
.PARAMETER ChatID
Expand All @@ -159,14 +161,17 @@
.NOTES
Author: Jake Morrison - @jakemorrison - https://www.techthoughts.info/
How do I get my channel ID? Use the getidsbot https://telegram.me/getidsbot -or- Use the Telegram web client and copy the channel ID in the address
How do I set up a bot and get a token? Use the BotFather https://t.me/BotFather
Questions on how to set up a bot, get a token, or get your channel ID?
Answers on the PoshGram documentation: https://poshgram.readthedocs.io/en/latest/PoshGram-FAQ/
Markdown Style: This is a legacy mode, retained for backward compatibility.
When using Markdown/Markdownv2 you must properly escape characters.
Certain characters in Telegram must be escaped with the preceding character '\' - see examples.
See https://core.telegram.org/bots/api#inlinekeyboardbutton for additional details for forming inline keyboards.
See https://core.telegram.org/bots/api#replykeyboardmarkup for additional details for forming custom keyboards.
.COMPONENT
PoshGram - https://github.com/techthoughts2/PoshGram
PoshGram
.FUNCTIONALITY
Parameters Type Required Description
chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
Expand All @@ -177,7 +182,7 @@
reply_to_message_id Integer Optional If the message is a reply, ID of the original message
reply_markup KeyboardMarkup Optional Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
.LINK
https://github.com/techthoughts2/PoshGram/blob/main/docs/Send-TelegramTextMessage.md
https://poshgram.readthedocs.io/en/latest/Send-TelegramTextMessage/
.LINK
https://core.telegram.org/bots/api#sendmessage
.LINK
Expand All @@ -186,6 +191,10 @@
https://core.telegram.org/bots/api#markdownv2-style
.LINK
https://core.telegram.org/bots/api#markdown-style
.LINK
https://core.telegram.org/bots/api#inlinekeyboardbutton
.LINK
https://core.telegram.org/bots/api#replykeyboardmarkup
.LINK
https://core.telegram.org/bots/api
#>
Expand Down

0 comments on commit cc35e39

Please sign in to comment.