feat: 채널 이름 변경 시 워크스페이스+폴더 자동 연동
- on_guild_channel_update 이벤트로 이름 변경 감지 - workspace.rename_workspace(): 이름+폴더 변경 (VW_Proj 하위에만) - 변경 완료 시 채널에 알림 Embed 전송
This commit is contained in:
@@ -146,6 +146,37 @@ async def on_ready():
|
||||
)
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_guild_channel_update(before, after):
|
||||
"""채널 이름 변경 감지 -> 워크스페이스 자동 이름 변경."""
|
||||
if before.name == after.name:
|
||||
return
|
||||
|
||||
if not ws_manager.is_workspace_channel(after.id):
|
||||
return
|
||||
|
||||
ws = ws_manager.get_workspace(after.id)
|
||||
old_name = ws.name
|
||||
new_name = after.name
|
||||
|
||||
success, new_path = ws_manager.rename_workspace(after.id, new_name)
|
||||
|
||||
if success:
|
||||
embed = discord.Embed(
|
||||
title="📝 워크스페이스 자동 업데이트",
|
||||
description=(
|
||||
f"채널 이름 변경 감지: `{old_name}` -> `{new_name}`\n\n"
|
||||
f"워크스페이스 이름: **{new_name}**\n"
|
||||
f"경로: `{new_path}`"
|
||||
),
|
||||
color=0x3498DB,
|
||||
)
|
||||
await after.send(embed=embed)
|
||||
else:
|
||||
logger.warning(f"채널 이름 변경 시 워크스페이스 업데이트 실패: {new_path}")
|
||||
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_message(message: discord.Message):
|
||||
"""메시지 수신 — 워크스페이스 채널이면 자동 응답."""
|
||||
|
||||
Reference in New Issue
Block a user