4 года назад
История
README.md
codesamples-perl-codeExampleBot
Perl 5.26 LWP::UserAgent Telegram API NASAAPI to Telegram
Description
In fact a gateway between the NASA API and Telegram API - if you run the bot it will get the information about closet asteroids to Earth for today and then choose on random asteroid from a returned list and send it to Telegram API to the bot, for which you would provide token and chat id(should be received from Telegram API and populated to the bot configuration cfg file in config folder)
Purposes
To demonstrate ability to work with various APIs and implement cross-API interaction on Perl using LWP::UserAgent
Requirements
- Perl 5.26
- LWP::UserAgent
-
Telegram bot created via botFather(see here: https://core.telegram.org/api)
Installation instructions (approximate, not the last ones to follow):
- git clone this project
- [optional] sudo apt-get install perl
- [optional] sudo apt-get install libwww-perl
- [optional] sudo apt-get install liburi-encode-perl
- [optional] sudo apt-get install libjson-perl
- [optional] sudo apt-get install libconfig-simple-perl
- Open your telegram app
- Search for @botfather - simply put @botfather to search widget
- You will see BotFather and ‘I can help you create and m…’ below
- Click on it and press start
- Command @BotFather a /newbot
- You will receive ‘Alright, a new bot. How are we going to call it? Please choose a name for your bot.’
- Answer with the name of your bot
- The system asks for the user name of your bot
- Answer with something that ends with _bot
- You will receive token
- [as per https://core.telegram.org/bots/api , follow to Making Requests header] Follow https://api.telegram.org/bot/getUpdates (instead of you token value)
- Send something to your bot and refresh the page mentioned at point 15 - you should get you chat id - token and chat_id to the /config/codeExampleBot_config.cfg instead of placeholder message after =
- Additional information via https://blog.meer-web.nl/sending-telegram-messages-using-php/
How to run?:
- perl /path/to/codeExampleBot.pl
- Check you Telegram for message
Конвейеры
0 успешных
0 с ошибкой