From aed7ec04ca25cb4ad6d876e811c511fa80677c98 Mon Sep 17 00:00:00 2001 From: Arjun00000 Date: Thu, 7 Nov 2024 12:24:25 +0530 Subject: [PATCH] Create Telegram bot Telegram extractor --- Telegram bot | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Telegram bot diff --git a/Telegram bot b/Telegram bot new file mode 100644 index 00000000..93fefb7b --- /dev/null +++ b/Telegram bot @@ -0,0 +1,29 @@ +import logging +from telegram.ext import Updater, CommandHandler, MessageHandler + +TOKEN = 7901866660:AAFJ2Te56IAreu3nxnXKgRrQXNEKMF3CoSg # + +logging.basicConfig(level=logging.INFO) + +def save_restricted_content(update, context): + # Save content to file + file_id = update.message.document.file_id + file = context.bot.get_file(file_id) + file.download('restricted_content/') + +def restrict_access(update, context): + # Restrict access to saved content + context.bot.send_message(chat_id=(link unavailable), text='Access restricted.') + +def main(): + updater = Updater(TOKEN, use_context=True) + dp = updater.dispatcher + + dp.add_handler(CommandHandler('save', save_restricted_content)) + dp.add_handler(CommandHandler('restrict', restrict_access)) + + updater.start_polling() + updater.idle() + +if __name__ == '__main__': + main()