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
a733500c
Verified
Commit
a733500c
authored
Jul 14, 2025
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
watch module: fix duplicate display and add support for arguments
parent
0f074af2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
24 deletions
+54
-24
__init__.py
src/data/keyboards/__init__.py
+1
-0
watch.py
src/data/keyboards/watch.py
+12
-0
watch.py
src/handlers/watch.py
+41
-24
No files found.
src/data/keyboards/__init__.py
View file @
a733500c
from
.
import
start
as
start_keyboards
from
.
import
start
as
start_keyboards
from
.
import
menu
as
menu_keyboards
from
.
import
menu
as
menu_keyboards
from
.
import
profile
as
profile_keyboards
from
.
import
profile
as
profile_keyboards
from
.
import
watch
as
watch_keyboards
src/data/keyboards/watch.py
0 → 100644
View file @
a733500c
from
telegrinder
import
InlineKeyboard
,
InlineButton
def
watch_more_kb
(
maintainer
:
str
):
kb
=
InlineKeyboard
()
kb
.
add
(
InlineButton
(
"Полный список"
,
url
=
f
"https://packages.altlinux.org/ru/sisyphus/maintainers/{maintainer}/watch"
,
)
)
return
kb
.
get_markup
()
src/handlers/watch.py
View file @
a733500c
from
telegrinder
import
Dispatch
,
Message
from
telegrinder
import
Dispatch
,
Message
from
telegrinder.rules
import
Command
,
Text
,
IsUser
from
telegrinder.rules
import
Command
,
Argument
,
Text
,
IsUser
from
telegrinder.tools.formatting
import
HTMLFormatter
from
telegrinder.tools.formatting
import
HTMLFormatter
from
telegrinder.types
import
LinkPreviewOptions
from
api
import
api
from
api
import
api
from
api.models
import
BugzillaInfoModel
from
services.menu
import
send_menu
from
database.models
import
User
from
database.models
import
User
from
data.keyboards
import
watch_keyboards
dp
=
Dispatch
()
dp
=
Dispatch
()
dp
.
message
.
auto_rules
=
IsUser
()
@dp.message
(
Command
(
"watch"
,
Argument
(
"maintainer"
,
optional
=
True
)))
@dp.message
(
Text
([
"watch"
,
"отслеживание"
],
ignore_case
=
True
),
IsUser
())
async
def
watch_handler
(
m
:
Message
,
user
:
User
|
None
,
maintainer
:
str
|
None
)
->
None
:
@dp.message
(
Command
(
"watch"
)
|
Text
([
"watch"
,
"отслеживание"
],
ignore_case
=
True
))
if
maintainer
:
async
def
watch_handler
(
m
:
Message
,
user
:
User
|
None
)
->
None
:
maintainer
=
maintainer
.
lower
()
maintainer_data
=
await
api
.
site
.
all_maintainers
(
"sisyphus"
)
if
not
any
(
_m
.
packager_nickname
==
maintainer
for
_m
in
maintainer_data
.
maintainers
):
await
m
.
answer
(
f
"Сопровождающий {maintainer} не найден."
)
else
:
if
user
:
maintainer
=
user
.
maintainer
else
:
return
if
user
is
None
:
watch_data
=
await
api
.
site
.
watch_by_maintainer
(
maintainer
)
return
watch_data
=
await
api
.
site
.
watch_by_maintainer
(
user
.
maintainer
)
if
not
len
(
watch_data
.
packages
):
if
not
len
(
watch_data
.
packages
):
await
m
.
answer
(
await
m
.
answer
(
"Нет устаревших пакетов"
)
"У вас нет устаревших пакетов"
)
return
return
watch_message
=
"Отслеживание:
\n\n
"
watch_message
=
"Отслеживание:
\n\n
"
for
i
,
package
in
enumerate
(
watch_data
.
packages
):
packages
=
{}
for
package
in
watch_data
.
packages
:
name
=
package
.
pkg_name
if
name
not
in
packages
or
"src.rpm"
in
packages
[
name
]
.
url
:
packages
[
name
]
=
package
packages
=
list
(
packages
.
values
())
for
i
,
package
in
enumerate
(
packages
):
if
i
==
30
:
if
i
==
30
:
break
break
watch_message
+=
f
"{package.pkg_name}: {package.old_version} -> "
+
\
watch_message
+=
(
HTMLFormatter
(
f
"{package.pkg_name}: {package.old_version} -> "
f
"<a href='{package.url}'>{package.new_version}</a>"
)
+
"
\n
"
+
HTMLFormatter
(
f
"<a href='{package.url.replace("
.
git
/
", "
/
")}'>{package.new_version}</a>"
if
len
(
watch_data
.
packages
)
>
30
:
)
+
"
\n
"
)
markup
=
None
if
len
(
packages
)
>
30
:
watch_message
+=
"
\n
..."
watch_message
+=
"
\n
..."
markup
=
watch_keyboards
.
watch_more_kb
(
maintainer
)
await
m
.
answer
(
watch_message
)
await
m
.
answer
(
watch_message
,
reply_markup
=
markup
)
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