N
N
Nikolai Neizvestny2020-05-09 14:24:02
Python
Nikolai Neizvestny, 2020-05-09 14:24:02

Fix the problem with the availability of telegram bot commands admin rights?

It's this kind of thing that when I send a message to all users at the time of sending a message to the bot for mailing, if someone uses it in parallel at the same moment and sends a message first to me, then the mailing goes of this message, and in general I sometimes see that requests from other users break into my session. How to fix it? help me please

@run_async
def start(bot, update):
    message = update.message
    base_work.user_init(message.chat.id, message.chat.username, message.chat.first_name)
    bottons = 
    if message.chat.id in constants.admins:
        bottons.append(['Количество покупателей', 'Рассылка', 'Все пользователи'])
    keyboard = ReplyKeyboardMarkup(bottons, resize_keyboard=True)
    bot.send_photo(message.chat.id,'https://srv4.imgonline.com.ua/result_img/imgonline-com-ua-Resize-BEKYG5ckLJx.jpg', caption = texts.hello_text, reply_markup=keyboard)

@run_async
def answer(bot, update):
    global mail, city, cit, rayon,lol, tovari, lol1, tovar
    message = update.message
    if (message.chat.id in constants.admins) and message.text == 'Рассылка':
        bot.send_message(message.chat.id, 'Напишите сообщение!')
        mail = True
    elif mail == True:
        mail = False
        bot.send_message(message.chat.id, 'В течении 3 секунд, отправиться всем пользователям!')
        for i in base_work.all_id():        
            try:
                bot.send_message(i[0], message.text)
                pass
            bot.send_message(message.chat.id, 'Все')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-05-09
@bacon

global, that says it all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question