Archived
1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
teleexit/commands/cancel.py

18 lines
819 B
Python
Raw Normal View History

2020-11-07 16:09:41 +01:00
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton
from telegram.ext import CallbackContext, CommandHandler
from main import messages
def cancel(update: Update, context: CallbackContext):
if update.effective_chat.id in messages and\
update["_effective_user"]["id"] in messages[update.effective_chat.id]:
del messages[update.effective_chat.id][update["_effective_user"]["id"]]
context.bot.send_message(chat_id=update.effective_chat.id,
text="Action canceled",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🏘 Home",
callback_data="home")]]))
cancel_handler = CommandHandler("cancel", cancel)