Skip to content

[THIS IS SPAM] bale_python_bot #4279

Description

@amiirali-docto
data = response.json()

if data["ok"]:
    for update in data["result"]:
        last_update = update["update_id"]

        if "message" not in update:
            continue

        message = update["message"]
        message_id = message["message_id"]  # برای ریپلای
        chat_id = message["chat"]["id"]
        text = message.get("text", "").strip()
        answer = None
        # سلام
        if text == "سلام":
            answer = "سلام! 👋 حالت چطوره؟"

        elif text == "خوبی":
            answer = "مرسی تو چطوری؟"

        
        # معرفی
        elif text == "اسم":
            answer = "من بات اسکادران هستم 🤖"

        # ساعت
        elif text in ["ساعت", "تایم"]:
            now = datetime.now()
            answer = f"🕒 ساعت:\n{now.strftime('%H:%M:%S')}"

        # تاریخ
        elif text == "تاریخ":
            today = jdatetime.datetime.now()
            answer = f"📅 تاریخ امروز:\n{today.strftime('%Y/%m/%d')}"

        # تاس
        elif text == "تاس":
            dice = random.randint(1, 6)
            answer = f"🎲 عدد تاس: {dice}"
        
        # ماشین حساب
        elif text.startswith("حساب "):
            try:
                expression = text[5:]
                expression = expression.replace("×", "*")
                expression = expression.replace("÷", "/")

                result = calculate(
                    ast.parse(expression, mode="eval").body
                )

                answer = f"🧮 نتیجه:\n{result}"

            except:
                answer = (
                    "❌ عبارت نامعتبر است.\n\n"
                    "مثال:\n"
                    "حساب 5+7\n"
                    "حساب 10*3\n"
                    "حساب (8+2)*5"
                )
        
        # راهنما
        elif text in ["کمک", "/help", "راهنما"]:
            answer = (
                "📋 دستورات ربات\n\n"
                "👋 سلام\n"
                "🤖 اسم\n"
                "🕒 ساعت\n"
                "📅 تاریخ\n"
                "🎲 تاس\n"
                "🧮 حساب 5+7\n"
                "🧮 حساب (8+2)*5"
            )
            
        # ارسال پاسخ به صورت ریپلای
        requests.post(
            f"{BASE_URL}/sendMessage",
            json={
                "chat_id": chat_id,
                "text": answer,
                "reply_to_message_id": message_id
            }
        )

except Exception as e:
print("خطا:", e)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions