-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5 solution to deploy to aws as a lambda with a webhook - not working…
… yet
- Loading branch information
Oleksandr Gavryliuk
committed
Dec 7, 2023
1 parent
68eddfb
commit 0cba266
Showing
4 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,25 @@ | ||
.idea | ||
*.iml | ||
|
||
venv | ||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
.venv | ||
.env | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
#Intellij IDEA files | ||
.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import logging | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
from telegram import Update | ||
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler | ||
|
||
logging.basicConfig( | ||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', | ||
level=logging.INFO | ||
) | ||
|
||
load_dotenv() | ||
TOKEN = os.getenv('TOKEN') | ||
if TOKEN is None: | ||
raise ValueError('TOKEN not found in .env file') | ||
|
||
|
||
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): | ||
await context.bot.send_message(chat_id=update.effective_chat.id, text="Hello! I am 每日龙!\nLauching soon!") | ||
|
||
if __name__ == '__main__': | ||
application = ApplicationBuilder().token(TOKEN).build() | ||
|
||
start_handler = CommandHandler('start', start) | ||
application.add_handler(start_handler) | ||
|
||
application.run_polling() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
service: daily-dragon | ||
|
||
provider: | ||
name: aws | ||
runtime: python3.11 | ||
stage: dev | ||
region: us-east-1 | ||
environment: | ||
TELEGRAM_TOKEN: ${env:TELEGRAM_TOKEN} | ||
|
||
|
||
|
||
functions: | ||
post: | ||
handler: handler.py | ||
events: | ||
- http: | ||
path: daily-dragon | ||
method: post | ||
cors: true |