-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathbot.py
More file actions
33 lines (21 loc) · 737 Bytes
/
bot.py
File metadata and controls
33 lines (21 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from os import environ
if not environ.get("BOT_TOKEN"):
from dotenv import load_dotenv
load_dotenv()
from telegram.ext import ApplicationBuilder
from telegram_ecommerce.utils.consts import bot_token
from telegram_ecommerce.utils.log import logger
from telegram_ecommerce.handlers import (
all_public_commands_descriptions,
all_handlers)
async def post_init(app):
await app.bot.set_my_commands(all_public_commands_descriptions)
def main():
app = ApplicationBuilder().token(bot_token).post_init(post_init).build()
for handler in all_handlers:
app.add_handler(handler)
logger.info("bot started")
app.run_polling()
logger.info("bot closed")
if __name__ == "__main__":
main()