tools: Use the correct path for bot avatar to generate screenshots.

This commit is contained in:
Puneeth Chaganti 2020-05-15 13:42:26 +05:30 committed by Tim Abbott
parent 788203778d
commit d2dadde381
1 changed files with 7 additions and 5 deletions

View File

@ -64,11 +64,13 @@ def create_integration_bot(integration: WebhookIntegration, bot_name: Optional[s
)
notify_created_bot(bot)
bot_avatar_path = static_path(integration.DEFAULT_BOT_AVATAR_PATH.format(name=integration.name))
if os.path.isfile(bot_avatar_path):
with open(bot_avatar_path, "rb") as f:
upload_avatar_image(f, owner, bot)
do_change_avatar_fields(bot, UserProfile.AVATAR_FROM_USER)
bot_avatar_path = integration.get_bot_avatar_path()
if bot_avatar_path is not None:
bot_avatar_path = static_path(bot_avatar_path)
if os.path.isfile(bot_avatar_path):
with open(bot_avatar_path, "rb") as f:
upload_avatar_image(f, owner, bot)
do_change_avatar_fields(bot, UserProfile.AVATAR_FROM_USER)
return bot