Open kafixxx opened 1 year ago
import telebot import webbrowser from telebot import types
bot = telebot.TeleBot("token")
@bot.message_handler(commands=['start']) def main(message): bot.send_message(message.chat.id, f'ПРИВЕТ , {message.from_user.first_name} , это kafix bot!')
@bot.message_handler() def info(message): if message.text.lower() == 'привет': bot.send_message(message.chat.id, f'ПРИВЕТ , {message.from_user.first_name} !') elif message.text.lower() == 'id': bot.reply_to(message, f'ID: {message.from_user.id}') elif message.text.lower() == 'me': bot.send_message(message.chat.id, message)
@bot.message_handler(content_types=['photo']) def get_photo(message): markup = types.InlineKeyboardMarkup() markup.add(types.InlineKeyboardButton('НАЙТИ ПОХОЖИЕ?', url='https://pinterest.com')) btn1 = types.InlineKeyboardButton('Удалить фото',callback_data='delete') markup.row(btn1) bot.reply_to(message, 'Красивое фото!', reply_markup=markup)
@bot.callback_query_handler(func=lambda callback: True) def call(callback): if callback.data == 'delete': bot.delete_message(callback.message.chat.id, callback.message.message_id -1 )
bot.polling(non_stop=True)
import telebot import webbrowser from telebot import types
bot = telebot.TeleBot("token")
@bot.message_handler(commands=['start']) def main(message): bot.send_message(message.chat.id, f'ПРИВЕТ , {message.from_user.first_name} , это kafix bot!')
@bot.message_handler() def info(message): if message.text.lower() == 'привет': bot.send_message(message.chat.id, f'ПРИВЕТ , {message.from_user.first_name} !') elif message.text.lower() == 'id': bot.reply_to(message, f'ID: {message.from_user.id}') elif message.text.lower() == 'me': bot.send_message(message.chat.id, message)
@bot.message_handler(content_types=['photo']) def get_photo(message): markup = types.InlineKeyboardMarkup() markup.add(types.InlineKeyboardButton('НАЙТИ ПОХОЖИЕ?', url='https://pinterest.com')) btn1 = types.InlineKeyboardButton('Удалить фото',callback_data='delete') markup.row(btn1) bot.reply_to(message, 'Красивое фото!', reply_markup=markup)
@bot.callback_query_handler(func=lambda callback: True) def call(callback): if callback.data == 'delete': bot.delete_message(callback.message.chat.id, callback.message.message_id -1 )
bot.polling(non_stop=True)