I'm writing a telegram-bot. It checks the email box(common to all), and if it finds the set parameters then returns some information to the user and delete this email that contains this parameters. So the problem is this: when I call this bot alone, everything's alright, but if I cal it from several accounts at the same time, it doesn't work correctly. It either doesn't send the information, or sends it incorrectly. It sends the info which belongs to other user. I can't solve this? Can anybody advise me something? Sorry for my Ruslish)))
import config
import mail
import exmo_exchange
import telebot
from telebot import types
from random import randint
bot=telebot.TeleBot(config.token)
keyboard1=telebot.types.ReplyKeyboardMarkup(True)
keyboard1.row('EXMO')
keyboard2=telebot.types.ReplyKeyboardMarkup(True)
keyboard2.row('Да',' Нет')
keyboard3=telebot.types.ReplyKeyboardMarkup(True)
keyboard3.row('Я ОПЛАТИЛ')
summi_coda_i_plati=[]
@bot.message_handler(commands=['start'])
def start_messages(message):
msg=bot.send_message(message.chat.id, 'Привет, что хотите обменять?: ',reply_markup=keyboard1)
@bot.message_handler(content_types=["text"])
def send_text(message):
try:
if message.text.lower()=='exmo':
msg=bot.send_message(message.chat.id,'Введите сумму в EXMO')
elif message.text.lower()=='btc':
msg=bot.send_message(message.chat.id,'Введите сумму в BTC')
bot.register_next_step_handler(msg, send_digit)
except Exception as e:
bot.reply_to(message,'Чтобы начать сначала нажмите "/start"')
@bot.message_handler(content_types=["text"])
def send_digit (message):
summ=message.text
if summ.isdigit():
summi_coda_i_plati.append(int(summ))
summ2=int(summ)*1.10
summ3=int(summ2)+randint(-3,+9)
summi_coda_i_plati.append(str(summ3))
otvet=str(summ3)+' рублей на карту'
msg=bot.send_message(message.chat.id,otvet)
msg=bot.send_message(message.chat.id,' Готов?',reply_markup=keyboard2)
bot.register_next_step_handler(msg, send_number)
else:
msg=bot.send_message(message.chat.id,'Вы ввели некорректные данные. Чтобы начать сначала, нажмите "/start"')
bot.register_next_step_handler(msg, start_messages)
@bot.message_handler(content_types=["text"])
def send_number (message):
if message.text.lower()=='да':
number='5536 9137 7601 0502'
otvet='Переведите на номер карты "Тинькофф ": '+number+''' указанную выше сумму.
После оплаты нажмите ОДИН РАЗ "Я ОПЛАТИЛ" и ждите получения кода.
Как только средства поступят, бот выдаст код. Не нужно жать кнопку несколько раз.
ПЕРЕВОДИТЕ ТОЧНО ТУ СУММУ, ЧТО УКАЗАНА БОТОМ, ИНАЧЕ ВОЗНИКНУТ СЛОЖНОСТИ С ВЫДАЧЕЙ КОДА'''
msg=bot.send_message(message.chat.id, otvet,reply_markup=keyboard3 )
bot.register_next_step_handler(msg, send_code)
else:
msg=bot.send_message(message.chat.id, 'Чтобы начать сначала нажмите "/start" ')
bot.register_next_step_handler(msg, start_messages)
@bot.message_handler(content_types=["text"])
def send_code(message):
if message.text.lower()=='я оплатил':
user_id=message.from_user.id
name_of_user=message.from_user.username
excode_to_send=mail.email_check(summi_coda_i_plati[0],summi_coda_i_plati[1])
msg=bot.send_message(message.chat.id,excode_to_send)
bot.polling()
(Jul-01-2020, 09:40 AM)AlexSn2020 Wrote: [ -> ]I'm writing a telegram-bot. It checks the email box(common to all), and if it finds the set parameters then returns some information to the user and delete this email that contains this parameters. So the problem is this: when I call this bot alone, everything's alright, but if I cal it from several accounts at the same time, it doesn't work correctly. It either doesn't send the information, or sends it incorrectly. It sends the info which belongs to other user. I can't solve this? Can anybody advise me something? Sorry for my Ruslish)))
i have same problem, did you manage to solve it?
(May-13-2024, 06:51 PM)david_jr_br Wrote: [ -> ]i have same problem, did you manage to solve it?
Please post a new question. The questions you are replying to have not had any action in years, the original posters showing no activity for a similar period. They will not help you.