feat(achievement): support obtain achievements

This commit is contained in:
MingxuanGame
2025-08-21 08:50:16 +00:00
parent 9fb0d0c198
commit 068697355f
15 changed files with 864 additions and 30 deletions

View File

@@ -35,12 +35,22 @@ class RedisSubscriber:
ignore_subscribe_messages=True, timeout=None
)
if message is not None and message["type"] == "message":
matched_handlers = []
matched_handlers: list[Callable[[str, str], Awaitable[Any]]] = []
if message["channel"] in self.handlers:
matched_handlers.extend(self.handlers[message["channel"]])
chan = message["channel"]
for pattern, handlers in self.handlers.items():
if fnmatch(message["channel"], pattern):
matched_handlers.extend(handlers)
if pattern == chan:
continue
if not any(ch in pattern for ch in "*?[]"):
continue
if fnmatch(chan, pattern):
for h in handlers:
if h not in matched_handlers:
matched_handlers.append(h)
if matched_handlers:
await asyncio.gather(
*[