From 69873b3c8d4361be576a6722b95184515dd7c816 Mon Sep 17 00:00:00 2001 From: grassblock Date: Fri, 19 Sep 2025 20:26:46 +0800 Subject: [PATCH] feat: check emoji in promote title --- core/promote.py | 4 ++++ pyproject.toml | 1 + uv.lock | 11 +++++++++++ 3 files changed, 16 insertions(+) diff --git a/core/promote.py b/core/promote.py index 2e6f214..a979a1e 100644 --- a/core/promote.py +++ b/core/promote.py @@ -1,5 +1,6 @@ from aiogram.exceptions import TelegramBadRequest from aiogram.types import Message +from emoji import is_emoji from config import config @@ -19,6 +20,9 @@ async def handle_promote_command(message: Message) -> None: if len(title) > 16: await message.reply('头衔太长了,咱设置不了') return + if any(is_emoji(s) for s in title): + await message.reply('你这叽里咕噜的杜叔叔也看不懂啊') + return if member.status == 'creator': await message.reply('咱不能给群主设置头衔') return diff --git a/pyproject.toml b/pyproject.toml index dd38af7..243d05a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ dependencies = [ "aiodns==3.5.0", "aiogram==3.21.0", "dulwich==0.24.1", + "emoji==2.14.1", "mastodon-py==2.0.1", "matrix-nio==0.25.2", "mcstatus==12.0.2", diff --git a/uv.lock b/uv.lock index 70a7733..07d911b 100644 --- a/uv.lock +++ b/uv.lock @@ -235,6 +235,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c9/bc/a2557d1b0afa5bf1e140f42f8cbca1783e43d7fa17665859c63060957952/dulwich-0.24.1-py3-none-any.whl", hash = "sha256:57cc0dc5a21059698ffa4ed9a7272f1040ec48535193df84b0ee6b16bf615676", size = 440765, upload-time = "2025-08-01T10:26:45.415Z" }, ] +[[package]] +name = "emoji" +version = "2.14.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cb/7d/01cddcbb6f5cc0ba72e00ddf9b1fa206c802d557fd0a20b18e130edf1336/emoji-2.14.1.tar.gz", hash = "sha256:f8c50043d79a2c1410ebfae833ae1868d5941a67a6cd4d18377e2eb0bd79346b", size = 597182, upload-time = "2025-01-16T06:31:24.983Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/91/db/a0335710caaa6d0aebdaa65ad4df789c15d89b7babd9a30277838a7d9aac/emoji-2.14.1-py3-none-any.whl", hash = "sha256:35a8a486c1460addb1499e3bf7929d3889b2e2841a57401903699fef595e942b", size = 590617, upload-time = "2025-01-16T06:31:23.526Z" }, +] + [[package]] name = "frozenlist" version = "1.7.0" @@ -685,6 +694,7 @@ dependencies = [ { name = "aiodns" }, { name = "aiogram" }, { name = "dulwich" }, + { name = "emoji" }, { name = "mastodon-py" }, { name = "matrix-nio" }, { name = "mcstatus" }, @@ -699,6 +709,7 @@ requires-dist = [ { name = "aiodns", specifier = "==3.5.0" }, { name = "aiogram", specifier = "==3.21.0" }, { name = "dulwich", specifier = "==0.24.1" }, + { name = "emoji", specifier = "==2.14.1" }, { name = "mastodon-py", specifier = "==2.0.1" }, { name = "matrix-nio", specifier = "==0.25.2" }, { name = "mcstatus", specifier = "==12.0.2" },