Add /cancel

This commit is contained in:
Ceda EI 2021-06-20 18:42:25 +05:30
parent 1704b4a2f9
commit 111b101714
1 changed files with 6 additions and 1 deletions

7
bot.py
View File

@ -2,6 +2,7 @@
import os
import os.path as pt
import shutil
from telegram.ext import Updater, CommandHandler, MessageHandler, filters
import config
@ -36,7 +37,11 @@ def on_finish(upd, ctx):
def on_cancel(upd, ctx):
pass
user_id = upd.effective_chat.id
path = f"data/{user_id}"
if pt.isdir(path):
shutil.rmtree(f"data/{user_id}")
ctx.bot.send_message(upd.effective_chat.id, f"Cleared images")
updater = Updater(token=config.API_KEY, use_context=True)