Skip to content

Garfius/powerTelegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

powerTelegram

Telegram bot adaptation for PowerShell from c# powershell bot. Tested on powershell 4 and 5.

This script provides useful example to learn how to use telegram windows library 'DLL' under powershell. It also pretends to give command line access to bot messaging from windows O.S. useful for automation, alerts and scheduling.

license

Telegram Bot Api Library

C# library to talk to Telegrams Bot API (https://core.telegram.org/bots/api)

Usage

Make sure the requiered libraries are located at .\files

  .\powerTelegram.ps1 -token "----your token----"

Alternate silent usage to send static messages

$fixedBotKey = "----your token----"
$message = "Wow, it's working !"
$targetUserId = 123456

$bot =  New-Object NetTelegramBotApi.TelegramBot($fixedBotKey)
$getMe = New-Object NetTelegramBotApi.Requests.GetMe
$me = $bot.MakeRequestAsync($getMe).Result

if ($me -eq $null)
{
    exit
}

$reqAction = New-Object NetTelegramBotApi.Requests.SendMessage($targetUserId, $message);
$bot.MakeRequestAsync($reqAction).Wait();

see telegram.bot.examples

API Coverage

Updated to Bot API 2.1

About

Telegram bot adaptation for PowerShell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published