T
T
tommyfrozen2020-08-22 23:40:31
Python
tommyfrozen, 2020-08-22 23:40:31

/stop command for bot?

How to implement /stop command for bot in telegram? Googled for a day and found nothing. In the documentation xs how to dig on this issue (

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
SuckMyPython, 2020-08-25
@tommyfrozen

import os

@bot.message_handler(commands=["stop"])
def stop(message):
  if message.from_user.username == cfg.Father:	
    pid = str(os.getpid())
    stoper = open('ozerx/stoper.bat', 'w')
    stoper.write("Taskkill /PID " + pid + " /F")
    stoper.close()
    os.system('C:/Users/smp/Desktop/SMP/ozerx/stoper.bat')
  else:
    bot.send_message(message.chat.id, "Ты не Создатель бота; у тебя нет админ-прав, проваливай!")

K
kirillinyakin, 2020-08-23
@kirillinyakin

What do you want to use the stop command for?

S
soremix, 2020-08-23
@SoreMix

Just like any other team

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question