mirror of
https://github.com/Balshgit/mosgortrans.git
synced 2025-09-11 13:00:40 +03:00
Compare commits
2 Commits
585367e621
...
b3b2217115
Author | SHA1 | Date | |
---|---|---|---|
b3b2217115 | |||
d88ef52c53 |
11
README.md
11
README.md
@ -22,7 +22,16 @@ sudo systemctl start mosgortrans.service
|
||||
python main.py
|
||||
```
|
||||
|
||||
- change bash bot-start.sh to python main.py
|
||||
- set `START_WITH_WEBHOOK` to blank
|
||||
|
||||
## Delete or set webhook manually
|
||||
|
||||
url: https://api.telegram.org/bot{TELEGRAM_TOKEN}/{method}Webhook?url={WEBHOOK_URL}
|
||||
|
||||
methods:
|
||||
- delete
|
||||
- set
|
||||
|
||||
|
||||
## Local development clean:
|
||||
|
||||
|
@ -5,13 +5,11 @@ WEBHOOK_HOST="https://mydomain.com"
|
||||
WEBHOOK_PATH="/transport"
|
||||
|
||||
# webserver settings
|
||||
WEBAPP_HOST="127.0.0.1"
|
||||
WEBAPP_HOST="0.0.0.0"
|
||||
WEBAPP_PORT="8080"
|
||||
|
||||
# set to true to start with webhook. Else bot will start on polling method
|
||||
START_WITH_WEBHOOK="true"
|
||||
|
||||
GECKO_DRIVER_VERSION="0.32.0"
|
||||
|
||||
# chat ids for scheduler tasks
|
||||
CHAT_IDS="123456789,987654321"
|
@ -27,7 +27,7 @@ class Application:
|
||||
TELEGRAM_API_TOKEN, '{TELEGRAM_API_TOKEN}'
|
||||
)
|
||||
)
|
||||
bot_scheduler.start()
|
||||
self.scheduler.start()
|
||||
|
||||
async def _on_shutdown(self, dp: Dispatcher) -> None:
|
||||
logger.warning('Shutting down..')
|
||||
|
@ -47,12 +47,13 @@ bot_cron_jobs = {
|
||||
|
||||
|
||||
class BotScheduler:
|
||||
scheduler = AsyncIOScheduler()
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cron_jobs: dict[str, dict[str, Any]],
|
||||
):
|
||||
self.cron_jobs = cron_jobs
|
||||
self.scheduler = AsyncIOScheduler()
|
||||
|
||||
def add_scheduler_jobs(self, jobs_name: str) -> None:
|
||||
cron_jobs = self.cron_jobs.get(jobs_name)
|
||||
|
@ -21,4 +21,5 @@ if __name__ == '__main__':
|
||||
if START_WITH_WEBHOOK:
|
||||
web.run_app(app=app, host=WEBAPP_HOST, port=WEBAPP_PORT)
|
||||
else:
|
||||
application.scheduler.start()
|
||||
application.bot_polling()
|
||||
|
Loading…
x
Reference in New Issue
Block a user