D
D
Deniska_1232021-02-16 20:24:36
Python
Deniska_123, 2021-02-16 20:24:36

Pyrogram - how to correctly display a post in send.message() instead of text?

I am creating applications in a telegram using Python + Pyrogram + sql3 and my task is to make buttons under the post (inlinebuttons) with the help of a bot and the method that helps me is called .send_message(chat_id, 'text', reply_markup)
and in general I have already received a post with which I can work, but when instead of the 'text' parameter I insert the variable message (my post), then instead of the post I get:

{
"_": "Message",
"message_id": 227,
"sender_chat": {
"_": "Chat",
"id": -1001225149347,
"type": "channel",
"is_verified": false,
" is_restricted": false,
"is_creator": true,
"is_scam": false,
"title": "Moder_channel",
"username": "RandModer",
"photo": {
"_": "ChatPhoto",
"small_file_id": "AQADAgAT7lBJni4AAwIAA12kVOIWU6wZNIjAWAnJEQEAAR4E",
"small_photo_unique_id": "AQAD7lBJni4AA8kRAQAB",
"big_file_id": "AQADAgAT7lBJni4AAwMAA12kVOIWU6wZNIjAWAnLEQEAAR4E",
"big_photo_unique_id": "AQAD7lBJni4AA8sRAQAB"
},
"dc_id": 2
},
"date": "2021-02-14 11:29:00",
"chat": {
"_": "Chat",
"id": -1001225149347,
"type": "channel",
"is_verified": false,
"is_restricted": false,
"is_creator": true,
"is_scam": false,
"title": "Moder_channel",
"username": "RandModer" ,
"photo": {
"_": "ChatPhoto",
"small_file_id": "AQADAgAT7lBJni4AAwIAA12kVOIWU6wZNIjAWAnJEQEAAR4E",
"small_photo_unique_id": "AQAD7lBJni4AA8kRAQAB",
"big_file_id": "AQADAgAT7lBJni4AAwMAA12kVOIWU6wZNIjAWAnLEQEAAR4E",
"big_photo_unique_id": "AQAD7lBJni4AA8sRAQAB"
},
"dc_id": 2
},
"forward_from_chat": {
"_": "Chat",
"id": -1001446928769,
"channel" ",
"is_verified": false,
"is_restricted": false,
"is_creator": true,
"is_scam": false,
"title": "test",
"username": "dsafjdfs"
},
"forward_from_message_id": 78,
"forward_date": "2021-02-14 11:28:59",
"mentioned": false,
"scheduled": false,
"from_scheduled": false,
"text": "what?",
"views": 1,
"outgoing": true
}


how can i convert it to a post?
here is how the piece of code for adding buttons to the post looks like

with app1:
app1.send_message(eval(moder), message,
reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton("Yes", callback_data="2")],
[InlineKeyboardButton("No", url=" https://docs. pyrogram.org ")]
]))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vponemax, 2021-03-03
@vponemax

So everything is correct, you passed the message class object, and not the text or media from this object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question