renaming avatar file to make more sense

This commit is contained in:
Luke Robles 2018-03-12 13:00:51 -07:00
parent 90616bbe25
commit 876f20d100
2 changed files with 18 additions and 1 deletions

View File

@ -43,7 +43,7 @@ async def on_ready():
) )
if not debug: if not debug:
await client.edit_profile(avatar=avatar.change_avatar()) await client.edit_profile(avatar=set_avatar.change_bots_avatar())
print("\n********************************") print("\n********************************")
print("\nDRAGON BOT RUNNING IN {} MODE".format(dragon_environment.upper())) print("\nDRAGON BOT RUNNING IN {} MODE".format(dragon_environment.upper()))

17
app/set_avatar.py Normal file
View File

@ -0,0 +1,17 @@
import requests
import core_utils
import get_from_reddit
def change_bots_avatar():
image = None
while not image:
image = get_from_reddit.get_image(boards='smuganimegirls')
extension = image.split('.')[-1]
local_smug = "/tmp/smug.{}".format(extension)
if extension.lower() in ['png', 'jpg']:
# save an image locally
return open(core_utils.download_image(image, local_smug), 'rb').read()
else:
image = None