forked from varia/bots
pass self to the download function
This commit is contained in:
parent
22944ec0c8
commit
0a29cd8fef
@ -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…
Reference in New Issue
Block a user