in the FAQ page there is a simple code but is not working.... bot.send_message() i can't find it
Читать полностью…As i saw yesterday....i need to read, in a chat, only the messages sent by the bot...not the messages user because i need to extract an information
Читать полностью…I guessed it, I will do a workaround then. thank you N and "This is fine(2)" for your support again.
Читать полностью…Hi, I'm unable to edit a message send by the bot, if it contains a replay_markup.
anyone know why?
Maybe, i saw too this class but (maybe I'm just misunderstanding too) i don't think this could help me. I'll try to explain the whole process
I have a command that calls an api that retrieve all my devices/services in my environment. I show them using a inline keyboard. When user click one of them, like the motor service, telegram a new api that retrieves all functions available for my motor. I show them using a new inline keyboard.
Functions may have different structures:
1)some of them can retrieve data (eg i want to know le position of my motor)
2)some are commands (eg i want my motor to return to its zero)
3)some are commands, so user needs to specify something (eg user says to motor to rotate 45 degrees).
So click on buttons in inline keyboard may be a good idea in case 1 or 2 but in case 3 i need something more. An idea is to prepare the message editable so user has to add only the custom part
Eg
u: /services
bot: telegram, motor, noir camera
u: *click on motor*
bot: *retrieve motor functions* getDegree, rotate, goToZero
Case 1 ->
u: *click on getDegree*
b: *retrieve degrees*
Case 2 ->
u: *click on rotate *
b: *prepare the following message in draft* /rotate ? motor1
u: *complete the message then send * /rotate ?motor1 90
b: *rotate motor*
And json is a format not a python type. You can have json strings, dicts, lists, etc.
Читать полностью…Yes...sure i'm using a regex but i have to access to the bot message not user message....probably the @BiboJoshi solution can be the right way....
Читать полностью…Hi Harry...
Thank you for your quick reply....i send from graylog a message with an ip address inside.... The message is sent from the bot itself...
I thought that the echo examples could be good for this but it read only user messages
Читать полностью…there always is a chance, currently it's just very low 🤡
The biggest problem is that we were not yet able to come up with a clean implementation idea.
Is there any chance of a proper implementation coming in the library?
https://github.com/python-telegram-bot/python-telegram-bot/issues/2539#issuecomment-1773883020
Wiki of python-telegram-bot - Category Design Pattern
How to deal with multiple CBQ from one button
To be more specific — you can only edit messages with no reply markup at all, or with inline keyboard markup
Читать полностью…reply_keyboard = [[KeyboardButton("send phone no", request_contact=True)]]
markup = ReplyKeyboardMarkup(
reply_keyboard,
one_time_keyboard=True,
)
msg = await update.message.reply_text(
"Start: Send your phone number", reply_markup=markup
)
reply_markup=markup
It can be edited later using msg.edit_text
Читать полностью…
You can't really prepare a message in draft, you could via inline queries but that is a very weird user experience.
Just edit the message, write in it "Please send the degrees you want the motor to rotate, as a number between 0-360" and messagehandler the next update
Whatever mod.__user_info__(chat_obj.id)
is. it's a coroutine. If you want to do something to the result of calling said coroutine, you have to await it first
If you inject the IP address into the message surely you already have it? Or just do a regex to find the IP if its part of a larger string
Читать полностью…Wiki of python-telegram-bot - Category FAQ
How do I access info about the message my bot sent?