From c85d5cada4b7cee2af3b3fbaf3f6d489620870b2 Mon Sep 17 00:00:00 2001 From: Alex Oladele Date: Wed, 29 Apr 2020 23:14:13 -0400 Subject: [PATCH] Add lambda related fikes --- .idea/terminal.xml | 9 +++++++++ app/fact_bot.py | 10 ++++++---- config.yaml | 6 +++--- service.py | 5 ++--- 4 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 .idea/terminal.xml diff --git a/.idea/terminal.xml b/.idea/terminal.xml new file mode 100644 index 0000000..a91d2d0 --- /dev/null +++ b/.idea/terminal.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/fact_bot.py b/app/fact_bot.py index e50108d..8b39308 100644 --- a/app/fact_bot.py +++ b/app/fact_bot.py @@ -1,16 +1,18 @@ from app import fact_service, groupme from util import constants -if __name__ == '__main__': + +def post_fact_to_group(): # Get Groupme api token to post with groupme_client = groupme.get_client() - # Get specific group from groupme fact_bot = groupme.get_bot(constants.BOT_NAME) - # Get Random Fact fact = fact_service.get_random_fact() - # Post fact in Group # groupme_client. message = fact_bot.post(text=fact) + + +if __name__ == '__main__': + post_fact_to_group() diff --git a/config.yaml b/config.yaml index 282d3a6..c54fc41 100644 --- a/config.yaml +++ b/config.yaml @@ -1,10 +1,10 @@ -region: us-east-1 +region: us-east-2 function_name: avan_facts_bot handler: service.handler -description: Random Avan facts vis groupme +description: Random Avan facts via groupme runtime: python3.8 -# role: lambda_basic_execution +#role: lambda_basic_execution # S3 upload requires appropriate role with s3:PutObject permission # (ex. basic_s3_upload), a destination bucket, and the key prefix diff --git a/service.py b/service.py index f04dba3..30c412c 100644 --- a/service.py +++ b/service.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- +from app import fact_bot def handler(event, context): # Your code goes here! - e = event.get("e") - pi = event.get("pi") - return e + pi + fact_bot.post_fact_to_group()