Python: Telegram Bot API: Ask/Answer question

PHOTO EMBED

Mon Aug 29 2022 17:01:40 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #python

#Server:

import telebot
import json
import sys
from telebot import types

bot_token = '999999999:xxxxxxxxxxxxxxxxxxxx'
bot = telebot.TeleBot(bot_token)

chat_id = '123123123'

@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    
    #print(call)

    if call.data == '1':
        bot.send_message(call.message.chat.id, 'Aprobado!')
        #bot.send_message(call.from_user.id, 'Aprobado!')
    else:
        bot.send_message(call.message.chat.id, 'Rechazado!')
        #bot.send_message(call.from_user.id, 'Rechazado!')

    bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id)

bot.polling()



# Client:

import telebot
import json
import sys
from telebot import types

bot_token = '99999999:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
bot = telebot.TeleBot(bot_token)

chat_id = '123123123'

text = "Responda: Desea aprobar el procedimiento XXXX ??? "

markup_command = types.InlineKeyboardMarkup()

btn_p1 = types.InlineKeyboardButton(text='Lo apruebo', callback_data='1')
btn_p2 = types.InlineKeyboardButton(text='No lo apruebo', callback_data='2')
markup_command.add(btn_p1)
markup_command.add(btn_p2)

bot.send_message(chat_id, text, reply_markup=markup_command)
content_copyCOPY

Python Telegram Bot for ask and get answer from a question.