micropython telegram inline key button

135 views
Skip to first unread message

Paolo De Caro

unread,
Feb 24, 2023, 12:04:38 PM2/24/23
to thonny
Good evening I'm using the pico w device, so I use Thonny and Micropython, I need to use Telegram with inlinekeybutton and Telegram.InlineKeyboardMarkup. I can't load these classes with Thonny and Pico. Kindly can someone help me. Thank you

Buonasera sto usando il device pico w, quindo utilizzo Thonny e Micropython, ho esigenzadi usare Telegram con inlinekeybutton e Telegram.InlineKeyboardMarkup. Non riesco a caricare queste classi con Thonny e Pico. Gentilmente qualcuno può aiutarmi . Grazie 

Andy Piper

unread,
Feb 24, 2023, 1:11:30 PM2/24/23
to thonny
It is unlikely that the Telegram module that you're using is directly compatible with MicroPython (but, it might be).

Can you share the code you're trying to use, and the error you are seeing in loading the classes?


On Fri, Feb 24, 2023 at 5:04 PM Paolo De Caro <paolo....@gmail.com> wrote:
Good evening I'm using the pico w device, so I use Thonny and Micropython, I need to use Telegram with inlinekeybutton and Telegram.InlineKeyboardMarkup. I can't load these classes with Thonny and Pico. Kindly can someone help me. Thank you

Buonasera sto usando il device pico w, quindo utilizzo Thonny e Micropython, ho esigenzadi usare Telegram con inlinekeybutton e Telegram.InlineKeyboardMarkup. Non riesco a caricare queste classi con Thonny e Pico. Gentilmente qualcuno può aiutarmi . Grazie 

--
You received this message because you are subscribed to the Google Groups "thonny" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thonny+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thonny/602b3377-2722-4143-871a-15c6f8125501n%40googlegroups.com.


--
Andy Piper | Kingston upon Thames, London (UK)
links: https://andypiper.me  | fediverse: @andy...@macaw.social 

Paolo De Caro

unread,
Feb 25, 2023, 7:22:12 AM2/25/23
to thonny
Hello and thanks for your help, here are the first lines of the code


from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update


I get this error :

raceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'telegram.InlineKeyboardButton'

in Thonny il pacchetto Telegram risulta installato.
In practice I would like to apply the example you see below with Pico W , use a menu of buttons.
as an example below:
I


Grazie amico

Andy Piper

unread,
Feb 25, 2023, 8:45:31 AM2/25/23
to thonny
In this example the Python library for Telegram is called telepot. You would need to install this on your Pico W, and it would need to work in MicroPython (which has the same syntax as Python 3, but not all features are available as this is built specifically for microcontrollers like the RP2040 and others). If you simply changed the word "telepot" to "telegram" in Thonny, then there is no such class or module that matches. 

Looking at GitHub, telepot has not been maintained since 2019 https://github.com/nickoala/telepot

I used the Awesome MicroPython list to check for a Telegram library for MicroPython and there are at least two of them - search for "Telegram" here https://awesome-micropython.com/

You'll need to install the library to your Pico W in the lib/ directory and then import it. I expect that it will have different features to the telepot library, so you'll probably need to update the other code.



Reply all
Reply to author
Forward
0 new messages