diff --git a/Dockerfile b/Dockerfile index 4c60dba..9968a82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Run FROM python:3.12-slim -LABEL org.opencontainers.image.source https://github.com/kms0219kms/waklife_manager +LABEL org.opencontainers.image.source https://github.com/wakzoo-life/manager_bot WORKDIR /usr/app RUN apt update && apt install curl tar xz-utils git -y diff --git a/src/services/uploadService.py b/src/services/uploadService.py index 195100c..a4d96bb 100644 --- a/src/services/uploadService.py +++ b/src/services/uploadService.py @@ -3,9 +3,8 @@ from os.path import join from enum import Enum -from typing import List -from discord import Attachment, Message +from discord import Message from PIL import Image from synology_api import filestation @@ -34,7 +33,7 @@ async def upload(self, type: UploadType, message: Message) -> tuple[int, str]: # 짤 이름만 골라서 Get resv_zzal_names = [x.get("이름") for x in worksheet_data] - uploaded = 0 + uploaded = [] errors = [] for file in message.attachments: @@ -134,7 +133,20 @@ async def upload(self, type: UploadType, message: Message) -> tuple[int, str]: ) if uploadRes == "Upload Complete": - uploaded += 1 + if type != UploadType.DICT: + paths = [ + x + for x in str(worksheet_data[row].get("업로더")).split(",") + if x != "0" and x != "" and x != None + ] + paths.append(message.author.display_name) + + uploaded.append( + { + "range": "E" + str(row + 2), + "values": [[",".join(paths)]], + } + ) else: _error_msg = f"업로드 중 문제가 발생했습니다.\n\n{uploadRes}" @@ -150,13 +162,15 @@ async def upload(self, type: UploadType, message: Message) -> tuple[int, str]: if filename.endswith(".jpg") or filename.endswith(".jpeg") or filename.endswith(".png"): os.remove(join("temp/", f"{message.author.id}_{re.sub(r'\.(jpg|jpeg|png)$', '.webp', filename)}")) - if uploaded > 0: - if uploaded == 1: + if len(uploaded) > 0: + worksheet.batch_update(uploaded) + + if len(uploaded) == 1: return (1, "") if len(errors) >= 1: - return (uploaded, chr(10).join(errors)) + return (len(uploaded), chr(10).join(errors)) else: - return (uploaded, "") + return (len(uploaded), "") else: raise Exception(f"업로드 중 문제가 발생했습니다.")