Learn how to make a telegram bot from basics to production
- Normal:
- It can be added to a group for multiple people to access at a time.
- Inline:
- No need to add into any group
- Access via
@bot1
in the message box
- Add inline keyboards: contact, location, custom
- Python
- Add buttons
- Python
- Attach to Database
- Python
- Add bot to a group
- Reply to any comment on a group
It is identical to the feature "Reply to any comment on channel's post"
- Rust
- Verify a bot/human: by sending DM to that user & check for clicking a button
- DM
- Group
- Create a UI with back button, options like an App
- Python
There are 5 ways to do a conversation with the bot in order to make them interactive:
- Commands with parameters like
/pay 1000 @user1
- Dialogue with the bot like
User: /pay
Bot: Please enter the amount
User: 1000
Bot: Please enter the receiver's username
User: @user1
Bot: Done! Here is the transaction ID: 123456789
- Inline keyboard
User: /pay
Bot: [Yes][No]
User: Clicked on [Yes] button
Bot: Done!
- Reply keyboard
- Works like inline keyboard but with a different UI coming from bottom of the screen. Mostly used for less options like Yes/No, etc.
- Open a Web App/Page & let the user interact with it
- Put the link in the bot's message
- Put the link in the bot's inline keyboard
- my python tutorials
- Python-telegram-bot - Github
- PyTelegramBotAPI - Github
Botogram (Python framework for Telegram bots) - Github, Telegram API wrapper, Bots Creation APINOTE: It's deprecated now.
- my cpp tutorials
- C++ lib for Bot - https://github.com/reo7sp/tgbot-cpp
- Telegram Bot API - https://github.com/desmoteo/telegram-bot-api [DEPRECATED]
- Bots: An introduction for developers - https://core.telegram.org/bots
- Telegram Bot API - https://core.telegram.org/bots/api
- Sample examples - https://core.telegram.org/bots/samples#python
- THEORY - https://github.com/python-telegram-bot/python-telegram-bot/wiki
- How to create a Telegram Bot with Node.js - https://www.youtube.com/watch?v=Te7HcRhwOI4
- Bot with Google App Engine (GAP) - https://github.com/yukuku/telebot
- Collection great groups, channels, bots and libraries for Telegram - https://github.com/ebertti/awesome-telegram
- Collection of Bots - https://github.com/DenisIzmaylov/awesome-telegram-bots
- Weather Bot using JS - https://www.3scale.net/2016/02/create-a-weather-bot-for-telegram/
- Bot with Amazon AWS cloud - https://lesterchan.net/blog/2016/03/11/telegram-bot-using-aws-api-gateway-and-aws-lambda/
- Bot with GAE -
- Article by a Toptal Engineer
-
Emoji
- https://emojipedia.org/
- https://apps.timwhitlock.info/emoji/tables/unicode
- Or Google the required type with 'emoji' as suffix. E.g. "person standing emoji", "cow emoji", etc.
- get bytes from unicode
- M-1: Just copy the emoji & literally paste into unicode place here
- M-2: Just copy the emoji & literally paste into the variable place inside the
.py
file - get the bytes & write like this:
person_emoji = '👤' # b'\xf0\x9f\x91\xa4'.decode('utf-8') U+1F464 purse_emoji = '👛' # b'\xf0\x9f\x91\x9b'.decode('utf-8') U+1F519
-
Usage
itembtn0 = types.InlineKeyboardButton(f'{person_emoji} Account', callback_data = "home_account") itembtn1 = types.InlineKeyboardButton(f'{purse_emoji} Wallet', callback_data = "home_wallet")
Quiz Bot
- owner can add set of quiz Q&A
- pay the subscription & make it available for users
Birthday_bot
: reminds other users (in a group) about the Birthday boy/girl.Weather_bot
: gives alert about weather of a place (given by user).Stock_bot
: gives all stock market info- API: https://mboum.com/api/welcome
- Features inspiration: https://mboum.com/
- Earning: user subscription for
- specific price value alert for a share. E.g. alert when share price of Google reaches 1000 USD.
- specific price of share daily e.g. Google, Uber, Amazon...
FlashLoan Helper
: Develop a bot which would list down the price difference of same pairs across different DEXes. The objective is to then make a flash loan transaction using a NodeJS/Python script in order to replicate this: