0% found this document useful (0 votes)
26 views2 pages

Chiret Bot

This document is a Python script for a Telegram bot named Chiret Bot, which processes PDF, DOCX, and TXT files. It includes command handling for the '/start' command and a function to handle file uploads. The bot is set up with logging and runs using the Telegram API with a specified bot token.

Uploaded by

noname deraje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Chiret Bot

This document is a Python script for a Telegram bot named Chiret Bot, which processes PDF, DOCX, and TXT files. It includes command handling for the '/start' command and a function to handle file uploads. The bot is set up with logging and runs using the Telegram API with a specified bot token.

Uploaded by

noname deraje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

chiret_bot.

py
from telegram import Update

from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler,


ContextTypes, filters

import logging

# Set your Telegram bot token here

BOT_TOKEN = "PASTE_YOUR_BOT_TOKEN_HERE"

# Enable logging

logging.basicConfig(

format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',

level=logging.INFO

logger = logging.getLogger(__name__)

# Command: /start

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):

await update.message.reply_text("Welcome to Chiret Bot! Please send me a PDF, DOCX, or


TXT file to process.")

# Handle file uploads

async def handle_file(update: Update, context: ContextTypes.DEFAULT_TYPE):

document = update.message.document
await update.message.reply_text(f"Received file: {document.file_name}\nProcessing will
begin soon.")

def main():

app = ApplicationBuilder().token(BOT_TOKEN).build()

# Add command and message handlers

app.add_handler(CommandHandler("start", start))

app.add_handler(MessageHandler(filters.Document.ALL, handle_file))

# Run the bot

app.run_polling()

if __name__ == '__main__':

main()

You might also like