403Webshell
Server IP : 157.230.181.24  /  Your IP : 216.73.217.11
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64
User :  ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/aim-bots/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/aim-bots/burst_planner.py
"""Plan multi-message AIM bursts from voice stats and archive patterns."""

from __future__ import annotations

import random
import re


class BurstPlanner:
    def __init__(self, voice: dict, persona: dict) -> None:
        self.voice = voice
        self.persona = persona
        self.pct_multi = float(voice.get("pct_multi") or persona.get("pct_multi") or 0.45)
        self.patterns = voice.get("timing_profile", {}).get("burst_patterns") or []

    def _split_natural(self, text: str) -> list[str]:
        text = re.sub(r"\s+", " ", text.strip())
        if not text:
            return []
        if "|" in text:
            return [p.strip() for p in text.split("|") if p.strip()][:4]

        words = text.split()
        if len(words) <= 6:
            return [text]

        # comma / dash / sentence breaks like real AIM
        parts = re.split(r"(?<=[,!?])\s+|\s+-\s+", text)
        parts = [p.strip() for p in parts if p.strip()]
        if 2 <= len(parts) <= 4:
            return parts[:4]

        if len(words) > 12 and random.random() < 0.55:
            mid = len(words) // 2
            return [" ".join(words[:mid]), " ".join(words[mid:])]

        return [text]

    def _from_pattern(self) -> list[str] | None:
        if not self.patterns or random.random() > 0.12:
            return None
        pat = random.choice(self.patterns)
        msgs = pat.get("messages") or []
        return [m for m in msgs if m][:3] or None

    def plan(self, parts: list[str], incoming: str, mode: str, hesitate: bool = False) -> list[str]:
        if hesitate:
            filler = random.choice(["...", "uh", "haha", "lol", "wait", "umm"])
            if filler not in parts:
                parts = [filler] + parts

        if len(parts) > 1:
            return parts[:4]

        single = parts[0] if parts else ""
        if not single:
            return parts

        # hot back-and-forth: often stay single line
        if mode == "hot" and len(single.split()) <= 8 and random.random() < 0.72:
            return [single]

        if random.random() > self.pct_multi and len(single.split()) <= 10:
            return [single]

        split = self._split_natural(single)
        if len(split) > 1:
            return split[:4]

        # short follow-up like archive ("haha" then real answer)
        if mode != "hot" and len(single.split()) >= 4 and random.random() < 0.28:
            followups = ["lol", "haha", "idk", "yeah", "for real", "u?", "...", ":-)", "xD"]
            return [single, random.choice(followups)]

        patterned = self._from_pattern()
        if patterned and random.random() < 0.08:
            return patterned

        return [single]

Youez - 2016 - github.com/yon3zu
LinuXploit