mirror of
https://github.com/miloszowi/everyone-mention-telegram-bot.git
synced 2025-05-20 09:14:07 +00:00
webhook to start pooling, removed env variables for app url and port
Author: miloszowi <miloszweb@gmail.com> Author: miloszowi <miloszweb@gmail.com>
This commit is contained in:
parent
c22338b7c1
commit
c29b0dabc5
@ -4,5 +4,3 @@ firebase_authDomain=
|
||||
firebase_databaseURL=
|
||||
firebase_projectId=
|
||||
firebase_storageBucket=
|
||||
app_url=
|
||||
PORT=
|
@ -33,8 +33,6 @@ cp .env.local .env
|
||||
and then fulfill copied `.env` file with required values
|
||||
- `bot_token` - your telegram bot token from [BotFather](https://telegram.me/BotFather)
|
||||
- `firebase_*` - all of those values you can find in firebase console
|
||||
- `app_url` - your app url for retrieving webhooks
|
||||
- `PORT` - port for your app
|
||||
|
||||
### Commands
|
||||
#### `/in`
|
||||
|
13
src/app.py
13
src/app.py
@ -1,4 +1,4 @@
|
||||
from .config.credentials import bot_token, app_url, port
|
||||
from .config.credentials import bot_token
|
||||
from .config.handlers import handlers
|
||||
from .handlers.handlerInterface import HandlerInterface
|
||||
from telegram.ext.dispatcher import Dispatcher
|
||||
@ -14,8 +14,7 @@ class App:
|
||||
|
||||
def run(self) -> None:
|
||||
self.registerHandlers()
|
||||
self.registerWebhook()
|
||||
|
||||
self.updater.start_polling()
|
||||
self.updater.idle()
|
||||
|
||||
def registerHandlers(self) -> None:
|
||||
@ -24,11 +23,3 @@ class App:
|
||||
raise Exception('Invalid list of handlers provided. Handler must implement HandlerInterface')
|
||||
|
||||
self.updater.dispatcher.add_handler(handler.getBotHandler())
|
||||
|
||||
def registerWebhook(self) -> None:
|
||||
self.updater.start_webhook(
|
||||
listen="0.0.0.0",
|
||||
port=int(port),
|
||||
url_path=bot_token,
|
||||
webhook_url=f'{app_url}/{bot_token}'
|
||||
)
|
||||
|
@ -4,8 +4,6 @@ from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
bot_token = os.environ['bot_token']
|
||||
app_url = os.environ['app_url']
|
||||
port = os.environ['PORT']
|
||||
|
||||
firebaseConfig = {
|
||||
"apiKey": os.environ['firebase_apiKey'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user