Skip to content

Commit

Permalink
πŸ”€ πŸ› fix(uploadService): errors array type fix (#1)
Browse files Browse the repository at this point in the history
πŸ› fix(uploadService): errors array type fix
  • Loading branch information
kms0219kms authored Apr 7, 2024
2 parents 3a0bf6f + 8b8c532 commit 5c23ad1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/cogs/ZzalUpload.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def _upload(self, interaction: Interaction, message: Message, upload_type:
try:
[
uploaded,
errors,
error,
] = await self.uploadService.upload(upload_type, message.content, message.attachments)

if uploaded > 0:
Expand All @@ -35,8 +35,8 @@ async def _upload(self, interaction: Interaction, message: Message, upload_type:
f":tada: {len(message.attachments)}개 쀑 {uploaded}개 νŒŒμΌμ„ μ—…λ‘œλ“œν•˜λŠ”λ° μ„±κ³΅ν–ˆμŠ΅λ‹ˆλ‹€."
)

if len(errors) >= 1:
multiple_msg += f"\n\n{chr(10).join(errors)}"
if error != "":
multiple_msg += f"\n\n{error}"

await interaction.edit_original_response(content=multiple_msg)
else:
Expand Down
6 changes: 3 additions & 3 deletions src/services/uploadService.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, List[str]]:
async def upload(self, type: UploadType, message: str, files: List[Attachment]) -> tuple[int, str]:
worksheet = self.google_util.get_worksheet_by_index(
key="1hfW3FTo9cjuMW9Kxvfnrbc6p_HyEnyYeA38mKM7nrOE", index=type
)
Expand Down Expand Up @@ -138,11 +138,11 @@ async def upload(self, type: UploadType, message: str, files: List[Attachment])

if uploaded > 0:
if uploaded == 1:
return (1, [])
return (1, "")

if len(errors) >= 1:
return (uploaded, chr(10).join(errors))
else:
return (uploaded, [])
return (uploaded, "")
else:
raise Exception(f"μ—…λ‘œλ“œ 쀑 λ¬Έμ œκ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.")

0 comments on commit 5c23ad1

Please sign in to comment.