mirror of
https://gitflic.ru/project/alt-gnome/karkas.git
synced 2024-12-24 00:33:06 +03:00
Merged with cicd/init
This commit is contained in:
commit
3514234526
14
gitflic-ci.yaml
Normal file
14
gitflic-ci.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
stages:
|
||||
- lint
|
||||
|
||||
lint-pre-commit:
|
||||
stage: lint
|
||||
image: python:3.12-bullseye
|
||||
before_script:
|
||||
- pip install pre-commit
|
||||
scripts:
|
||||
- pre-commit run --all-files
|
||||
cache:
|
||||
paths:
|
||||
- .cache/pip
|
||||
- .cache/pre-commit
|
@ -85,7 +85,7 @@ class ConfigManager:
|
||||
value_type: str,
|
||||
options: List[Any] = None,
|
||||
multiple: bool = False,
|
||||
default_value = None,
|
||||
default_value=None,
|
||||
editable: bool = True,
|
||||
shared: bool = False,
|
||||
required: bool = False,
|
||||
|
@ -1,7 +1,7 @@
|
||||
from .filters import (
|
||||
ChatIDFilter,
|
||||
ChatModerOrAdminFilter,
|
||||
ChatNotInApproveFilter,
|
||||
ChatIDFilter,
|
||||
chat_not_in_approve,
|
||||
module_init,
|
||||
)
|
||||
|
@ -1,9 +1,10 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from aiogram import Router
|
||||
from aiogram.filters import Command
|
||||
from aiogram.types import Message, ChatMemberOwner, ChatMemberAdministrator
|
||||
from aiogram.types import ChatMemberAdministrator, ChatMemberOwner, Message
|
||||
|
||||
from ocab_core.modules_system.public_api import get_module, register_router, log
|
||||
from ocab_core.modules_system.public_api import get_module, log, register_router
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ocab_modules.standard.filters import ChatIDFilter as IChatIDFilter
|
||||
@ -11,41 +12,40 @@ if TYPE_CHECKING:
|
||||
try:
|
||||
ChatIDFilter: "type[IChatIDFilter]" = get_module("standard.filters", "ChatIDFilter")
|
||||
FILTERS_MODULE_LOADED = True
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
FILTERS_MODULE_LOADED = False
|
||||
pass
|
||||
|
||||
try:
|
||||
register_command = get_module("standard.command_helper", "register_command")
|
||||
COMMAND_HELPER_MODULE_LOADED = True
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
COMMAND_HELPER_MODULE_LOADED = False
|
||||
pass
|
||||
|
||||
|
||||
def can_moderate(admin: ChatMemberOwner | ChatMemberAdministrator) -> bool:
|
||||
if isinstance(admin, ChatMemberOwner):
|
||||
return True
|
||||
|
||||
return (
|
||||
admin.user.is_bot == False and
|
||||
(
|
||||
admin.can_delete_messages and
|
||||
admin.can_restrict_members
|
||||
)
|
||||
return admin.user.is_bot is False and (
|
||||
admin.can_delete_messages and admin.can_restrict_members
|
||||
)
|
||||
|
||||
|
||||
async def report(message: Message):
|
||||
try:
|
||||
if message.reply_to_message is None:
|
||||
await message.reply("Пожалуйста, используйте команду /report в ответ на сообщение, которое вы хотите отметить как спам.")
|
||||
await message.reply(
|
||||
"Пожалуйста, используйте команду /report в ответ на сообщение"
|
||||
", которое вы хотите отметить как спам."
|
||||
)
|
||||
return
|
||||
|
||||
admins = await message.chat.get_administrators()
|
||||
|
||||
admin_usernames = [
|
||||
admin.user.mention_html()
|
||||
for admin in admins
|
||||
if can_moderate(admin)
|
||||
admin.user.mention_html() for admin in admins if can_moderate(admin)
|
||||
]
|
||||
if admin_usernames:
|
||||
ping_message = "⚠️ Внимание, жалоба на спам! " + ", ".join(admin_usernames)
|
||||
|
Loading…
Reference in New Issue
Block a user