Awesome
PSTelegramAPI
PowerShell Module for Telegram APIs
Install PSTelegramAPI from PSGallery
Install-Module PSTelegramAPI -Scope CurrentUser
Examples
Import-Module PSTelegramAPI
# Establish connection to Telegram
$TLClient = New-TLClient -apiId $ENV:TLApiId -apiHash $ENV:TLApiHash -phoneNumber $ENV:TLPhoneNumber
# Get List of User Dialogs
$TLUserDialogs = Get-TLUserDialogs -TLClient $TLClient
# Get latest 100 messages from each User in List
ForEach ($User in $TLUserDialog) {
$TLHistory = Get-TLHistory -TLClient $TLClient -Peer $User.Peer -Limit 100
}
# Find a specific User
$TLPeer = $TLUserDialogs.Where({ $_.Peer.Username -eq 'mkellerman' }).Peer
# Send message to User
Invoke-TLSendMessage -TLClient $TLClient -TLPeer $TLPeer -Message 'Hello World'
Completed
- Get-TLUserDialogs
- Get-TLContacts
- Get-TLHistory
- Invoke-TLSendMessage
References
- PSTelegramAPI : PowerShell Gallery
- TLSharp : Telegram client library implemented in C#