feat: 게시글 등록 후 메시지에 캡처파일 다운로드 링크 추가
- 게시글 등록 완료 메시지에 캡처파일 다운로드 링크 포함 - 메시지 포맷 개선 (제목을 마크다운 링크로 표시) - 캡처파일 정보와 다운로드 경로를 메시지에 명확히 표시
This commit is contained in:
@ -288,18 +288,23 @@ def write_board(board, subject, content, mb_id, nickname, ca_name=None, file_lis
|
|||||||
f"📅 날짜: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"\
|
f"📅 날짜: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"\
|
||||||
f"📋 게시판: `{board}`\n"\
|
f"📋 게시판: `{board}`\n"\
|
||||||
f"📝 제목: {subject}\n"\
|
f"📝 제목: {subject}\n"\
|
||||||
f"📎 첨부파일: {file_count}개"
|
f"📎 첨부파일: {file_count}개\n"
|
||||||
|
|
||||||
# 캡처파일 정보 추가 (file_list에 2개 이상의 파일이 있을 경우)
|
# 캡처파일 정보 및 다운로드 링크 추가 (file_list에 2개 이상의 파일이 있을 경우)
|
||||||
if file_list and len(file_list) > 1 and os.path.isfile(file_list[1]):
|
if file_list and len(file_list) > 1 and os.path.isfile(file_list[1]):
|
||||||
capture_filename = os.path.basename(file_list[1])
|
capture_filename = os.path.basename(file_list[1])
|
||||||
capture_size = os.path.getsize(file_list[1]) / 1024 # KB 단위
|
capture_size = os.path.getsize(file_list[1]) / 1024 # KB 단위
|
||||||
success_msg += f"\n🖼️ 캡처파일: `{capture_filename}` ({capture_size:.1f}KB)"
|
success_msg += f"🖼️ **캡처파일**: `{capture_filename}` ({capture_size:.1f}KB)\n"
|
||||||
|
|
||||||
|
# 캡처파일 다운로드 링크 추가 (첫번째 첨부파일의 FTP 경로 기반)
|
||||||
|
if url and board:
|
||||||
|
capture_download_url = f"{url.rstrip('/')}/data/file/{board}/{os.path.basename(file_list[1])}"
|
||||||
|
success_msg += f"📥 **다운로드**: [캡처파일 보기]({capture_download_url})\n"
|
||||||
|
|
||||||
# 게시글 링크 추가
|
# 게시글 링크 추가
|
||||||
if url and board:
|
if url and board:
|
||||||
post_url = f"{url.rstrip('/')}/{board}/{wr_id}"
|
post_url = f"{url.rstrip('/')}/{board}/{wr_id}"
|
||||||
success_msg += f"\n🔗 게시글 링크: {post_url}"
|
success_msg += f"🔗 **게시글 링크**: [{subject}]({post_url})"
|
||||||
|
|
||||||
if msg_sender:
|
if msg_sender:
|
||||||
msg_sender.send(success_msg, platforms=['mattermost'])
|
msg_sender.send(success_msg, platforms=['mattermost'])
|
||||||
|
|||||||
Reference in New Issue
Block a user