fix: remove owner notification on topic drift escalation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,42 +33,9 @@ async def handle_topic_drift(
|
|||||||
return
|
return
|
||||||
|
|
||||||
count = tracker.record_off_topic(user_id)
|
count = tracker.record_off_topic(user_id)
|
||||||
escalation_threshold = config.get("escalation_count", 3)
|
|
||||||
messages_config = bot.config.get("messages", {})
|
messages_config = bot.config.get("messages", {})
|
||||||
|
|
||||||
if count >= escalation_threshold and not tracker.was_owner_notified(user_id):
|
if count >= 2:
|
||||||
tracker.mark_owner_notified(user_id)
|
|
||||||
owner = message.guild.owner
|
|
||||||
if owner:
|
|
||||||
dm_text = messages_config.get(
|
|
||||||
"topic_owner_dm",
|
|
||||||
"Heads up: {username} keeps going off-topic in #{channel}. Reminded {count} times.",
|
|
||||||
).format(
|
|
||||||
username=message.author.display_name,
|
|
||||||
channel=message.channel.name,
|
|
||||||
count=count,
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
await owner.send(dm_text)
|
|
||||||
except discord.HTTPException:
|
|
||||||
logger.warning("Could not DM server owner about topic drift.")
|
|
||||||
|
|
||||||
await log_action(
|
|
||||||
message.guild,
|
|
||||||
f"**TOPIC DRIFT \u2014 OWNER NOTIFIED** | {message.author.mention} | "
|
|
||||||
f"Off-topic count: {count} | Category: {topic_category}",
|
|
||||||
)
|
|
||||||
logger.info("Notified owner about %s topic drift (count %d)", message.author, count)
|
|
||||||
|
|
||||||
asyncio.create_task(bot.db.save_action(
|
|
||||||
guild_id=message.guild.id, user_id=user_id,
|
|
||||||
username=message.author.display_name,
|
|
||||||
action_type="topic_escalation", message_id=db_message_id,
|
|
||||||
details=f"off_topic_count={count} category={topic_category}",
|
|
||||||
))
|
|
||||||
save_user_state(bot, dirty_users, user_id)
|
|
||||||
|
|
||||||
elif count >= 2:
|
|
||||||
nudge_text = messages_config.get(
|
nudge_text = messages_config.get(
|
||||||
"topic_nudge",
|
"topic_nudge",
|
||||||
"{username}, let's keep it to gaming talk in here.",
|
"{username}, let's keep it to gaming talk in here.",
|
||||||
|
|||||||
Reference in New Issue
Block a user