Skip to content

Commit

Permalink
fix: forward error when bot in group
Browse files Browse the repository at this point in the history
  • Loading branch information
tangyoha committed Oct 31, 2023
1 parent 9121c71 commit 9807a62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@ WORKDIR /app

COPY requirements.txt /app/

RUN apk add --no-cache --virtual .build-deps gcc g++ cmake openblas-dev make musl-dev \
tiff-dev jpeg-dev openjpeg-dev zlib-dev freetype-dev lcms2-dev \
RUN apk add --no-cache --virtual .build-deps gcc g++ cmake make musl-dev \
&& apk add --no-cache openblas-dev tiff-dev jpeg-dev openjpeg-dev zlib-dev freetype-dev lcms2-dev \
libwebp-dev tcl-dev tk-dev harfbuzz-dev fribidi-dev libimagequant-dev \
libxcb-dev libpng-dev \
&& pip install --trusted-host pypi.python.org -r requirements.txt \
&& apk del .build-deps && rm -rf requirements.txt

RUN apk add --no-cache rclone
RUN apk add --no-cache rclone ffmpeg

FROM python:3.11.2-alpine As runtime-image
FROM tangyoha/telegram_media_downloader_compile As runtime-image

WORKDIR /app

RUN apk add --no-cache ffmpeg

COPY --from=tangyoha/telegram_media_downloader_compile:latest /usr/bin/rclone /app/rclone/rclone

COPY --from=tangyoha/telegram_media_downloader_compile:latest /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages

COPY config.yaml data.yaml setup.py media_downloader.py /app/
COPY module /app/module
COPY utils /app/utils
Expand Down
10 changes: 5 additions & 5 deletions module/pyrogram_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ async def _upload_telegram_chat_message(
# pylint: disable=R0912
async def forward_multi_media(
client: pyrogram.Client,
upload_user: pyrogram.Client,
_: pyrogram.Client,
app: Application,
node: TaskNode,
message: pyrogram.types.Message,
Expand Down Expand Up @@ -497,7 +497,7 @@ async def forward_multi_media(
else file_name
)
media_obj.thumb = (
await download_thumbnail(upload_user, app.temp_save_path, message)
await download_thumbnail(client, app.temp_save_path, message)
if message.video
else None
)
Expand All @@ -506,7 +506,7 @@ async def forward_multi_media(
proc_video_no_audio(file_name)

_media = await cache_media(
upload_user,
client,
node.upload_telegram_chat_id, # type: ignore
media_obj,
progress=update_upload_stat,
Expand All @@ -515,7 +515,7 @@ async def forward_multi_media(
ui_file_name,
time.time(),
node,
upload_user,
client,
),
)
except Exception as e:
Expand All @@ -529,7 +529,7 @@ async def forward_multi_media(
node.media_group_ids[message.media_group_id][message.id] = _media
node.upload_status[message.id] = UploadStatus.SuccessUpload

return await proc_cache_forward(upload_user, node, message, bool(file_name))
return await proc_cache_forward(client, node, message, bool(file_name))


async def proc_cache_forward(
Expand Down

0 comments on commit 9807a62

Please sign in to comment.