Skip to content

Commit

Permalink
Merge pull request #45 from techthoughts2/Enhancements
Browse files Browse the repository at this point in the history
Enhancements
  • Loading branch information
techthoughts2 committed Nov 15, 2020
2 parents 743a770 + 5ed6624 commit a994885
Show file tree
Hide file tree
Showing 76 changed files with 1,190 additions and 801 deletions.
20 changes: 20 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.15.0]

- Send-TelegramLocalAudio / Send-TelegramURLAudio
- Audio now supports both MP3 and M4A file extensions
- Send-TelegramDice
- Now supports soccer (footbal), and slot machine emoji
- Send-TelegramLocalDocument / Send-TelegramURLDocument
- Added DisableContentTypeDetection switch which disables automatic server-side content type detection
- Send-TelegramPoll
- Questions can now be 300 characters long
- Send-TelegramMediaGroup
- Now supports both audio and document media group types
- Restructured logic of this cmdlet to engage a new private function: Test-MediaGroupRequirements
- Added more verbosity in verbose and warning outputs
- Removed manifest releasenotes and linked changelog
- Build Improvements
- Restructured private tests from one monolithic file to seperate private function tests
- Restructured test folder layout
- Updated Windows CodeBuild container from 2016 to 2019

## [1.14.0]

- Added **Send-TelegramDice**
Expand Down
3 changes: 3 additions & 0 deletions actions_bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ $null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleVersion = '0.12.0'
}))

'Setting PSGallery to trusted'
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

'Installing PowerShell Modules'
foreach ($module in $modulesToInstall) {
$installSplat = @{
Expand Down
2 changes: 2 additions & 0 deletions buildspec_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ phases:
- pwsh -command 'New-Item -Path /Test/Stickers -ItemType Directory | Out-Null'
- aws s3 cp s3://poshgram-test-files/jean.gif /Test/Animation/jean.gif --quiet
- aws s3 cp s3://poshgram-test-files/Tobu-_-Syndec-Dusk-_NCS-Release_-YouTube.mp3 /Test/Audio/Tobu-_-Syndec-Dusk-_NCS-Release_-YouTube.mp3 --quiet
- aws s3 cp s3://poshgram-test-files/TestAudio.mp3 /Test/Audio/TestAudio.mp3 --quiet
- aws s3 cp s3://poshgram-test-files/customlog.txt /Test/Documents/customlog.txt --quiet
- aws s3 cp s3://poshgram-test-files/customlog2.txt /Test/Documents/customlog2.txt --quiet
- aws s3 cp s3://poshgram-test-files/beverly.jpg /Test/PhotoGroup/beverly.jpg --quiet
- aws s3 cp s3://poshgram-test-files/data.jpg /Test/PhotoGroup/data.jpg --quiet
- aws s3 cp s3://poshgram-test-files/geordi.jpg /Test/PhotoGroup/geordi.jpg --quiet
Expand Down
6 changes: 4 additions & 2 deletions buildspec_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ phases:
install:
commands:
- powershell -command '.\configure_aws_credential.ps1'
- aws s3 cp s3://ps-invoke-modules/PowerShell-7.0.3-win-x64.msi PowerShell-7.0.3-win-x64.msi --quiet
- powershell -command "Start-Process $env:CODEBUILD_SRC_DIR\PowerShell-7.0.3-win-x64.msi -ArgumentList '/qn /norestart' -Wait"
- aws s3 cp s3://ps-invoke-modules/PowerShell-7.1.0-win-x64.msi PowerShell-7.1.0-win-x64.msi --quiet
- powershell -command "Start-Process $env:CODEBUILD_SRC_DIR\PowerShell-7.1.0-win-x64.msi -ArgumentList '/qn /norestart' -Wait"
- '& "C:\Program Files\PowerShell\7\pwsh.exe" -command ''.\install_modules.ps1'''
pre_build:
commands:
Expand All @@ -24,7 +24,9 @@ phases:
- powershell -command 'New-Item -Path C:\Test\Stickers -ItemType Directory | Out-Null'
- aws s3 cp s3://poshgram-test-files/jean.gif C:\Test\Animation\jean.gif --quiet
- aws s3 cp s3://poshgram-test-files/Tobu-_-Syndec-Dusk-_NCS-Release_-YouTube.mp3 C:\Test\Audio\Tobu-_-Syndec-Dusk-_NCS-Release_-YouTube.mp3 --quiet
- aws s3 cp s3://poshgram-test-files/TestAudio.mp3 C:\Test\Audio\TestAudio.mp3 --quiet
- aws s3 cp s3://poshgram-test-files/customlog.txt C:\Test\Documents\customlog.txt --quiet
- aws s3 cp s3://poshgram-test-files/customlog2.txt C:\Test\Documents\customlog2.txt --quiet
- aws s3 cp s3://poshgram-test-files/beverly.jpg C:\Test\PhotoGroup\beverly.jpg --quiet
- aws s3 cp s3://poshgram-test-files/data.jpg C:\Test\PhotoGroup\data.jpg --quiet
- aws s3 cp s3://poshgram-test-files/geordi.jpg C:\Test\PhotoGroup\geordi.jpg --quiet
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: 1.14.0
Help Version: 1.15.0
Locale: en-US
---

Expand Down Expand Up @@ -42,7 +42,7 @@ Sends Telegram video message via Bot API from locally sourced file
Sends Telegram location to indicate point on map

### [Send-TelegramMediaGroup](Send-TelegramMediaGroup.md)
Sends Telegram a group of photos or videos as an album via Bot API from locally sourced media
Sends Telegram a group of photos, videos, documents, or audios as an album via Bot API from locally sourced media

### [Send-TelegramPoll](Send-TelegramPoll.md)
Sends Telegram native poll.
Expand Down
17 changes: 16 additions & 1 deletion docs/Send-TelegramLocalDocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Sends Telegram document message via Bot API from locally sourced file

```
Send-TelegramLocalDocument [-BotToken] <String> [-ChatID] <String> [-File] <String> [[-Caption] <String>]
[[-ParseMode] <String>] [-DisableNotification] [<CommonParameters>]
[[-ParseMode] <String>] [-DisableContentTypeDetection] [-DisableNotification] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -148,6 +148,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -DisableContentTypeDetection
set to HTML by default
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -DisableNotification
Send the message silently.
Users will receive a notification with no sound.
Expand Down
9 changes: 6 additions & 3 deletions docs/Send-TelegramMediaGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Send-TelegramMediaGroup

## SYNOPSIS
Sends Telegram a group of photos or videos as an album via Bot API from locally sourced media
Sends Telegram a group of photos, videos, documents, or audios as an album via Bot API from locally sourced media

## SYNTAX

Expand All @@ -18,9 +18,9 @@ Send-TelegramMediaGroup [-BotToken] <String> [-ChatID] <String> [-MediaType] <St
```

## DESCRIPTION
Uses Telegram Bot API to send a group of photo or video as an album message to specified Telegram chat.
Uses Telegram Bot API to send a group of photos, videos, documents, or audios as an album message to specified Telegram chat.
The media will be sourced from the local device and uploaded to telegram.
This function only supports sending one media type per send (Photo | Video).
This function only supports sending one media type per send (Photo | Video | Documents | Audio).
2 files minimum and 10 files maximum are required for this function.

## EXAMPLES
Expand Down Expand Up @@ -175,6 +175,9 @@ JPG, JPEG, PNG, GIF, BMP, WEBP, SVG, TIFF
The following video types are supported:
Telegram clients support mp4 videos
The following audio types are supported:
MP3, M4A
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
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
Expand Down
2 changes: 1 addition & 1 deletion docs/Send-TelegramPoll.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Use the getidsbot https://telegram.me/getidsbot -or- Use the Telegram web clie
How do I set up a bot and get a token?
Use the BotFather https://t.me/BotFather
Telegram currently supports questions 1-255 characters
Telegram currently supports questions 1-300 characters
Telegram currently supports 2-10 options 1-100 characters each
## RELATED LINKS
Expand Down
17 changes: 16 additions & 1 deletion docs/Send-TelegramURLDocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Sends Telegram document message via Bot API from URL sourced file

```
Send-TelegramURLDocument [-BotToken] <String> [-ChatID] <String> [-FileURL] <String> [[-Caption] <String>]
[[-ParseMode] <String>] [-DisableNotification] [<CommonParameters>]
[[-ParseMode] <String>] [-DisableContentTypeDetection] [-DisableNotification] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -149,6 +149,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -DisableContentTypeDetection
set to HTML by default
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -DisableNotification
Send the message silently.
Users will receive a notification with no sound.
Expand Down
4 changes: 2 additions & 2 deletions src/PoshGram.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ Add-BuildTask Build {

# here you could move your docs up to your repos doc level if you wanted
Write-Build Gray ' Overwriting docs output...'
Move-Item "$($script:ArtifactsPath)\docs\*.md" -Destination "..\docs\" -Force
Remove-Item "$($script:ArtifactsPath)\docs" -Recurse -Force -ErrorAction Stop
Move-Item "$($script:ArtifactsPath)\docs\*.md" -Destination "..\docs\" -Force -ErrorAction SilentlyContinue
Remove-Item "$($script:ArtifactsPath)\docs" -Recurse -Force -ErrorAction SilentlyContinue
Write-Build Gray ' ...Docs output completed.'

Write-Build Gray ' Cleaning up leftover artifacts...'
Expand Down
48 changes: 3 additions & 45 deletions 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 = '1.14.0'
ModuleVersion = '1.15.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -127,6 +127,7 @@
'Contacts',
'Coordinates',
'Dice',
'Document',
'Documents',
'Gif',
'Gifs',
Expand Down Expand Up @@ -171,50 +172,7 @@
IconUri = 'https://github.com/techthoughts2/PoshGram/raw/master/media/PoshGram.png'

# ReleaseNotes of this module
ReleaseNotes = '
1.14.0:
Added Send-TelegramDice
Updated Send-TelegramPoll to include newly supported parameters
Updated help for all cmdlets to include splat examples
1.12.0:
Added support for MarkdownV2
Changed default Parse Mode for all functions from legacy Markdown to HTML
Added support for Polls v2.0 features
1.10.1:
Fixed bug where DisableNotification had no effect when running Send-TelegramSticker
1.10.0:
Improved Help Formatting
Added Send-TelegramURLSticker
Added Send-TelegramLocalSticker
Added Send-TelegramSticker
Added Get-TelegramStickerPackInfo
Added Send-TelegramPoll
Added Send-TelegramVenue
Added Send-TelegramContact
DisableNotification and Streaming parameters changed from bool to switch on all functions
Send-TelegramTextMessage: Preview parameter renamed to DisablePreview and changed from bool to switch
Unit test and Infra test improvements
1.0.2 :
Addressed bug where certain UTF-8 characters would fail to send properly in Send-TelegramTextMessage
Cosmetic code change for Invoke functions to use splat parameters
1.0.0 :
Addressed bug in Send-TelegramTextMessage that wasnt handling underscores
Added code to support AWS Codebuild
0.9.0 :
Restructured module for CI/CD Workflow
Added Invoke-Build capabilities to module
Added Animation functionality:
Send-TelegramLocalAnimation
Send-TelegramURLAnimation
Added location functionality:
Send-TelegramLocation
Added multi-media functionality:
Send-TelegramMediaGroup
Consolidated private support functions
Code Logic improvements
0.8.4 Added IconURI to manifest
0.8.3 Initial beta release.
'
ReleaseNotes = 'https://github.com/techthoughts2/PoshGram/blob/master/.github/CHANGELOG.md'

} # End of PSData hashtable

Expand Down
4 changes: 2 additions & 2 deletions src/PoshGram/Private/Confirm-URL.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function Confirm-URL {
Write-Verbose -Message "Attempting to confirm $Uri"
try {
Invoke-WebRequest -Uri $uri -UseBasicParsing -DisableKeepAlive -ErrorAction Stop | Out-Null
Write-Verbose -Message "Confirmed."
Write-Verbose -Message 'Confirmed.'
}#try_Invoke-WebRequest
catch {
Write-Verbose -Message "Catch on Invoke-WebRequest. This is not neccessarily a bad thing. Checking status code."
Write-Verbose -Message 'Catch on Invoke-WebRequest. This is not neccessarily a bad thing. Checking status code.'
if ([int]$_.Exception.Response.StatusCode -eq 0) {
Write-Warning -Message "$Uri"
Write-Warning -Message 'The URL provided does not appear to be valid'
Expand Down
6 changes: 3 additions & 3 deletions src/PoshGram/Private/Test-Explanation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ function Test-Explanation {
$carriageCount = $splitTest | Measure-Object | Select-Object -ExpandProperty Count

if ($carriageCount -gt 2) {
Write-Warning 'Explanation can contain at most 2 line feeds.'
Write-Warning -Message 'Explanation can contain at most 2 line feeds.'
$results = $false
}

if ($Explanation.Length -gt 200) {
Write-Warning 'Explanation can contain at most 200 characters.'
Write-Warning -Message 'Explanation can contain at most 200 characters.'
$results = $false
}

return $results
}#function_Test-Explanation
}#function_Test-Explanation
9 changes: 5 additions & 4 deletions src/PoshGram/Private/Test-FileExtension.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function Test-FileExtension {
'MP4'
)
$supportedAudioExtensions = @(
'MP3'
'MP3',
'M4A'
)
$supportedAnimationExtensions = @(
'GIF'
Expand Down Expand Up @@ -105,15 +106,15 @@ function Test-FileExtension {
$divide = $FilePath.Split(".")
$rawExtension = $divide[$divide.Length - 1]
$extension = $rawExtension.ToUpper()
Write-Verbose "Verifying discovered extension: $extension"
Write-Verbose -Message "Verifying discovered extension: $extension"
switch ($extension) {
{ $extType -contains $_ } {
Write-Verbose -Message "Extension verified."
Write-Verbose -Message 'Extension verified.'
}
default {
Write-Warning -Message "The specified file is not a supported $Type extension."
$results = $false
}#default
}#switch_extension
return $results
}#function_Test-FileExtension
}#function_Test-FileExtension
4 changes: 2 additions & 2 deletions src/PoshGram/Private/Test-FileSize.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function Test-FileSize {
}
}
catch {
Write-Warning -Message "An error was encountered evaluating the file size"
Write-Warning -Message 'An error was encountered evaluating the file size'
$results = $false
}
return $results
}#function_Test-FileSize
}#function_Test-FileSize
Loading

0 comments on commit a994885

Please sign in to comment.