import telebot
import multiprocessing
# Tokens
bot1_token = '8853281015:Wfw_232rrfzwuQIduiqyuf212_8d7yuw124'
bot2_token = '5730985673:WHt_37aj24Adh28Wf27fwqi_248228524'
def bot1_listener():
bot1 = telebot.TeleBot(bot1_token)
@bot1.message_handler(commands=["x"])
def start(m, res=False):
bot1.send_message(m.chat.id, '123')
bot1.polling(none_stop=True, interval=0)
def bot2_listener():
bot2 = telebot.TeleBot(bot2_token)
# Define your message handlers for bot2 here
bot2.polling(none_stop=True, interval=0)
if __name__ == "__main__":
process1 = multiprocessing.Process(target=bot1_listener)
process2 = multiprocessing.Process(target=bot2_listener)
# Start the bot processes
process1.start()
process2.start()
process1.join()
process2.join()
import time
from telebot import types
current_step = None
def family_buttons(message):
global current_step
email(message)
current_step = 'email'
def email(message):
markup = types.InlineKeyboardMarkup(row_width=1)
email_button = types.InlineKeyboardButton('Введите почту', callback_data='email')
markup.add(email_button)
bot.send_message(message.chat.id, 'Время заполнения поля 30 секунд', reply_markup=markup)
def phone_code(message):
markup = types.InlineKeyboardMarkup(row_width=1)
phone_code_button = types.InlineKeyboardButton('Введите код телефона', callback_data='phone_code')
markup.add(phone_code_button)
bot.send_message(message.chat.id, 'Нажмите для заполнения поля!', reply_markup=markup)
@bot.callback_query_handler(func=lambda call: True)
def callback(call):
global current_step
if call.message:
if call.data == 'email':
text_email = bot.send_message(chat_id=call.message.chat.id, text='Введите почту')
bot.register_next_step_handler(text_email, next)
elif call.data == 'phone_code':
text_phone_code = bot.send_message(chat_id=call.message.chat.id, text='Введите код телефона')
bot.register_next_step_handler(text_phone_code, next)
def next(message):
global current_step
if current_step == 'email':
# Обработка введенной почты
current_step = 'phone_code'
phone_code(message)
elif current_step == 'phone_code':
# Обработка введенного кода телефона
current_step = None
# Здесь можете выполнить какие-то действия после завершения обоих шагов
accepted_invites = {} # словарь для хранения информации о том, принял ли игрок приглашение или нет
@bot.message_handler(func=lambda message: True)
def handle_all_messages(message):
chat_id = message.chat.id
if message.text == "Принять приглашение":
if chat_id in accepted_invites:
if accepted_invites[chat_id]:
bot.send_message(chat_id, "Вы уже приняли приглашение.")
else:
bot.send_message(chat_id, "Вы приняли приглашение. Ожидайте начала игры.")
accepted_invites[chat_id] = True
# проверяем, приняли ли оба игрока приглашение
if all(accepted_invites.values()):
# начинаем игру
start_game()
else:
bot.send_message(chat_id, "Вы не получили приглашение на игру.")
def start_game():
# список chat_id игроков, которые приняли приглашение
players = [chat_id for chat_id, accepted in accepted_invites.items() if accepted]
# здесь можно продолжить реализацию логики игры