Answer the question
In order to leave comments, you need to log in
How to consistently receive messages in a Telegram bot?
@bot.message_handler(content_types=['text'])
def handle_messages(messages):
for message in messages:
if message.text == "/start":
bot.send_message(
message.chat.id,
messages.start_message[0] + '\n' + messages.start_message[1]
)
print(message.from_user.id)
elif message.text.lower() == "/newplayer":
new_player_name = message.from_user.first_name
new_player_id = message.from_user.id
player.new_player(new_player_name, new_player_id)
bot.send_message(message.from_user.id, messages.player_created)
print(player.qplayers)
elif message.text == "/help":
bot.send_message(message.from_user.id, "используй /start")
elif message.text == "/startgame":
bot.send_message(message.from_user.id,'Добро пожаловать в игру финансовые воротилы!')
mes=1
tabl.Level=3
bot.send_message(message.from_user.id,'Начало игры')
while mes < 13:
bot.send_message(message.from_user.id,'Текущий месяц = ' + str(mes))
costs.monthlyCosts()
starshiy=m.fmod(mes, player.CurNumOfGamers)
tabl.Level=tabl.LevelCount(tabl.Level)
Esm.AcquisitionOfEsm(tabl.Level, message, bot)
production.productionEgp()
Egp.AcquisitionOfEgp(tabl.Level)
for ActualGamer in range(player.CurNumOfGamers):
buildings.buildings(ActualGamer)
mes+=1
else:
bot.send_message(message.from_user.id, "Я тебя не понимаю. Напиши /help.")
bot.polling(none_stop=True, interval = 5)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question