Browse Source

pass self to the download function

master
manetta 4 years ago
parent
commit
0a29cd8fef
  1. 4
      LogBot/logbot.py

4
LogBot/logbot.py

@ -28,7 +28,7 @@ def write_log(self, message):
out.write(html) out.write(html)
print('writing to: ', log_path) print('writing to: ', log_path)
def download(message): def download(self, message):
# define media_type # define media_type
if message.url.lower().endswith(('.jpg','jpeg','png','.gif','.bmp','.svg','eps')): if message.url.lower().endswith(('.jpg','jpeg','png','.gif','.bmp','.svg','eps')):
media_type = 'images' media_type = 'images'
@ -125,7 +125,7 @@ logbot @uptime: To check how long @logbot has been around
# image / PDF / audio / video # image / PDF / audio / video
if message.url: if message.url:
media_post, media_type = download(message) media_post, media_type = download(self, message)
if media_post: if media_post:
add_to_db(self, message, media_post=media_post) add_to_db(self, message, media_post=media_post)
media_type = media_type.replace('images', 'image') # linguistic hack! media_type = media_type.replace('images', 'image') # linguistic hack!

Loading…
Cancel
Save