Skip to content

Commit

Permalink
πŸ”€ πŸ› fix(uploadService): λ©”μ‹œμ§€ Argument λ°›μ•„μ˜€λŠ” λΆ€λΆ„ 였λ₯˜ μˆ˜μ • + λ¦¬νŒ©ν† λ§ (#2)
Browse files Browse the repository at this point in the history
πŸ› fix(uploadService): λ©”μ‹œμ§€ Argument λ°›μ•„μ˜€λŠ” λΆ€λΆ„ 였λ₯˜ μˆ˜μ • + λ¦¬νŒ©ν† λ§
  • Loading branch information
kms0219kms authored Apr 7, 2024
2 parents e02beac + bf41911 commit 83bbd85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cogs/ZzalUpload.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def _upload(self, interaction: Interaction, message: Message, upload_type:
[
uploaded,
error,
] = await self.uploadService.upload(upload_type, message.content, message.attachments)
] = await self.uploadService.upload(upload_type, message)

if uploaded > 0:
if uploaded == 1:
Expand Down
12 changes: 6 additions & 6 deletions src/services/uploadService.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum
from typing import List

from discord import Attachment
from discord import Attachment, Message
from PIL import Image
from synology_api import filestation

Expand All @@ -23,7 +23,7 @@ def __init__(self):
self.google_util = sheet.SheetPlugin()
self.nasStation = filestation.FileStationPlugin().getFileStation()

async def upload(self, type: UploadType, message: str, files: List[Attachment]) -> tuple[int, str]:
async def upload(self, type: UploadType, message: Message) -> tuple[int, str]:
worksheet = self.google_util.get_worksheet_by_index(
key="1hfW3FTo9cjuMW9Kxvfnrbc6p_HyEnyYeA38mKM7nrOE", index=type.value
)
Expand All @@ -34,7 +34,7 @@ async def upload(self, type: UploadType, message: str, files: List[Attachment])
uploaded = 0
errors = []

for file in files:
for file in message.attachments:
filename = file.filename

if not (
Expand All @@ -46,7 +46,7 @@ async def upload(self, type: UploadType, message: str, files: List[Attachment])
):
_error_msg = f"`{filename}` νŒŒμΌμ€ μ§€μ›ν•˜μ§€ μ•ŠλŠ” ν˜•μ‹μž…λ‹ˆλ‹€."

if len(files) == 1:
if len(message.attachments) == 1:
raise Exception(_error_msg)
else:
errors.append(_error_msg)
Expand Down Expand Up @@ -76,7 +76,7 @@ async def upload(self, type: UploadType, message: str, files: List[Attachment])
if not zzal_name in resv_zzal_names:
_error_msg = f"`{zzal_name}` μ‹œνŠΈμ— λ“±λ‘λ˜μ§€ μ•Šμ€ 지 μ΄λ¦„μž…λ‹ˆλ‹€. 등둝 ν›„ λ‹€μ‹œ μ‹œλ„ν•΄ μ£Όμ„Έμš”."

if len(files) == 1:
if len(message.attachments) == 1:
raise Exception(_error_msg)
else:
errors.append(_error_msg)
Expand Down Expand Up @@ -125,7 +125,7 @@ async def upload(self, type: UploadType, message: str, files: List[Attachment])
else:
_error_msg = f"μ—…λ‘œλ“œ 쀑 λ¬Έμ œκ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.\n\n{uploadRes}"

if len(files) == 1:
if len(message.attachments) == 1:
raise Exception(_error_msg)
else:
errors.append(_error_msg)
Expand Down

0 comments on commit 83bbd85

Please sign in to comment.