xLinkOut / telegram-udf-autoit

πŸš€ Telegram Bot UDF for AutoIt.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram UDFs for AutoIt


If you want to control your Telegram Bot with AutoIt, this is for you!

Telegram UDF is on the official AutoIt Script UDFs list! Check it here!

Notice

Important

After over 4 years of inactivity, I am rewriting the library code from scratch with the intention of updating, optimizing it, fixing all the reported issues accumulated over the years, and supporting the latest Telegram features. You can find the development in the dev branch. I appreciate any kind of contribution. Thank you for the support. ❀️

Warning

I'd like to inform you that the license for this project has been updated from GPL to MIT. This means that you are now free to use this work in your projects, with the condition that you acknowledge and cite this library within your own work. Thank you for your support and cooperation.

Setup

Telegram.au3 is the main file that you have to include in your code, but it also need the include folder. Adjust the path as you want. Include the library in your script with #include "Telegram.au3".

First initialize your bot with _InitBot(12345678:AbCdEfGh....), then you can use all the bot functions. Check the @error flag after invoking _InitBot() (or its return value) to make sure everything is working: @error == 1 mean error, and in this case the _InitBot() return False.

How it works

After initializing the bot, you can do whatever you need to do. (Almost) all the APIs are coded, read the wiki for details about all the functions. To put the bot in polling state (i.e. wait for incoming messages) read below.

How to wait for incoming messages

To wait incoming messages you have to put the bot in Polling State. This state is blocking, therefore your script will wait here until it's closed or it exit from the main while, maybe if a certain condition is verified.

Example:

While 1 ;Create a While that restart Polling
	$msgData = _Polling() ;_Polling function return an array with information about a message
	_SendMsg($msgData[2],$msgData[5]) ;Send a message to the same user with the same text
WEnd

For a simple text message, the array returned by _Polling() is:

$msgData[0] = Offset of the current update (used to 'switch' to the next update)
$msgData[1] = Message ID
$msgData[2] = Chat ID, use for interact with the user
$msgData[3] = Username of the user
$msgData[4] = First name of the user
$msgData[5] = Text of the message

If you want to try all the available features, use the Test file into /tests folder. Open it, insert your bot's token, your chat id (make sure you have sent at least one message to the bot) and then execute it.

What you need to know

I'm writing a wiki, you can find it here.

Credits

About

If you want to donate for support my (future) works, use this: https://www.paypal.me/LCirillo. ❀️

For support, just contact me! Enjoy πŸŽ‰

About

πŸš€ Telegram Bot UDF for AutoIt.

License:MIT License


Languages

Language:AutoIt 100.0%