Files
WeechatPayBot/bot/create_bot.py

38 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# aiogram
from aiogram import Bot, Dispatcher
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
from aiogram.fsm.storage.redis import RedisStorage, DefaultKeyBuilder, StorageKey
from aiogram.types import BotCommand
# cfg
from decouple import config
# db
from database.orm import ORM
# another
import logging, pytz
# logging
from utils.logging_config import setup_logging
setup_logging(service_name="tgbot")
logger = logging.getLogger(__name__)
redis_url = config("REDIS_URL")
bot = Bot(
token=config("TOKEN"), default=DefaultBotProperties(parse_mode=ParseMode.HTML)
)
storage = RedisStorage.from_url(redis_url)
storage.key_builder = DefaultKeyBuilder(with_bot_id=True)
dp = Dispatcher(storage=storage)
start_command = [BotCommand(command="/start", description="🔄 Перезапустить бота")]
bot_description = (
"Вас приветствует сервис пополнения цифровых кошельков Wechat и Alipay!\n\n"
"Нажмите старт для продолжения."
)
tz = pytz.timezone(config("TIMEZONE"))
orm = ORM()