Skip to content

Commit

Permalink
fix #1509 by kecode
Browse files Browse the repository at this point in the history
  • Loading branch information
DoroWolf committed Jan 12, 2025
1 parent 039b0d8 commit c86049e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions core/builtins/message/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,19 @@ def match_kecode(text: str) -> List[Union[PlainElement, ImageElement, VoiceEleme
elements.append(VoiceElement.assign(a))
else:
elements.append(VoiceElement.assign(a))
elif element_type == "i18n":
key = ""
kwargs = {}
for a in args:
ma = re.match(r"(.*?)=(.*)", a)
if ma:
if ma.group(1) == "key":
key = ma.group(2)
else:
kwargs[ma.group(1)] = ma.group(2)

elements.append(I18NContextElement.assign(key, **kwargs))

return elements


Expand Down
2 changes: 1 addition & 1 deletion modules/wiki/utils/wikilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from copy import deepcopy
from typing import Union, Dict, List

from attrs import define
import orjson as json
from bs4 import BeautifulSoup

Expand All @@ -22,7 +23,6 @@
from .dbutils import WikiSiteInfo as DBSiteInfo, Audit
from .mapping import *

from attrs import define

default_locale = Config("default_locale", cfg_type=str)
enable_tos = Config("enable_tos", True)
Expand Down

0 comments on commit c86049e

Please sign in to comment.