Phase 2: Fix triggers & dialogue — per-channel cooldowns, tension rebalance, user-message triggers
- Changed cooldown from global (ALL channels blocked) to per-channel dict keyed by channel_id - Added conversation streak tracker: 3 near-miss interjection scores in a row force a dialogue trigger - Expanded topic relevance keywords: added enthusiasm/vulnerability for Evil Miku, provocation/dismissal for Miku - Lowered keyword divisor from /3.0 to /2.0 for higher base trigger scores - Tension rebalance: added natural decay (-0.03/turn), reduced escalation weight (0.08->0.05), increased de-escalation weight (0.06->0.08) - Reduced momentum multiplier (1.2->1.1) and intensity multiplier (1.3->1.2) - Added spike cooldown: if last turn tension delta >0.15, next delta halved (prevents runaway spirals) - Added user-message interjection check in bot.py on_message() (was only checking bot's own messages) - Added random 15% argument trigger roll on user messages in normal message flow (was only from autonomous.py)
This commit is contained in:
26
bot/bot.py
26
bot/bot.py
@@ -203,6 +203,32 @@ async def on_message(message):
|
||||
if is_persona_dialogue_active(message.channel.id):
|
||||
return
|
||||
|
||||
# Bipolar mode: check if the opposite persona should interject on user messages
|
||||
# AND roll for random argument trigger (both non-blocking background tasks)
|
||||
if not isinstance(message.channel, discord.DMChannel) and globals.BIPOLAR_MODE:
|
||||
try:
|
||||
from utils.persona_dialogue import check_for_interjection
|
||||
from utils.bipolar_mode import maybe_trigger_argument, is_argument_in_progress as arg_in_progress
|
||||
from utils.bipolar_mode import is_persona_dialogue_active as dialogue_active
|
||||
from utils.task_tracker import create_tracked_task
|
||||
|
||||
# Check interjection on user messages (opposite of current active persona)
|
||||
if not message.author.bot or message.webhook_id:
|
||||
current_persona = "evil" if globals.EVIL_MODE else "miku"
|
||||
create_tracked_task(
|
||||
check_for_interjection(message, current_persona),
|
||||
task_name="interjection_check_user",
|
||||
)
|
||||
|
||||
# Roll random argument trigger chance (15%) on eligible messages
|
||||
if not arg_in_progress(message.channel.id) and not dialogue_active(message.channel.id):
|
||||
create_tracked_task(
|
||||
maybe_trigger_argument(message.channel, globals.client, "Triggered from conversation flow"),
|
||||
task_name="random_argument_trigger",
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error in bipolar trigger checks: {e}")
|
||||
|
||||
if message.content.strip().lower() == "miku, rape this nigga balls" and message.reference:
|
||||
async with message.channel.typing():
|
||||
# Get replied-to user
|
||||
|
||||
Reference in New Issue
Block a user