Skip to content

Commit f106001

Browse files
Merge pull request #48 from techthoughts2/Enhancements
Enhancements
2 parents 5c6ef32 + 6eb62e4 commit f106001

98 files changed

Lines changed: 4776 additions & 2595 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CHANGELOG.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.0]
9+
10+
- Adjusted error control and error return behavior - ***potential* breaking change**
11+
- Previous behavior: any error (API error, validation error [size requirements, extension verification, etc.] would return a Boolean value: ```$false```)
12+
- This behavior wasn't especially helpful and did not provide a lot of insight into what went wrong
13+
- This behavior did not allow you to take any meaningful action if the API endpoint returned a certain error condition
14+
- New behavior:
15+
- Any validation error with ```throw``` for the failed validation
16+
- Any API error will return as a PSObject containing the API exception
17+
- Example 1:
18+
19+
```powershell
20+
ok error_code description
21+
-- ---------- -----------
22+
False 401 Unauthorized
23+
```
24+
25+
- Example 2:
26+
27+
```powershell
28+
ok error_code description parameters
29+
-- ---------- ----------- ----------
30+
False 429 Too Many Requests: retry after 10 @{retry_after=10}
31+
```
32+
33+
- General code style adjustments throughout the code-base
34+
- Build/dev improvements
35+
- Bumped module versions to latest available
36+
- Updated Pester tests from Pester 4 to Pester 5
37+
- Updated CodeBuild to use latest version of PowerShell 7
38+
- Added new functionality to ```tasks.json```
39+
- Updated infra tests to have API back off capability
40+
841
## [1.16.0]
942
1043
- String literals throughout PoshGram now use single quotes (') instead of double quotes (")
@@ -24,7 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2457
- Send-TelegramLocalAudio / Send-TelegramURLAudio
2558
- Audio now supports both MP3 and M4A file extensions
2659
- Send-TelegramDice
27-
- Now supports soccer (footbal), and slot machine emoji
60+
- Now supports soccer (football), and slot machine emoji
2861
- Send-TelegramLocalDocument / Send-TelegramURLDocument
2962
- Added DisableContentTypeDetection switch which disables automatic server-side content type detection
3063
- Send-TelegramPoll
@@ -33,9 +66,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3366
- Now supports both audio and document media group types
3467
- Restructured logic of this cmdlet to engage a new private function: Test-MediaGroupRequirements
3568
- Added more verbosity in verbose and warning outputs
36-
- Removed manifest releasenotes and linked changelog
69+
- Removed manifest release notes and linked changelog
3770
- Build Improvements
38-
- Restructured private tests from one monolithic file to seperate private function tests
71+
- Restructured private tests from one monolithic file to separate private function tests
3972
- Restructured test folder layout
4073
- Updated Windows CodeBuild container from 2016 to 2019
4174
@@ -66,7 +99,7 @@ No Version Change
6699
- Bumped module versions to latest available
67100
- Replaced monolithic AWSPowerShell module with new AWS.Tools versions
68101
- Switched Windows Build container to use PowerShell 7 instead of PowerShell 7 preview
69-
- Updated tasks.json to have better integration with InvokeBuild
102+
- Updated ```tasks.json``` to have better integration with InvokeBuild
70103
- Switched Infra tests to use new AWS.Tools module
71104
72105
## [02/10/2020]
@@ -134,7 +167,7 @@ No Version Change
134167
135168
No Version Change
136169
137-
- Updated gitignore references
170+
- Updated ```.gitignore``` references
138171
- Updated README to reflect 6.1+ PowerShell version
139172
- Updated vscode settings for Stroustrup code formatting
140173
- Added Git community files

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Archive
22
Artifacts
33
cov.xml
4+
coverage.xml
45
# OS generated files #
56
######################
67
.DS_Store
@@ -9,4 +10,5 @@ cov.xml
910
.Spotlight-V100
1011
.Trashes
1112
ehthumbs.db
12-
Thumbs.db
13+
Thumbs.db
14+
.pytest*

.vscode/tasks.json

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// ${workspaceRoot}: the root folder of the team
55
// ${file}: the current opened file
66
// ${relativeFile}: the current opened file relative to workspaceRoot
7-
// ${fileBasename}: the current opened file's basename
8-
// ${fileDirname}: the current opened file's dirname
9-
// ${fileExtname}: the current opened file's extension
7+
// ${fileBasename}: the current opened file\"s basename
8+
// ${fileDirname}: the current opened file\"s dirname
9+
// ${fileExtname}: the current opened file\"s extension
1010
// ${cwd}: the current working directory of the spawned process
1111
{
1212
"version": "2.0.0",
@@ -47,20 +47,26 @@
4747
}
4848
}
4949
},
50+
"options": {
51+
"env": {
52+
// EDIT THE MODULE NAME FOR YOUR PROJECT
53+
"MODULE_NAME": "PoshGram"
54+
}
55+
},
5056
"tasks": [
5157
{
5258
"label": "PesterTest",
5359
"type": "shell",
5460
"problemMatcher": [
5561
"$pester"
5662
],
57-
"command": "Invoke-Pester '${workspaceFolder}/src/Tests/Unit' -PesterOption @{IncludeVSCodeMarker=$true}",
63+
"command": "Invoke-Pester \"${workspaceFolder}/src/Tests/Unit\" -PesterOption @{IncludeVSCodeMarker=$true}",
5864
},
5965
{
6066
"label": ".",
6167
"type": "shell",
6268
"problemMatcher": "$msCompile",
63-
"command": "$PSVersionTable;Invoke-Build -Task . -File './src/PoshGram.build.ps1'",
69+
"command": "$PSVersionTable;Invoke-Build -Task . -File ${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\"",
6470
"group": {
6571
"kind": "build",
6672
"isDefault": true
@@ -70,67 +76,98 @@
7076
"label": "TestLocal",
7177
"type": "shell",
7278
"problemMatcher": "$msCompile",
73-
"command": "Invoke-Build -Task TestLocal -File './src/PoshGram.build.ps1'"
79+
"command": "Invoke-Build -Task TestLocal -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
7480
},
7581
{
7682
"label": "HelpLocal",
7783
"type": "shell",
7884
"problemMatcher": "$msCompile",
79-
"command": "Invoke-Build -Task HelpLocal -File './src/PoshGram.build.ps1'"
85+
"command": "Invoke-Build -Task HelpLocal -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
8086
},
8187
{
8288
"label": "Clean",
8389
"type": "shell",
8490
"problemMatcher": "$msCompile",
85-
"command": "Invoke-Build -Task Clean -File './src/PoshGram.build.ps1'"
91+
"command": "Invoke-Build -Task Clean -File \"${workspaceFolder}/src/$env:MODULE_NAME.build.ps1"
8692
},
8793
{
8894
"label": "ValidateRequirements",
8995
"type": "shell",
9096
"problemMatcher": "$msCompile",
91-
"command": "Invoke-Build -Task ValidateRequirements -File './src/PoshGram.build.ps1'"
97+
"command": "Invoke-Build -Task ValidateRequirements -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
9298
},
9399
{
94100
"label": "Analyze",
95101
"type": "shell",
96102
"problemMatcher": "$msCompile",
97-
"command": "Invoke-Build -Task Analyze -File './src/PoshGram.build.ps1'"
103+
"command": "Invoke-Build -Task Analyze -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
98104
},
99105
{
100106
"label": "AnalyzeTests",
101107
"type": "shell",
102108
"problemMatcher": "$msCompile",
103-
"command": "Invoke-Build -Task AnalyzeTests -File './src/PoshGram.build.ps1'"
109+
"command": "Invoke-Build -Task AnalyzeTests -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
104110
},
105111
{
106112
"label": "FormattingCheck",
107113
"type": "shell",
108114
"problemMatcher": "$msCompile",
109-
"command": "Invoke-Build -Task FormattingCheck -File './src/PoshGram.build.ps1'"
115+
"command": "Invoke-Build -Task FormattingCheck -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
110116
},
111117
{
112118
"label": "Test",
113119
"type": "shell",
114120
"problemMatcher": "$msCompile",
115-
"command": "Invoke-Build -Task Test -File './src/PoshGram.build.ps1'"
121+
"command": "Invoke-Build -Task Test -File \"${workspaceFolder}/src/$env:MODULE_NAME.build.ps1\""
116122
},
117123
{
118124
"label": "DevCC",
119125
"type": "shell",
120126
"problemMatcher": "$msCompile",
121-
"command": "Invoke-Build -Task DevCC -File './src/PoshGram.build.ps1'"
127+
"command": "Invoke-Build -Task DevCC -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
122128
},
123129
{
124130
"label": "Build",
125131
"type": "shell",
126132
"problemMatcher": "$msCompile",
127-
"command": "Invoke-Build -Task Build -File './src/PoshGram.build.ps1'"
133+
"command": "Invoke-Build -Task Build -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
134+
},
135+
{
136+
"label": "BuildNoInfra",
137+
"type": "shell",
138+
"problemMatcher": "$msCompile",
139+
"command": "Invoke-Build -Task BuildNoInfra -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
128140
},
129141
{
130142
"label": "InfraTest",
131143
"type": "shell",
132144
"problemMatcher": "$msCompile",
133-
"command": "Invoke-Build -Task InfraTest -File './src/PoshGram.build.ps1'"
145+
"command": "Invoke-Build -Task InfraTest -File \"${workspaceFolder}/src//$env:MODULE_NAME.build.ps1\""
146+
},
147+
{
148+
"label": "Pester-Single-Coverage",
149+
"type": "shell",
150+
"command": "Import-Module -Name \"${workspaceFolder}\\src\\$env:MODULE_NAME\\$env:MODULE_NAME.psm1\";Invoke-Pester \"${workspaceFolder}\\src\\Tests\\Unit\\${input:functionName}.Tests.ps1\" -CodeCoverage \"${workspaceFolder}\\src\\$env:MODULE_NAME\\*\\${input:functionName}.ps1\"",
151+
"problemMatcher": []
152+
},
153+
{
154+
"label": "Pester-Single-Detailed",
155+
"type": "shell",
156+
"command": "Import-Module -Name \"${workspaceFolder}\\src\\$env:MODULE_NAME\\$env:MODULE_NAME.psm1\";Invoke-Pester \"${workspaceFolder}\\src\\Tests\\Unit\\${input:functionName}.Tests.ps1\" -Output Detailed",
157+
"problemMatcher": []
158+
},
159+
{
160+
"label": "DevCC-Single",
161+
"type": "shell",
162+
"problemMatcher": "$msCompile",
163+
"command": "Import-Module -Name \"${workspaceFolder}\\src\\$env:MODULE_NAME\\$env:MODULE_NAME.psm1\";Invoke-Pester \"${workspaceFolder}\\src\\Tests\\Unit\\${input:functionName}.Tests.ps1\" -CodeCoverage \"${workspaceFolder}\\src\\$env:MODULE_NAME\\*\\${input:functionName}.ps1\" -CodeCoverageOutputFile \"${workspaceFolder}\\cov.xml\""
164+
}
165+
],
166+
"inputs": [
167+
{
168+
"type": "promptString",
169+
"id": "functionName",
170+
"description": "Name of PowerShell function you want to test"
134171
}
135172
]
136173
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ PoshGram provides functionality to send various message types to a specified Tel
5050

5151
## Why
5252

53-
The Telegram Bot API requires very specific formatting and criteria for Bot messaging. The goal of this project to abstract that complexity away in favor of simple and direct PowerShell commands.
53+
The Telegram Bot API requires very specific formatting and criteria for Bot messaging. The goal of this project is to abstract that complexity away in favor of simple and direct PowerShell commands.
5454

5555
PoshGram also opens up several programmatic use cases:
5656

@@ -176,7 +176,7 @@ $test = "I am a test"
176176

177177
## Author
178178

179-
[Jake Morrison](https://twitter.com/JakeMorrison) - [https://techthoughts.info/](https://techthoughts.info/)
179+
[Jake Morrison](https://twitter.com/JakeMorrison) - [https://www.techthoughts.info/](https://www.techthoughts.info/)
180180

181181
## Contributors
182182

@@ -187,7 +187,7 @@ $test = "I am a test"
187187
## Notes
188188

189189
* [PoshGram Video Demo](https://youtu.be/OfyRVl7YThw)
190-
* [PoshGram Blog Write-up](https://techthoughts.info/poshgram-powershell-module-for-telegram/)
190+
* [PoshGram Blog Write-up](https://www.techthoughts.info/poshgram-powershell-module-for-telegram/)
191191

192192
For a description of the Bot API, see this page: [https://core.telegram.org/bots/api](https://core.telegram.org/bots/api)
193193

actions_bootstrap.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ $modulesToInstall = [System.Collections.ArrayList]::new()
1515
# https://github.com/pester/Pester
1616
$null = $modulesToInstall.Add(([PSCustomObject]@{
1717
ModuleName = 'Pester'
18-
ModuleVersion = '4.10.1'
18+
ModuleVersion = '5.3.1'
1919
}))
2020
# https://github.com/nightroman/Invoke-Build
2121
$null = $modulesToInstall.Add(([PSCustomObject]@{
2222
ModuleName = 'InvokeBuild'
23-
ModuleVersion = '5.6.1'
23+
ModuleVersion = '5.8.4'
2424
}))
2525
# https://github.com/PowerShell/PSScriptAnalyzer
2626
$null = $modulesToInstall.Add(([PSCustomObject]@{
2727
ModuleName = 'PSScriptAnalyzer'
28-
ModuleVersion = '1.19.1'
28+
ModuleVersion = '1.20.0'
2929
}))
3030
# https://github.com/PowerShell/platyPS
3131
# older version used due to: https://github.com/PowerShell/platyPS/issues/457

buildspec_windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ phases:
88
install:
99
commands:
1010
- powershell -command '.\configure_aws_credential.ps1'
11-
- aws s3 cp s3://ps-invoke-modules/PowerShell-7.1.0-win-x64.msi PowerShell-7.1.0-win-x64.msi --quiet
12-
- powershell -command "Start-Process $env:CODEBUILD_SRC_DIR\PowerShell-7.1.0-win-x64.msi -ArgumentList '/qn /norestart' -Wait"
11+
- aws s3 cp s3://ps-invoke-modules/PowerShell-7.1.4-win-x64.msi PowerShell-7.1.4-win-x64.msi --quiet
12+
- powershell -command "Start-Process $env:CODEBUILD_SRC_DIR\PowerShell-7.1.4-win-x64.msi -ArgumentList '/qn /norestart' -Wait"
1313
- '& "C:\Program Files\PowerShell\7\pwsh.exe" -command ''.\install_modules.ps1'''
1414
pre_build:
1515
commands:

docs/Get-TelegramStickerPackInfo.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,10 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
6969
7070
## OUTPUTS
7171
72-
### System.Management.Automation.PSCustomObject (if successful)
73-
### System.Boolean (on failure)
72+
### System.Management.Automation.PSCustomObject
7473
## NOTES
75-
Author: Jake Morrison - @jakemorrison - https://techthoughts.info/
76-
This works with PowerShell Version: 6.1+
74+
Author: Jake Morrison - @jakemorrison - https://www.techthoughts.info/
7775
78-
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
7976
How do I get my channel ID?
8077
Use the getidsbot https://telegram.me/getidsbot -or- Use the Telegram web client and copy the channel ID in the address
8178
How do I set up a bot and get a token?
@@ -106,3 +103,5 @@ This will provide a link which contains the sticker pack name.
106103
107104
[https://core.telegram.org/bots/api#sticker](https://core.telegram.org/bots/api#sticker)
108105
106+
[https://core.telegram.org/bots/api](https://core.telegram.org/bots/api)
107+

docs/PoshGram.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Module Name: PoshGram
33
Module Guid: 277b92bc-0ea9-4659-8f6c-ed5a1dfdfda2
44
Download Help Link: NA
5-
Help Version: 1.16.0
5+
Help Version: 2.0.0
66
Locale: en-US
77
---
88

docs/Send-TelegramContact.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,10 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
155155
156156
## OUTPUTS
157157
158-
### System.Management.Automation.PSCustomObject (if successful)
159-
### System.Boolean (on failure)
158+
### System.Management.Automation.PSCustomObject
160159
## NOTES
161-
Author: Jake Morrison - @jakemorrison - https://techthoughts.info/
162-
This works with PowerShell Version: 6.1+
160+
Author: Jake Morrison - @jakemorrison - https://www.techthoughts.info/
163161
164-
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
165162
How do I get my channel ID?
166163
Use the getidsbot https://telegram.me/getidsbot -or- Use the Telegram web client and copy the channel ID in the address
167164
How do I set up a bot and get a token?
@@ -173,3 +170,5 @@ Use the BotFather https://t.me/BotFather
173170
174171
[https://core.telegram.org/bots/api#sendcontact](https://core.telegram.org/bots/api#sendcontact)
175172
173+
[https://core.telegram.org/bots/api](https://core.telegram.org/bots/api)
174+

docs/Send-TelegramDice.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,10 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
120120
121121
## OUTPUTS
122122
123-
### System.Management.Automation.PSCustomObject (if successful)
124-
### System.Boolean (on failure)
123+
### System.Management.Automation.PSCustomObject
125124
## NOTES
126-
Author: Jake Morrison - @jakemorrison - https://techthoughts.info/
127-
This works with PowerShell Version: 6.1+
125+
Author: Jake Morrison - @jakemorrison - https://www.techthoughts.info/
128126
129-
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
130127
How do I get my channel ID?
131128
Use the getidsbot https://telegram.me/getidsbot -or- Use the Telegram web client and copy the channel ID in the address
132129
How do I set up a bot and get a token?
@@ -138,3 +135,5 @@ Use the BotFather https://t.me/BotFather
138135
139136
[https://core.telegram.org/bots/api#senddice](https://core.telegram.org/bots/api#senddice)
140137
138+
[https://core.telegram.org/bots/api](https://core.telegram.org/bots/api)
139+

0 commit comments

Comments
 (0)