Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mkellerman authored Jan 6, 2019
1 parent 2a32835 commit b16e94a
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,32 @@

PowerShell Module for Telegram APIs

# Install PSTelegramAPI from PSGallery
```powershell
Install-Module PSTelegramAPI -Scope CurrentUser
```

# Examples

```powershell
Import-Module PSTelegramAPI
# Establish connection to telegram
$TLClient = New-TLClient -apiId $ENV:TLApiId -apiHash $ENV:TLApiHash -phoneNumber $ENV:TLPhoneNumber -Verbose
# Establish connection to Telegram
$TLClient = New-TLClient -apiId $ENV:TLApiId -apiHash $ENV:TLApiHash -phoneNumber $ENV:TLPhoneNumber
# Get User Dialogs
$TLUserDialog = Get-TLUserDialog -TLClient $TLClient -Verbose
# Get List of User Dialogs
$TLUserDialog = Get-TLUserDialog -TLClient $TLClient
# Get latest 100 messages from each User Dialog
# Get latest 100 messages from each User in List
ForEach ($User in $TLUserDialog) {
$TLHistory = Get-TLHistory -TLClient $TLClient -Peer $User.Peer -Limit 100 -Verbose
$TLHistory = Get-TLHistory -TLClient $TLClient -Peer $User.Peer -Limit 100
}
# Find a specific User
$TLPeer = $TLUserDialog.Where({ $_.Peer.Username -eq 'mkellerman' }).Peer
# Send message to User
Invoke-TLSendMessage -TLClient $TLClient -TLPeer $TLPeer -Message 'Hello World'
```

# References
Expand Down

0 comments on commit b16e94a

Please sign in to comment.