CoolFace
Datasetpublic

ysn-rfd/text-dataset-tiny-code-script-py-format

USED of tahamajs/medicine_ds_persian for .parquet file USED of Alijafarixcs2/persian-it-llama2-2k for .parquet file USED of Abirate/english_quotes for .jsonl file NEW FILES (05/12/2025) NEW FILES (12/26/2025) NEW FILES (02/15/2026)

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
3likes1.6kdownloads
bot.py28 linesDownload Raw Back to python
1# bot.py
2from telegram import Update
3from telegram.ext import ApplicationBuilder, MessageHandler, filters, ContextTypes
4import openai
5from openai import OpenAI
6import config
7
8
9client = OpenAI(api_key=config.OPENAI_API_KEY)
10
11async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
12    user_message = update.message.text
13
14    response = client.chat.completions.create(
15        model="gpt-3.5-turbo",
16        messages=[
17            {"role": "user", "content": user_message}
18        ]
19    )
20
21    reply = response.choices[0].message.content
22    await update.message.reply_text(reply)
23
24# راه‌اندازی ربات
25app = ApplicationBuilder().token(config.TELEGRAM_BOT_TOKEN).build()
26app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_message))
27app.run_polling()
28