aboutsummaryrefslogtreecommitdiff
path: root/bot.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot.py')
-rw-r--r--bot.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/bot.py b/bot.py
index 1d59f9e..bcfab8f 100644
--- a/bot.py
+++ b/bot.py
@@ -8,7 +8,7 @@ from config import BOT_TOKEN, TELEGRAM_WEBHOOK_URL, HEALTHCHECK_URL, FEDI_LOGIN_
8import uvicorn 8import uvicorn
9from starlette.applications import Starlette 9from starlette.applications import Starlette
10from starlette.requests import Request 10from starlette.requests import Request
11from starlette.responses import PlainTextResponse, Response 11from starlette.responses import PlainTextResponse, Response, JSONResponse
12from starlette.routing import Route 12from starlette.routing import Route
13from telegram import Update 13from telegram import Update
14from telegram.ext import ( 14from telegram.ext import (
@@ -188,12 +188,12 @@ async def main() -> None:
188 await application.bot.set_webhook(url=f"{BOT_DOMAIN}{TELEGRAM_WEBHOOK_URL}") 188 await application.bot.set_webhook(url=f"{BOT_DOMAIN}{TELEGRAM_WEBHOOK_URL}")
189 189
190 # Set up webserver 190 # Set up webserver
191 async def telegram_webhook(request: Request) -> Response: 191 async def telegram_webhook(request: Request) -> JSONResponse:
192 """Handle incoming Telegram updates by putting them into the `update_queue`""" 192 """Handle incoming Telegram updates by putting them into the `update_queue`"""
193 await application.update_queue.put( 193 await application.update_queue.put(
194 Update.de_json(data=await request.json(), bot=application.bot) 194 Update.de_json(data=await request.json(), bot=application.bot)
195 ) 195 )
196 return Response() 196 return JSONResponse({'OK': 200})
197 197
198 async def fedi_oauth_login_callback(request: Request) -> PlainTextResponse: 198 async def fedi_oauth_login_callback(request: Request) -> PlainTextResponse:
199 """ 199 """
@@ -221,7 +221,7 @@ async def main() -> None:
221 routes=[ 221 routes=[
222 Route(TELEGRAM_WEBHOOK_URL, telegram_webhook, methods=["POST"]), 222 Route(TELEGRAM_WEBHOOK_URL, telegram_webhook, methods=["POST"]),
223 Route(HEALTHCHECK_URL, healthcheck, methods=["GET"]), 223 Route(HEALTHCHECK_URL, healthcheck, methods=["GET"]),
224 Route(FEDI_LOGIN_CALLBACK_URL, fedi_oauth_login_callback, methods=["POST", "GET"]), 224 Route(FEDI_LOGIN_CALLBACK_URL, fedi_oauth_login_callback, methods=["GET"]),
225 ] 225 ]
226 ) 226 )
227 webserver = uvicorn.Server( 227 webserver = uvicorn.Server(
@@ -229,7 +229,7 @@ async def main() -> None:
229 app=starlette_app, 229 app=starlette_app,
230 port=BOT_PORT, 230 port=BOT_PORT,
231 use_colors=False, 231 use_colors=False,
232 host="100.93.242.2", 232 host="0.0.0.0",
233 ) 233 )
234 ) 234 )
235 235
Powered by cgit v1.2.3 (git 2.41.0)