Removal of the user from the bonnet database



  • Good day, morning, night.

    I'm working a telebot telegram. I've been dealing with a problem where a bot doesn't send out to all users if one of them stopped the bot.

    I've got a database (Text file with ID) that adds users after the bot has been launched, and it's written off without repetition, all of which.

    @bot.message_handler(commands=['start'])
    def welcome(message):
        if not message.chat.id in joinUser:
            join = open("join.txt", "a")
            join.write(str(message.chat.id) + "\n")
            joinUser.add(message.chat.id)
            join.close()
    

    After which, I want to send out to all the signatories, open a file with ID and send a message to everyone on the order of this file, and there's a problem if a person's resigned, his ID from the base is not removed and the bot will hang over the message and send it to no one.

    bot.message_handler(commands=["rs"])
    def mess(message):
        if ADMIN == message.chat.id:
            for user in joinUser:
                bot.send_message(user,message.text[message.text.find(" "):])
    

    Therefore, how can we verify that the user stopped the bean and removed it from the OBD system?



  • I recommend using mysql for this. In fact, when a man cuts off from a bet, you get an apdite that you can say and remove the bean from your bud.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2