import telebot import config import random from telebot import types bot =…
- User
import telebot import config import random
from telebot import types
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start']) def welcome(message): sti = open('welcome.webp', 'rb') bot.send_sticker(message.chat.id, sti)
# keyboard markup = types.ReplyKeyboardMarkup(resize_keyboard=True) item1 = types.KeyboardButton("🎲 Рандомное число от 0 до 100") item2 = types.KeyboardButton("😊 Как дела?") item3 = types.KeyboardButton("🎰 Рандомное число от 0 до 10") markup.row(item1, item2, item3) bot.send_message(message.chat.id, "Привет, {0.first_name}!\nЯ - <b>{1.first_name}</b>, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me()), parse_mode='html', reply_markup=markup)@bot.message_handler(content_types=['text']) def lalala(message): if message.chat.type == 'private': if message.text == '🎲 Рандомное число от 0 до 100': bot.send_message(message.chat.id, str(random.randint(0,100))) elif message.text == "🎰 Рандомное число от 0 до 10": bot.send_message(message.chat.id, str(random.randint(0,10))) elif message.text == '😊 Как дела?':
markup = types.InlineKeyboardMarkup(row_width=2) item1 = types.InlineKeyboardButton("Хорошо", callback_data='good') item2 = types.InlineKeyboardButton("По кайФУ", callback_data='bad') markup.add(item1, item2) bot.send_message(message.chat.id, 'Отлично, сам как?', reply_markup=markup) else: bot.send_message(message.chat.id, 'Я не знаю что ответить 😢')@bot.callback_query_handler(func=lambda call: True) def callback_inline(call): try: if call.message: if call.data == 'good': bot.send_message(call.message.chat.id, 'Вот и отличненько 😊') elif call.data == 'bad': bot.send_message(call.message.chat.id, 'У меня тоже вайся покайФУ')
# remove inline buttons bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text="😊 Как дела?", reply_markup=None) # show alert bot.answer_callback_query(callback_query_id=call.id, show_alert=False, text="Эти ващи по каиФУ!!!") except Exception as e: сделай кнопку казино при нажатии на которую бот пишет какая ставка мы пишем любое число и он спрашивает черное или красное и 50 на 50 черное или красное если угадываем то ставка возвращается в х2 а если нет то не возвращается print(repr(e))RUN
bot.polling(none_stop=True)
- Assistant
It seems that there is an error in the code. The line
сделай кнопку казино при нажатии на которую бот пишет какая ставка мы пишем любое число и он спрашивает черное или красное и 50 на 50 черное или красное если угадываем то ставка возвращается в х2 а если нет то не возвращаетсяis not valid Python code and is causing a syntax error.If you need help with a specific part of the code or have any questions, please let me know and I'll be happy to assist you.