RaphielGang / Telegram-Paperplane

The Paperplane userbot project - a Telegram userbot helping to improve your Telegram experience. https://t.me/tgpaperplane
Other
289 stars 1.06k forks source link

.img command always errors #200

Closed watzon closed 4 years ago

watzon commented 4 years ago

Describe the bug Everytime I use the .img command it returns an error.

To Reproduce Steps to reproduce the behavior: Send .img donald trump meme or any other query

Expected behavior Images should be returned with no error

Python Version Using baalajimaestro/userbot_python:latest, so the version in there

Additional context It seems as though there are two types of errors. One looks like this

Traceback info:
Traceback (most recent call last):
  File "/app/userbot/events.py", line 80, in wrapper
    await func(check)
  File "/app/userbot/modules/scrapers.py", line 66, in img_sampler
    os.rmdir(os.path.dirname(os.path.abspath(lst[0])))
OSError: [Errno 39] Directory not empty: '/app/downloads'

The other occurs when adding a limit to the number of images using lim=5 in the query

Traceback info:
Traceback (most recent call last):
  File "/app/userbot/events.py", line 80, in wrapper
    await func(check)
  File "/app/userbot/modules/scrapers.py", line 65, in img_sampler
    os.remove(lst[1])
IndexError: list index out of range
raphielscape commented 4 years ago

Fixed as-per https://github.com/RaphielGang/Telegram-UserBot/commit/58382655b18a1edc97d324cb9bd2d2cb0185e436

Try to move your repo to staging and report.

watzon commented 4 years ago

Awesome I actually just made the same change in my fork and it worked. I was going to suggest it here. Closing.