base: update config

parent 2d7d6ec6
from telegrinder import API, Token
from telegrinder.types import LinkPreviewOptions
from telegrinder.modules import logger
from telegrinder.tools.formatting import HTMLFormatter
from pydantic_settings import BaseSettings, SettingsConfigDict from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import List
class Config(BaseSettings): class Config(BaseSettings):
model_config = SettingsConfigDict( model_config = SettingsConfigDict(
env_file=".env", env_file=".env",
...@@ -7,6 +15,8 @@ class Config(BaseSettings): ...@@ -7,6 +15,8 @@ class Config(BaseSettings):
extra="ignore" extra="ignore"
) )
BOT_TOKEN: str BOT_TOKEN: str
admins: List[int]
config = Config() config = Config()
...@@ -19,4 +29,13 @@ DEFAUIL_BRANCHES = [ ...@@ -19,4 +29,13 @@ DEFAUIL_BRANCHES = [
BUGS_URL = "https://bugzilla.altlinux.org/" BUGS_URL = "https://bugzilla.altlinux.org/"
PACKAGES_URL = "https://packages.altlinux.org/ru/{repo}/" PACKAGES_URL = "https://packages.altlinux.org/ru/{repo}/"
CYBERTALK_URL = "https://lists.altlinux.org/pipermail/sisyphus-cybertalk/{}/" CYBERTALK_URL = "https://lists.altlinux.org/pipermail/sisyphus-cybertalk/{}/"
\ No newline at end of file
# ====== BOT
logger.set_level("INFO")
tg_api = API(token=Token(config.BOT_TOKEN))
tg_api.default_params["parse_mode"] = HTMLFormatter.PARSE_MODE
tg_api.default_params["link_preview_options"] = LinkPreviewOptions(
is_disabled=True)
from telegrinder import API, Telegrinder, Token, Message from telegrinder import Telegrinder, Message
from telegrinder.modules import logger from telegrinder.modules import logger
from telegrinder.tools.formatting import HTMLFormatter from telegrinder.types import BotCommand
from telegrinder.types import LinkPreviewOptions, BotCommand
from telegrinder.node import Error from telegrinder.node import Error
from config import config from config import tg_api
from altrepo import altrepo from altrepo import altrepo
from altrepo.api.errors import TooManyRequests from altrepo.api.errors import TooManyRequests
from database.models import db, User from database.models import db, User
from middlewares import UserMiddleware from middlewares import UserMiddleware
logger.set_level("INFO")
tg_api = API(token=Token(config.BOT_TOKEN))
tg_api.default_params["parse_mode"] = HTMLFormatter.PARSE_MODE
tg_api.default_params["link_preview_options"] = LinkPreviewOptions(is_disabled=True)
bot = Telegrinder(tg_api) bot = Telegrinder(tg_api)
bot.dispatch.load_from_dir("src/handlers") bot.dispatch.load_from_dir("src/handlers")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment