Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
b4t-python-telegram-bot
Advanced tools
A simple and lightweight Python Telegram Bot with a small range of functionalities using the Telegram Bot API
Installation with pip: pip install b4t-python-telegram-bot
Requirements:
Currently supported:
Future plans:
How it works:
The bot frequently sends a request to the telegram server and gets a response. If there is usable content within the response (i.e. someone send a message to the bot or into a group where the bot is a group member of) it parses the response into a custom datastructure ( = classes, lol) which the programmer gets in return to work with. The structure of the returned class is the same as Telegram sends the response, which means you can get your needed information like you can see here. Example: I want to know what the content is of the message I just received:
from telegram_bot import TelegramBot
bot = TelegramBot ("<insert your bot_token here>")
response = bot.poll()
if response:
message = response.message.text
Easy! You can also check if your response is a message or (for example) an incoming command or a callback from an inline-keyboard:
[see above]
if response:
if response.isMessage():
# do stuff here
elif response.isCallback():
# do other stuff here
elif response.isBotCommand():
# you know what's coming...
Check the Update-class in telegram_bot/updates.py for more. It's pretty self explaining.
Good-to-know:
About Me:
Feel free to make a pull request and help me making this repository more beginner- and userfriendly!
FAQs
Simple and lightweight Telegram Bot
We found that b4t-python-telegram-bot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.