1
0
forked from bot/app

3 Commits

Author SHA1 Message Date
c2cb416b4e 🐛 hotfix: ubl 2024-10-13 17:44:24 +08:00
5cd528d5e9 🐛 hotfix: ubl 2024-10-13 17:44:17 +08:00
980fca650b 🐛 hotfix: ubl 2024-10-13 13:44:07 +08:00
4 changed files with 9 additions and 84 deletions

14
pdm.lock generated
View File

@ -5,7 +5,7 @@
groups = ["default", "dev"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:ca1b7f108fb7c5bc51977cf165511cbc7a95f64bc4effd6b6597f60bf893ba77"
content_hash = "sha256:2687734ac110e65b8fb14eb5191175272fcc30d1a540bae0810510b84335a5ed"
[[metadata.targets]]
requires_python = ">=3.10"
@ -89,7 +89,7 @@ files = [
[[package]]
name = "croterline"
version = "1.0.3"
version = "1.0.4"
requires_python = ">=3.10"
summary = "Default template for PDM package"
groups = ["default"]
@ -97,8 +97,8 @@ dependencies = [
"magicoca>=1.0.1",
]
files = [
{file = "croterline-1.0.3-py3-none-any.whl", hash = "sha256:e934041248bba97382cc522c658d6c4f507dbcfe751e90a1d4cb3076b530e99b"},
{file = "croterline-1.0.3.tar.gz", hash = "sha256:eb3874a96ed06d98fe210731ad9352a854df81218fb2c25e707e2b641b6daffb"},
{file = "croterline-1.0.4-py3-none-any.whl", hash = "sha256:7af5f26c3cd66f965e7cd7cca2d5a839364ed65f281f9a7586aa20a62946f1d4"},
{file = "croterline-1.0.4.tar.gz", hash = "sha256:98754b1033665580c88e3ef4621d9b4293265450d4ff0a7352bb19852c4e113b"},
]
[[package]]
@ -142,13 +142,13 @@ files = [
[[package]]
name = "magicoca"
version = "1.0.1"
version = "1.0.4"
requires_python = ">=3.10"
summary = "A communication library for Python"
groups = ["default"]
files = [
{file = "magicoca-1.0.1-py3-none-any.whl", hash = "sha256:69e04be77f9c02d3d0730dc4e739246f4bdefee8b78631040b464cd98cdde51c"},
{file = "magicoca-1.0.1.tar.gz", hash = "sha256:0dbc9a35609db92ec79076f7126566c1e71bd4b853909ecbad9221dcc7fd6f31"},
{file = "magicoca-1.0.4-py3-none-any.whl", hash = "sha256:b0535d8a95990b96eaff6f8f19d21614ac3c22c954aa00e4a9e71e2765016161"},
{file = "magicoca-1.0.4.tar.gz", hash = "sha256:352763ff8f467b7c08e323c968d3edac30afd92a2a55dbff5ccf32d8e5c4dbe7"},
]
[[package]]

View File

@ -20,8 +20,8 @@ dependencies = [
"toml>=0.10.2",
"watchdog>=4.0.1",
"pdm-backend>=2.3.3",
"magicoca>=1.0.1",
"croterline>=1.0.3"
"magicoca>=1.0.4",
"croterline>=1.0.4",
]
[project.urls]

View File

@ -1,17 +0,0 @@
from nonebot.plugin import PluginMetadata
from .api import *
__author__ = "snowykami"
__plugin_meta__ = PluginMetadata(
name="联合黑名单(测试中...)",
description="",
usage="",
type="application",
homepage="https://github.com/snowykami/LiteyukiBot",
extra={
"liteyuki": True,
"toggleable" : True,
"default_enable" : True,
}
)

View File

@ -1,58 +0,0 @@
import datetime
import aiohttp
import nonebot
from nonebot import require
from nonebot.exception import IgnoredException
from nonebot.message import event_preprocessor
from nonebot_plugin_alconna.typings import Event
require("nonebot_plugin_apscheduler")
from nonebot_plugin_apscheduler import scheduler
blacklist_data: dict[str, set[str]] = {}
blacklist: set[str] = set()
@scheduler.scheduled_job("interval", minutes=10, next_run_time=datetime.datetime.now())
async def update_blacklist():
await request_for_blacklist()
async def request_for_blacklist():
global blacklist
urls = [
"https://cdn.liteyuki.icu/static/ubl/"
]
platforms = [
"qq"
]
for plat in platforms:
for url in urls:
url += f"{plat}.txt"
async with aiohttp.ClientSession() as client:
resp = await client.get(url)
blacklist_data[plat] = set((await resp.text()).splitlines())
blacklist = get_uni_set()
nonebot.logger.info("blacklists updated")
def get_uni_set() -> set:
s = set()
for new_set in blacklist_data.values():
s.update(new_set)
return s
@event_preprocessor
async def pre_handle(event: Event):
try:
user_id = str(event.get_user_id())
except:
return
if user_id in get_uni_set():
raise IgnoredException("UserId in blacklist")