Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
altlinux-packages-bot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Unitsaev
altlinux-packages-bot
Commits
e12aa616
Verified
Commit
e12aa616
authored
Jul 27, 2025
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
help module: add help and update altrepo_info commands
parent
373e8362
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
7 deletions
+84
-7
config.py
src/config.py
+10
-0
func.py
src/database/func.py
+8
-0
help.py
src/handlers/help.py
+61
-6
main.py
src/main.py
+5
-1
No files found.
src/config.py
View file @
e12aa616
...
...
@@ -39,3 +39,13 @@ 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
)
# ====== Repo
bot_repositories
=
[
[
"GitLab Eterfund"
,
"https://gitlab.eterfund.ru/fiersik/altlinux-packages-bot"
],
[
"ALT Linux Space (Зеркало)"
,
"https://altlinux.space/fiersik/altlinux-packages-bot"
]
]
bot_developers
=
[
[
"Кирилл Уницаев (Fiersik)"
,
"https://gitlab.eterfund.ru/fiersik"
]
]
src/database/func.py
View file @
e12aa616
...
...
@@ -5,6 +5,10 @@ from .models import Maintainer, User, Package
class
MaintainerMethod
:
@classmethod
def
count
(
cls
)
->
int
:
return
Maintainer
.
select
()
.
count
()
@classmethod
def
add
(
cls
,
nickname
:
str
,
name
:
str
,
name_ru
:
str
|
None
=
None
):
"""создание записи сопровождающего"""
if
cls
.
get
(
nickname
=
nickname
)
is
None
:
...
...
@@ -138,6 +142,10 @@ class UserMethod:
class
PackageMethod
:
@classmethod
def
count
(
cls
)
->
int
:
return
Package
.
select
()
.
count
()
@classmethod
def
add
(
cls
,
name
:
str
,
summary
:
str
,
summary_ru
:
str
|
None
=
None
):
"""создание записи пакета"""
if
cls
.
get
(
name
=
name
)
is
None
:
...
...
src/handlers/help.py
View file @
e12aa616
from
telegrinder
import
Dispatch
,
Message
from
telegrinder.rules
import
Command
from
telegrinder.tools.formatting
import
HTMLFormatter
,
link
from
altrepo
import
altrepo
from
database.func
import
DB
from
services.utils
import
_bold
from
config
import
bot_repositories
,
bot_developers
dp
=
Dispatch
()
...
...
@@ -9,12 +13,63 @@ dp = Dispatch()
@dp.message
(
Command
(
"altrepo_info"
))
async
def
info_handler
(
m
:
Message
)
->
None
:
api_data
=
await
altrepo
.
api
.
version
()
warn
=
(
f
"Бот разработан под версию API {altrepo.api.BASE_API_VERSION} и может работать нестабильно.
\n
"
"Разработчик уже уведомлён."
repos_formatted
=
"
\n
"
.
join
(
f
" - {HTMLFormatter(link(url, text=name))}"
for
name
,
url
in
bot_repositories
)
developers_formatted
=
"
\n
"
.
join
(
f
" - {HTMLFormatter(link(url, text=name))}"
for
name
,
url
in
bot_developers
)
await
m
.
answer
(
"Telegram-бот для портала packages.altlinux.org
\n\n
"
f
"{_bold("
ALTRepo
API
:
")}
\n
"
f
" Актуальная версия: {api_data.version}
\n
"
f
" Поддерживаемая ботом: {altrepo.api.BASE_API_VERSION}
\n\n
"
f
"{_bold("
ALTRepo
Bot
DB
:
")}
\n
"
f
" Сопровождающих в базе: {DB.maintainer.count()}
\n
"
f
" Пакетов переведено: {DB.package.count()}
\n\n
"
f
"{_bold("
Исходный
код
:
")}
\n
"
f
"{repos_formatted}
\n\n
"
f
"{_bold("
Разработчики
:
")}
\n
"
f
"{developers_formatted}
\n\n
"
"Лицензия: AGPL-3
\n\n
"
f
"{_bold("
Разработано
при
поддержке
Etersoft
")}"
)
@dp.message
(
Command
(
"help"
,
mention_needed_in_chat
=
True
))
async
def
help_handler
(
m
:
Message
)
->
None
:
await
m
.
answer
(
"Telegram бот для портала packages.altlinux.org
\n
"
f
"Версия API: {api_data.version}
\n\n
"
f
"{warn if api_data.version != altrepo.api.BASE_API_VERSION else ""}"
f
"{_bold("
Основные
:
")}
\n
"
" /profile — профиль сопровождающего
\n
"
" /help — помощь
\n
"
" /altrepo_info — информация о боте
\n\n
"
f
"{_bold("
Отслеживание
пакетов
:
")}
\n
"
" /watch — текущего сопровождающего
\n
"
" /watch maintainer — выбранного сопровождающего
\n\n
"
f
"{_bold("
Отслеживание
багов
:
")}
\n
"
" /bugs — текущего сопровождающего
\n
"
" /bugs maintainer — выбранного сопровождающего
\n\n
"
f
"{_bold("
Ошибки
пересборки
:
")}
\n
"
" /ftbfs — текущего сопровождающего
\n
"
" /ftbfs maintainer — выбранного сопровождающего
\n\n
"
f
"{_bold("
Статистика
репозитория
:
")}
\n
"
" /statistics — текущего
\n
"
" /statistics branch — выбранного
\n\n
"
f
"{_bold("
Новости
:
")}
\n
"
" /news — меню новостей
\n
"
)
src/main.py
View file @
e12aa616
...
...
@@ -26,7 +26,11 @@ async def startup():
await
update_maintainers
()
await
bot
.
api
.
set_my_commands
(
commands
=
[
BotCommand
(
"watch"
,
"Отслеживание по пакетам"
),
BotCommand
(
"bugs"
,
"Отслеживание по ошибкам"
)
BotCommand
(
"bugs"
,
"Отслеживание по ошибкам"
),
BotCommand
(
"ftbfs"
,
"Ошибки пересборки"
),
BotCommand
(
"statistics"
,
"Статистика репозитория"
),
BotCommand
(
"altrepo_info"
,
"Информация о боте"
),
BotCommand
(
"help"
,
"Справка"
)
])
@bot.loop_wrapper.lifespan.on_shutdown
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment