147 subscribers
1 photo
1 video
48 links
Python framework for Telegram bots
Download Telegram
I just redesigned from scratch the API for keyboards and buttons (inline keyboards), which will be implemented in botogram 0.4. If you want to take a peek at it, check it out on GitHub!

https://github.com/pietroalbini/botogram/issues/66
Discussion group: @botogram_users
A bunch of new things landed on master today!

You can now get the list of administrators of a chat. If your bot is meant to be added in groups to aid moderating, being able to accept certain commands only from appointed administrators is quite helpful. Check out the documentation for it:
https://botogram.pietroalbini.io/docs/dev/api/telegram/#botogram.Chat.admins

If the command you want to protect is really dangerous, and only the chat creator should be allowed to use it, don't worry! You can check if it's him by comparing the sender with chat.creator. Check out the documentation for it:
https://botogram.pietroalbini.io/docs/dev/api/telegram/#botogram.Chat.creator

Also, you might want to track statistics about how many users are in your group or subscribed to your channel. It's now easy to get that information with chat.members_count! Check out the documentation for it:
https://botogram.pietroalbini.io/docs/dev/api/telegram/#botogram.Chat.members_count

Checking if someone is kicked from the chat or is an admin of it was difficult before, because you had to track that down by yourself. Now you can just check the status in the group of an user by using chat.status_of(). Check out the documentation for it:
https://botogram.pietroalbini.io/docs/dev/api/telegram/#botogram.Chat.status_of

Finally, it's now possible to compare (for example message.sender == chat.creator) most of the upstream objects, like User, Chat, Message and many more. This allows you to do nice things like if message.sender in chat.admins:.

Discussion group: @botogram_users
A few new features landed yesterday on master!

It will be possible in botogram 0.3 to process edits of the messages your bot knows about. Check out the documentation for it:
https://botogram.pietroalbini.io/docs/dev/api/bot/#botogram.Bot.message_edited

Also, a small bug was fixed, and now you shouldn't have more troubles if you use any > or < in your commands' docstrings but you don't have any HTML syntax in there: your docstrings will be escaped automatically, and the /help command shouldn't crash anymore.

Discussion group: @botogram_users
Big changes today in the development version of botogram (soon the 0.3 release).
First of all, a regression of a fix made two days ago was fixed, so the /help command should be stable again.

A new method Bot.chat() was added, which allows you to get the representation of a chat from its ID. This allows you to get updated information about it, and also to directly send messages to that chat. Because of that, all the Bot.send / Bot.send_* methods are now deprecated, but don't worry, botogram will tell you where to update your code when you run the bot. Check out its documentation:
https://botogram.pietroalbini.io/docs/dev/api/bot/#botogram.Bot.chat

Also, support for sending contacts was added. You can now send phone numbers to your users easily, with the User.send_contact, Chat.send_contact and Message.reply_with_contact methods. Check out their documentation if you want to know a bit more about them.

Finally, I'm updating the documentation theme so the API docs looks better, stay tuned!

Changelog:
https://botogram.pietroalbini.io/docs/dev/changelog/0.3/
Discussion group: @botogram_users
Support for moderating group chats just landed on master, and is scheduled to release in the almost-ready botogram 0.3.

Public supergroups will become messy sonner or later, and being able to programmatically ban noisy users is invaluable. Check out the narrative documentation about groups management, with working, real-world examples:
https://botogram.pietroalbini.io/docs/dev/groups-management/

Changelog:
https://botogram.pietroalbini.io/docs/dev/changelog/0.3/
Discussion group: @botogram_users
Its finally out! Let's welcome botogram 0.3.1!

botogram 0.3.1 is the third alpha release of botogram. It reaches almost feature parity with the upstream Telegram API (except for keyboards and inlines), including the new features in the Bot API 2.0 and 2.1 updates, such as moderating group chats or editing messages.

Performance are improved, with a faster updates fetching process, and a bug was fixed in this release. There are also a few deprecations to keep the API clean. All the deprecated features in this release will be removed in botogram 1.0, so you have plenty of time to switch to the new ones.

# Linux and macOS
$ python3 -m pip install -U "botogram==0.3.1"

# Windows
C:\> py -3 -m pip install -U "botogram==0.3.1"


Changelog:
https://botogram.pietroalbini.io/docs/0.3/changelog/0.3/
Discussion group: @botogram_users
botogram 0.3.2 is now out with the ability to send messages to channels (again)! I forgot to update the channels code while coding a new 0.3 feature (sorry!), and you wasn't able to send messages to channels at all in botogram 0.3.1.

Update it right now:
# Linux and macOS

$ python3 -m pip install -U "botogram==0.3.2"

# Windows

C:\> py -3 -m pip install -U "botogram==0.3.2"


If you notice any other issue feel free to report it in the issue tracker!

Changelog:
https://botogram.pietroalbini.io/docs/0.3/changelog/0.3/#botogram-0-3-2
Discussion group: @botogram_users
botogram 0.4 development started with a really big performance improvement: now botogram tries to reuse existing connections to Telegram as much as possible, making everything blazing fast. On my development machine (slow Internet connection), this almost tripled performances.

Changelog:
https://botogram.pietroalbini.io/docs/dev/changelog/0.4/
Discussion group: @botogram_users
A new bugfix release for the 0.2 serie is now out! It was reported by @Dario (thank you!) that botogram 0.2.1 crashed when someone edited a message, due to the new features introduced to the Bot API.

The new release, botogram 0.2.2, is now out for those of you who still run on that serie. It's advised to update as soon as possible, because a simple edit to a message crashes the bot. This bug does NOT affect the botogram 0.3 serie, so if you upgraded you're OK.

How to upgrade:
# Linux and macOS

$ python3 -m pip install -U "botogram==0.2.2"

# Windows

C:\> py -3 -m pip install -U "botogram==0.2.2"


Changelog:
https://botogram.pietroalbini.io/docs/0.2/changelog/#botogram-0-2-2
Discussion group: @botogram_users
Apparently half of the chat unavailable detection is broken because Telegram changed the error messages. I'm awaiting confirmation from the bot support, but expect a botogram 0.3.3 in the near future.

Discussion group: @botogram_users
And another bugfix release is out: let's welcome botogram 0.3.3!

All the bugfixes in this release are related to the unavailable chats detection. While one of them was a thing I forgot to implement, the others were undocumented changes made by Telegram, which partially broke the detection.

This means it's advised for everyone on botogram 0.3 to upgrade, especially the ones who relies on the unavailable chats detection. Users of botogram 0.2 don't have to worry about this bugs, because they're related to a new feature in botogram 0.3.

How to upgrade:
# Linux and macOS

$ python3 -m pip install -U "botogram==0.3.3"

# Windows

C:\> py -3 -m pip install -U "botogram==0.3.3"


Changelog:
https://botogram.pietroalbini.io/docs/0.3/changelog/0.3/#botogram-0-3-3
Discussion group: @botogram_users
Another bugfix release for botogram is out: let's welcome botogram 0.3.4!

This release fixes a regression in the deprecated Bot.send() method, which didn't work if you contacted supergroups or channels by username. It should be working now!

If you're using this feature you're advised to upgrade as soon as possible, and if you don't use it you can still upgrade since it doesn't break anything else. If you're on botogram 0.2 you don't have to worry since the regression was introduced in botogram 0.3.1.

How to upgrade:
# Linux and macOS
$ python3 -m pip install -U "botogram==0.3.4"
# Windows
C:\> py -3 -m pip install -U "botogram==0.3.4"


Changelog:
https://botogram.pietroalbini.io/docs/0.3/changelog/0.3/#botogram-0-3-4
Discussion group: @botogram_users
I think it's pretty clear I haven't devoted too much attention to botogram in the recent months, and that's not for the lack of time, but for the lack of my interest in the project. I'm diving into Rust (which is awesome by the way!) and botogram currently satisfies all my needs, so I'm not so motivated to continue writing new big features for it.

This doesn't mean I'm going to kill botogram or completly forget about its existence: if someone wants to get in and write one of the features botogram needs (such as keyboards and inlines), I'll be more than happy to review and merge them!

Pietro.

Discussion group: @botogram_users
Just to be clear, I'm still here, botogram works fine, it will keep working fine as it is, and if someone wants to contribute to it I'm more than happy to review, merge and release the changes. I'm just not motivated to write new features by myself :)
A small announcements: the botogram website & documentation moved to botogram.pietroalbini.org. Redirects should also be in place. Don't worry about its content: I only changed my personal domain from .io to .org, the website content is the same :)

Discussion group: @botogram_users
By the way, if you would like a PR to land into botogram 0.4 send it quickly :)
I plan to release it (with just the pull requests sent by the community, no new features implemented by me) sometimes this week!

Discussion group: @botogram_users
Nevermind, I'm actually working on something myself!
Support for inline keyboards (or, as I like to call them, buttons) just landed on the development version of botogram! You can start experimenting with them right now, while you wait a few weeks for the botogram 0.4 release!

As with other things in botogram, buttons are not just a plain wrapper of the Telegram API: instead, the implementation is heavily customized, to improve their usability and security. Check out the documentation for more information about that:

https://botogram.pietroalbini.org/docs/dev/buttons/
https://botogram.pietroalbini.org/docs/dev/api/buttons/

I'd like to receive feedback on the implementation, to make it even nicer. Hop into the discussion group and share your ideas or bugs: @botogram_users
I'd like to emphasize the security aspect of the botogram implementation of buttons a bit more.

As the Telegram documentation states, the callback data bots receive is not guaranteed to be the same one the bot sent to the user: malicious clients can change that, and this can cause unexpected behavior in your bot. For example, if you have a "delete message" callback that accepts a message ID, a malicious user can edit that ID in the callback it sends and potentially delete all the bot messages.

botogram tries hard to avoid this situation: all the callback data the user receives is digitally signed, and all incoming callbacks are checked for this signature. If the signature is missing or invalid, botogram rejects the request: it will never touch your code.

Other than that, all the callbacks are tied to the chat they were sent in: an user can't take a button and execute the related callback in a different chat, for example if he wants to execute an action he can do only in some chat in the other ones. Since buttons aren't forwarded along with their messages, this doesn't disrupt anything.

Learn more at:
https://botogram.pietroalbini.org/docs/dev/buttons/#buttons-security

Discussion group: @botogram_users
Finally, botogram 0.4 is now released!

botogram 0.4 is the fourth alpha release of botogram, and it includes lots of new features, bug fixes and performance improvements. The biggest feature added is support for buttons, but there are also multiple new APIs supported. Unfortunately not everything is currently supported, but it will in the future.

The update should not break your bot: even if you used existing "hacks" to implement features like callbacks, your old code should continue to work. If you find some code that breaks please report an issue on GitHub, so it can be fixed!

# Linux and macOS
$ python3 -m pip install -U "botogram==0.4"

# Windows
C:\> py -3 -m pip install -U "botogram==0.4"


Changelog:
https://botogram.pietroalbini.org/docs/0.4/changelog/0.4/
Discussion group: @botogram_users
botogram 0.5 is now released!

botogram 0.5 is another release of botogram, that adds support for a few new Bot API features, new translations (Portuguese and Brazilian Portuguese), and fixes a bug with callbacks. You can see all the new things in the changelog.

botogram 0.5 has no breaking changes, so you can upgrade from botogram 0.4 without worrying about it. Install it with:

# Linux and macOS
$ python3 -m pip install -U "botogram==0.5"

# Windows
C:\> py -3 -m pip install -U "botogram==0.5"


Changelog:
https://botogram.pietroalbini.org/docs/0.5/changelog/0.5/
Discussion group: @botogram_users